commit: 50a5318fe308b1dfe2370a743a6964a092bbd959
parent 7c2ab19971775259821d4a6b515aa7cb0573461a
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sun, 10 Mar 2024 12:25:41 +0100
test-cmd: ignore LD_PRELOAD=libsandbox.so when LDSTATIC is non-empty
Diffstat:
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
@@ -15,7 +15,7 @@ all: $(EXE) $(MAN1SO)
.PHONY: check
check: all test-lib/strtodur
- MALLOC_CHECK_=3 POSIX_ME_HARDER=1 POSIXLY_CORRECT=1 kyua test || (kyua report --verbose --results-filter=broken,failed; false)
+ MALLOC_CHECK_=3 POSIX_ME_HARDER=1 POSIXLY_CORRECT=1 LDSTATIC=$(LDSTATIC) kyua test || (kyua report --verbose --results-filter=broken,failed; false)
MALLOC_CHECK_=3 POSIX_ME_HARDER=1 POSIXLY_CORRECT=1 $(CRAM) test-cmd/*.t
.PHONY: lint
diff --git a/test-cmd/env b/test-cmd/env
@@ -4,7 +4,7 @@
atf_test_case noargs
noargs_body() {
- [ "${LD_PRELOAD}" = "libsandbox.so" ] && atf_expect_fail "sandbox (gentoo) interferes with the environment"
+ gentoo_sandbox && atf_expect_fail "sandbox (gentoo) interferes with the environment"
atf_check -o "inline:FOO=BAR\n" env -i FOO=BAR ../cmd/env
}
@@ -16,7 +16,7 @@ badarg_body() {
atf_test_case iflag
iflag_body() {
- [ "${LD_PRELOAD}" = "libsandbox.so" ] && atf_expect_fail "sandbox (gentoo) interferes with the environment"
+ gentoo_sandbox && atf_expect_fail "sandbox (gentoo) interferes with the environment"
atf_check -o "inline:FOO=BAR\n" ../cmd/env -i FOO=BAR ../cmd/env
atf_check -o "inline:FOO=BAR\n" ../cmd/env -i FOO=BAR
@@ -26,7 +26,7 @@ iflag_body() {
atf_test_case uflag
uflag_body() {
- [ "${LD_PRELOAD}" = "libsandbox.so" ] && atf_expect_fail "sandbox (gentoo) interferes with the environment"
+ gentoo_sandbox && atf_expect_fail "sandbox (gentoo) interferes with the environment"
atf_check -o "inline:FOO=BAR\n" ../cmd/env -i FOO=BAR BAR=FOO ../cmd/env -u BAR
@@ -35,7 +35,7 @@ uflag_body() {
atf_test_case unsetflag
unsetflag_body() {
- [ "${LD_PRELOAD}" = "libsandbox.so" ] && atf_expect_fail "sandbox (gentoo) interferes with the environment"
+ gentoo_sandbox && atf_expect_fail "sandbox (gentoo) interferes with the environment"
atf_check -o "inline:FOO=BAR\n" ../cmd/env -i FOO=BAR BAR=FOO ../cmd/env --unset=BAR
@@ -62,6 +62,9 @@ false_body() {
atf_init_test_cases() {
cd "$(atf_get_srcdir)" || exit 1
+
+ . ../test_functions.sh
+
atf_add_test_case noargs
atf_add_test_case badarg
atf_add_test_case iflag
diff --git a/test_functions.sh b/test_functions.sh
@@ -10,3 +10,7 @@ has_glibc() {
has_musl() {
command -v ldd && ldd 2>&1 | grep -q musl
}
+
+gentoo_sandbox() {
+ test -z "${LDSTATIC}" -a "${LD_PRELOAD}" = "libsandbox.so"
+}