Files
finit/test/testenv_start.sh
T
Magnus Malm 3d01728d2e test: Add testenv_enter.sh to ease debugging testenv
The script testenv_enter.sh, by default, runs /bin/sh in the environment
currently setup.

A bit easier than copy pasting the old hint text printed before test run.

Signed-off-by: Magnus Malm <magnusmalm@gmail.com>
2021-02-23 11:19:57 +01:00

28 lines
562 B
Bash
Executable File

#!/bin/sh
set -eu
TEST_DIR=$(dirname "$0")
TESTS_ROOT="$(pwd)/${TEST_DIR}/test_root"
>&2 echo "Hint: Execute 'test/testenv_enter.sh' to enter the test namespace"
unshare=$(command -v unshare)
chroot=$(command -v chroot)
export PATH=/sbin:/bin
export PS1='\w \$ '
export PS2='> '
export PS3='#? '
export PS4='+ '
# Not supported by Busybox unshare:
# --cgroup --time
exec "$unshare" \
--user --map-root-user \
--fork --pid --mount-proc \
--mount \
--mount-proc \
--uts --ipc --net \
"$chroot" "$TESTS_ROOT" /bin/chrootsetup.sh "$@"