]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: Mark tests as skipped if requirements were not satisfied
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 27 Mar 2025 14:53:28 +0000 (15:53 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 28 Mar 2025 10:40:39 +0000 (11:40 +0100)
Instead of not creating the test at all, let's always create test but
simply mark them as skipped as this is more observable than simply not
creating the test at all.

test/integration-tests/integration-test-wrapper.py
test/integration-tests/meson.build

index d0989106854c0d9226ca7a4e71250d2bfc82e1b9..7335611eb7b158af898d5e0fbb0520e4560172ce 100755 (executable)
@@ -365,6 +365,7 @@ def main() -> None:
     parser.add_argument('--coredump-exclude-regex', required=True)
     parser.add_argument('--sanitizer-exclude-regex', required=True)
     parser.add_argument('--rtc', action=argparse.BooleanOptionalAction)
+    parser.add_argument('--skip', action=argparse.BooleanOptionalAction)
     parser.add_argument('mkosi_args', nargs='*')
     args = parser.parse_args()
 
@@ -386,6 +387,10 @@ def main() -> None:
         print(f'TEST_NO_QEMU=1, skipping {args.name}', file=sys.stderr)
         exit(77)
 
+    if args.skip:
+        print(f'meson requirements for test {args.name} were not fulfilled, skipping', file=sys.stderr)
+        exit(77)
+
     for s in os.getenv('TEST_SKIP', '').split():
         if s in args.name:
             print(f'Skipping {args.name} due to TEST_SKIP', file=sys.stderr)
index cdcc1d8dba3a55f7368b8dfada6672c5e56eedf0..3afbeac1e465c8411c6f48923be8ba267e57beec 100644 (file)
@@ -125,6 +125,10 @@ foreach integration_test : integration_tests
                 integration_test_args += ['--rtc']
         endif
 
+        if not integration_test['enabled']
+                integration_test_args += ['--skip']
+        endif
+
         if not mkosi.found()
                 continue
         endif
@@ -153,10 +157,6 @@ foreach integration_test : integration_tests
                 integration_test_env += {'SYSTEMD_INTEGRATION_TESTS': '1'}
         endif
 
-        if not integration_test['enabled']
-                continue
-        endif
-
         # We don't explicitly depend on the "mkosi" target because that means the image is rebuilt on every
         # "ninja -C build". Instead, the mkosi target has to be rebuilt manually before running the
         # integration tests with mkosi.