commit: 67e7c2de053047dee2d2447b1abfa19eb15e152b
parent ef5778ca63bc997f61054f4bffd8b49979c14de7
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Thu, 1 Aug 2024 06:24:34 +0200
test-cmd/env.sh: Skip only the environ tests on sandbox detection
Diffstat:
1 file changed, 24 insertions(+), 25 deletions(-)
diff --git a/test-cmd/env.sh b/test-cmd/env.sh
@@ -2,34 +2,15 @@
# SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
# SPDX-License-Identifier: MPL-2.0
-. "$(dirname "$0")/../test_functions.sh"
-
-if gentoo_sandbox
-then
- echo '1..1'
- echo '# Gentoo sandbox(1) detected, all checks of env(1) skipped due to environ interference'
- exit 0
-fi
-
WD="$(dirname "$0")/../"
target="${WD}/cmd/env"
+
+. "${WD}/test_functions.sh"
+
plans=9
-. "$(dirname "$0")/tap.sh"
+gentoo_sandbox && plans=5
+. "${WD}/test-cmd/tap.sh"
-t reset '-i FOO=BAR' 'FOO=BAR
-'
-t reset_chain "-i FOO=BAR $target" 'FOO=BAR
-'
-t uflag "-i FOOZ=BARZ $target -u FOOZ FOO=BAR" 'FOO=BAR
-'
-if grep -q HAS_GETOPT_LONG "${WD}/config.mk"; then
- t unsetflag "-i FOOZ=BARZ $target --unset=FOOZ FOO=BAR" 'FOO=BAR
-'
-else
- skip unsetflag 'Lacks getopt_long'
-fi
-t posix_me_harder "-i FOO=BAR sh -c echo" '
-'
t exec_true 'true' ''
t exec_echo 'echo' '
'
@@ -37,4 +18,22 @@ t --exit=1 exec_false 'false' ''
t --exit=127 enoent '/var/empty/e/no/ent' 'env: execvp("/var/empty/e/no/ent", ...): No such file or directory
'
-# atf_check -s not-exit:0 -e "inline:env: Error: Unrecognised option: '-f'\nenv [-i] [-u key | --unset=key] [key=value ...] [command [args]]\n" ../cmd/env -f
+t posix_me_harder "-i FOO=BAR sh -c echo" '
+'
+
+if ! gentoo_sandbox
+then
+ t reset '-i FOO=BAR' 'FOO=BAR
+'
+ t reset_chain "-i FOO=BAR $target" 'FOO=BAR
+'
+ t uflag "-i FOOZ=BARZ $target -u FOOZ FOO=BAR" 'FOO=BAR
+'
+ if grep -q HAS_GETOPT_LONG "${WD}/config.mk"; then
+ t unsetflag "-i FOOZ=BARZ $target --unset=FOOZ FOO=BAR" 'FOO=BAR
+'
+ else
+ skip unsetflag 'Lacks getopt_long'
+ fi
+ # atf_check -s not-exit:0 -e "inline:env: Error: Unrecognised option: '-f'\nenv [-i] [-u key | --unset=key] [key=value ...] [command [args]]\n" ../cmd/env -f
+fi