mirror of
https://github.com/troglobit/finit.git
synced 2026-11-30 21:18:22 +00:00
test: Fix chroot not in PATH
Signed-off-by: Jacques de Laval <jacques@de-laval.se>
This commit is contained in:
1 parent
99ad26236e
commit
7965dbd13f
3 files changed
+7
-3
No files matched your search
+3
-1
@@ -41,7 +41,9 @@ teardown() {
|
|||||||
wait
|
wait
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_DIR=$(dirname "$1")
|
TEST="$1"
|
||||||
|
TEST_DIR=$(dirname "$TEST")
|
||||||
|
shift
|
||||||
|
|
||||||
trap teardown EXIT
|
trap teardown EXIT
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ TEST_DIR=$(dirname "$0")
|
|||||||
TESTS_ROOT="$(pwd)/${TEST_DIR}/test_root"
|
TESTS_ROOT="$(pwd)/${TEST_DIR}/test_root"
|
||||||
|
|
||||||
nsenter=$(which nsenter)
|
nsenter=$(which nsenter)
|
||||||
|
chroot=$(which chroot)
|
||||||
|
|
||||||
export PATH=/sbin:/bin
|
export PATH=/sbin:/bin
|
||||||
"$nsenter" \
|
"$nsenter" \
|
||||||
@@ -25,4 +26,4 @@ export PATH=/sbin:/bin
|
|||||||
--net \
|
--net \
|
||||||
--pid \
|
--pid \
|
||||||
-w -t "$target" \
|
-w -t "$target" \
|
||||||
chroot "$TESTS_ROOT" "$@"
|
"$chroot" "$TESTS_ROOT" "$@"
|
||||||
@@ -8,6 +8,7 @@ TESTS_ROOT="$(pwd)/${TEST_DIR}/test_root"
|
|||||||
>&2 echo "Hint: Execute '${TEST_DIR}/testenv_exec.sh \$(pgrep -P $$) /bin/sh; reset' to enter the test namespace"
|
>&2 echo "Hint: Execute '${TEST_DIR}/testenv_exec.sh \$(pgrep -P $$) /bin/sh; reset' to enter the test namespace"
|
||||||
|
|
||||||
unshare=$(which unshare)
|
unshare=$(which unshare)
|
||||||
|
chroot=$(which chroot)
|
||||||
|
|
||||||
# Not supported by Busybox unshare:
|
# Not supported by Busybox unshare:
|
||||||
# --cgroup --time
|
# --cgroup --time
|
||||||
@@ -18,4 +19,4 @@ exec "$unshare" \
|
|||||||
--mount \
|
--mount \
|
||||||
--mount-proc \
|
--mount-proc \
|
||||||
--uts --ipc --net \
|
--uts --ipc --net \
|
||||||
chroot "$TESTS_ROOT" /bin/chrootsetup.sh "$@"
|
"$chroot" "$TESTS_ROOT" /bin/chrootsetup.sh "$@"
|
||||||
Reference in new issue
Block a user