From 7a57256c7355e187adbd5f5bc37e529a0a0715c3 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Sun, 17 May 2020 10:48:16 +0200 Subject: [PATCH] test: introduce TEST_PARALLELIZE to support running tests in parallel 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 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/test-functions b/test/test-functions index 0df8896fd6d..f5a798b4b83 100644 --- a/test/test-functions +++ b/test/test-functions @@ -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 -- 2.47.3