diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh index 9f2ec1e8ae5..58f6cd14142 100755 --- a/test/TEST-01-BASIC/test.sh +++ b/test/TEST-01-BASIC/test.sh @@ -3,6 +3,7 @@ set -e TEST_DESCRIPTION="Basic systemd setup" IMAGE_NAME="basic" RUN_IN_UNPRIVILEGED_CONTAINER=${RUN_IN_UNPRIVILEGED_CONTAINER:-yes} +TEST_REQUIRE_INSTALL_TESTS=0 . $TEST_BASE_DIR/test-functions @@ -13,6 +14,10 @@ test_create_image() { ( LOG_LEVEL=5 setup_basic_environment + + # install tests manually so the test is functional even when -Dinstall-tests=false + mkdir -p $initdir/usr/lib/systemd/tests/testdata/units/ + cp -v $(dirname $0)/../units/{testsuite-01,end}.service $initdir/usr/lib/systemd/tests/testdata/units/ ) setup_nspawn_root } diff --git a/test/test-functions b/test/test-functions index bca0588af82..7ae7d74fa8c 100644 --- a/test/test-functions +++ b/test/test-functions @@ -17,6 +17,7 @@ UNIFIED_CGROUP_HIERARCHY="${UNIFIED_CGROUP_HIERARCHY:-default}" 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}" # Decide if we can (and want to) run QEMU with KVM acceleration. # Check if nested KVM is explicitly enabled (TEST_NESTED_KVM). If not, @@ -1933,7 +1934,9 @@ test_create_image() { } test_setup() { - if type -P meson >/dev/null && [[ "$(meson configure $BUILD_DIR | grep install-tests | awk '{ print $2 }')" != "true" ]]; then + if [ ${TEST_REQUIRE_INSTALL_TESTS} -ne 0 ] && \ + type -P meson >/dev/null && \ + [[ "$(meson configure $BUILD_DIR | grep install-tests | awk '{ print $2 }')" != "true" ]]; then dfatal "Needs to be built with -Dinstall-tests=true" exit 1 fi