]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: perform partial cleanup after each test is run
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 20 Mar 2020 18:09:35 +0000 (19:09 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 28 Mar 2020 10:51:29 +0000 (11:51 +0100)
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).

test/run-integration-tests.sh
test/test-functions

index 19b5fe03158063342583910f76532abbf8016058..bcbbb8b7ed42ecbf6c3a8eb6f4278cd150064756 100755 (executable)
@@ -6,7 +6,7 @@ if [ $# -gt 0 ]; then
     args="$@"
     do_clean=0
 else
-    args="setup run"
+    args="setup run clean-again"
     do_clean=1
 fi
 
index d1595fcd605ba048c0fd3dfb6aaa1fd302e85d94..732e25a8b27044e5ddb073fc1c88ace4b1bddfcb 100644 (file)
@@ -1104,6 +1104,8 @@ setup_nspawn_root() {
         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
@@ -1936,6 +1938,12 @@ test_cleanup() {
     _test_cleanup
 }
 
+test_cleanup_again() {
+    [ -n "$TESTDIR" ] || return
+    rm -rf "$TESTDIR/unprivileged-nspawn-root"
+    umount_initdir
+}
+
 test_create_image() {
     create_empty_image_rootdir
 
@@ -2039,10 +2047,14 @@ do_test() {
                 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 "