From: Yu Watanabe Date: Tue, 22 Oct 2024 06:32:12 +0000 (+0900) Subject: TEST-02-UNITTESTS: reuse $TEST_MATCH_SUBTEST to specify unit tests to be run X-Git-Tag: v257-rc1~149^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F27916%2Fhead;p=thirdparty%2Fsystemd.git TEST-02-UNITTESTS: reuse $TEST_MATCH_SUBTEST to specify unit tests to be run Then, we can easily test specific unit tests in qemu or container. --- diff --git a/test/units/TEST-02-UNITTESTS.sh b/test/units/TEST-02-UNITTESTS.sh index 4448643f9a2..0aced75c67a 100755 --- a/test/units/TEST-02-UNITTESTS.sh +++ b/test/units/TEST-02-UNITTESTS.sh @@ -9,13 +9,15 @@ if ! systemd-detect-virt -qc && [[ "${TEST_CMDLINE_NEWLINE:-}" != bar ]]; then exit 1 fi -# If we're running with TEST_PREFER_NSPAWN=1 limit the set of tests we run -# in QEMU to only those that can't run in a container to avoid running -# the same tests again in a, most likely, very slow environment -if ! systemd-detect-virt -qc && [[ "${TEST_PREFER_NSPAWN:-0}" -ne 0 ]]; then - TESTS_GLOB="test-loop-block" -else - TESTS_GLOB=${TESTS_GLOB:-test-*} +if [[ -z "${TEST_MATCH_SUBTEST:-}" ]]; then + # If we're running with TEST_PREFER_NSPAWN=1 limit the set of tests we run + # in QEMU to only those that can't run in a container to avoid running + # the same tests again in a, most likely, very slow environment + if ! systemd-detect-virt -qc && [[ "${TEST_PREFER_NSPAWN:-0}" -ne 0 ]]; then + TEST_MATCH_SUBTEST="test-loop-block" + else + TEST_MATCH_SUBTEST="test-*" + fi fi NPROC=$(nproc) @@ -92,7 +94,7 @@ run_test() { export -f run_test -find /usr/lib/systemd/tests/unit-tests/ -maxdepth 1 -type f -name "${TESTS_GLOB}" -print0 | +find /usr/lib/systemd/tests/unit-tests/ -maxdepth 1 -type f -name "${TEST_MATCH_SUBTEST}" -print0 | xargs -0 -I {} --max-procs="$MAX_QUEUE_SIZE" bash -ec "run_test {}" # Write all pending messages, so they don't get mixed with the summaries below