test: Only mess with PATH inside test environment

This commit is contained in:
Jacques de Laval
2021-02-24 23:28:47 +01:00
parent 3ebac3dece
commit 70964ccb35
4 changed files with 11 additions and 2 deletions
+2 -2
View File
@@ -14,12 +14,12 @@ if [ ! -f "$srcdir"/../config.status ]; then
cp "${srcdir}/test-root/Makefile" test-root/
make -C test-root/
config_h='./config.h'
echo "export PATH=/bin:/sbin" > test.env
echo "export TESTENV_PATH=/bin:/sbin" > test.env
else
make -C ../ DESTDIR="$(pwd)/test-root/" install
FINITBIN=../../src/finit make -C test-root/
config_h='../config.h'
echo "export PATH=/bin:/sbin:$PREFIX/sbin:$PREFIX/bin" > test.env
echo "export TESTENV_PATH=/bin:/sbin:$PREFIX/sbin:$PREFIX/bin" > test.env
fi
echo "export FINIT_CONF=$(grep FINIT_CONF $config_h | cut -d' ' -f3 | cut -d'"' -f2)" >> test.env
+3
View File
@@ -20,4 +20,7 @@ else
exit 1
fi
PATH="$TESTENV_PATH"
export PATH
"$(dirname "$0")"/testenv_exec.sh "$target" "$cmd" "$@"
+3
View File
@@ -21,6 +21,9 @@ export PS2='> '
export PS3='#? '
export PS4='+ '
PATH="$TESTENV_PATH"
export PATH
"$nsenter" \
--preserve-credentials \
--user \
+3
View File
@@ -13,6 +13,9 @@ export PS2='> '
export PS3='#? '
export PS4='+ '
PATH="$TESTENV_PATH"
export PATH
# Not supported by Busybox unshare:
# --cgroup --time
exec "$unshare" \