This causes the unprivileged-nspawn-root directory to be removed
after running one test. The advantage is that we reduce the maximum
disk-space use quite a bit (47*400 MB → about 18GB).
args="$@"
do_clean=0
else
- args="setup run"
+ args="setup run clean-again"
do_clean=1
fi
exit 1
fi
+ rm -rf "$TESTDIR/unprivileged-nspawn-root"
+
if [[ "$RUN_IN_UNPRIVILEGED_CONTAINER" = "yes" ]]; then
ddebug "cp -ar $initdir $TESTDIR/unprivileged-nspawn-root"
cp -ar $initdir $TESTDIR/unprivileged-nspawn-root
_test_cleanup
}
+test_cleanup_again() {
+ [ -n "$TESTDIR" ] || return
+ rm -rf "$TESTDIR/unprivileged-nspawn-root"
+ umount_initdir
+}
+
test_create_image() {
create_empty_image_rootdir
test_setup
test_setup_cleanup
;;
- --clean|--clean-again)
+ --clean)
echo "TEST CLEANUP: $TEST_DESCRIPTION"
test_cleanup
;;
+ --clean-again)
+ echo "TEST CLEANUP AGAIN: $TEST_DESCRIPTION"
+ test_cleanup_again
+ ;;
--all)
ret=0
echo -n "TEST: $TEST_DESCRIPTION "