]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: introduce TEST_PARALLELIZE to support running tests in parallel 15433/head
authorFrantisek Sumsal <frantisek@sumsal.cz>
Sun, 17 May 2020 08:48:16 +0000 (10:48 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Sun, 17 May 2020 08:48:16 +0000 (10:48 +0200)
Support running tests in parallel by switching to copying of the
base image instead of symlinking it..

This still requires some setup steps, like running `make setup` on tests
which have unique $IMAGE_NAME beforehand (and sequentially), otherwise
they'll all try to create the same base image when started in parallel,
leading to nasty issues. However, as running the integration tests in
parallel is such an unusual use case it should be good enough, for now.

test/test-functions

index 0df8896fd6d95d1baabb7bed9bcd84a7f6029482..f5a798b4b83cad560a216069873dfa8961cbe979 100644 (file)
@@ -18,6 +18,7 @@ EFI_MOUNT="${EFI_MOUNT:-$(bootctl -x 2>/dev/null || echo /boot)}"
 QEMU_MEM="${QEMU_MEM:-512M}"
 IMAGE_NAME=${IMAGE_NAME:-default}
 TEST_REQUIRE_INSTALL_TESTS="${TEST_REQUIRE_INSTALL_TESTS:-1}"
+TEST_PARALLELIZE="${TEST_PARALLELIZE:-0}"
 LOOPDEV=
 
 # Decide if we can (and want to) run QEMU with KVM acceleration.
@@ -2006,7 +2007,11 @@ test_setup() {
         mount_initdir
     elif [ -e "$IMAGE_PUBLIC" ]; then
         echo "Reusing existing cached image $IMAGE_PUBLIC → $(realpath $IMAGE_PUBLIC)"
-        ln -s "$(realpath $IMAGE_PUBLIC)" "$IMAGE_PRIVATE"
+        if [ ${TEST_PARALLELIZE} -ne 0 ]; then
+            cp -v "$(realpath $IMAGE_PUBLIC)" "$IMAGE_PRIVATE"
+        else
+            ln -sv "$(realpath $IMAGE_PUBLIC)" "$IMAGE_PRIVATE"
+        fi
         mount_initdir
     else
         test_create_image