]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: correctly clean up test artifacts
authorFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 21 Apr 2020 11:18:36 +0000 (13:18 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 22 Apr 2020 06:57:38 +0000 (08:57 +0200)
Remove the artifact files indicating test result (testok, failed, and
skipped) just before running the test so we always get the latest and
most relevant result instead of incorrectly consuming previous results.

Discovered in https://github.com/systemd/systemd/pull/15378#issuecomment-616801873

test/test-functions

index d468efb0b7bb712c428f635bae8b582aa74a4b01..8389623c20c97f1da16aac4ab21dbe1ae0af7a51 100644 (file)
@@ -234,6 +234,7 @@ run_qemu() {
 
     CONSOLE=ttyS0
 
+    rm -f "$initdir"/{testok,failed,skipped}
     # make sure the initdir is not mounted to avoid concurrent access
     cleanup_initdir
     umount_loopback
@@ -362,6 +363,7 @@ $QEMU_OPTIONS \
 # success), or 1 if nspawn is not available.
 run_nspawn() {
     [[ -d /run/systemd/system ]] || return 1
+    rm -f "$initdir"/{testok,failed,skipped}
 
     local _nspawn_cmd=(
         --register=no
@@ -2014,7 +2016,6 @@ test_setup() {
 
 test_run() {
     mount_initdir
-    rm -f "$initdir"/{testok,failed,skipped}
 
     if [ -z "$TEST_NO_QEMU" ]; then
         if run_qemu "$1"; then