]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: Add infra to mark integration tests as slow
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 7 May 2024 13:20:44 +0000 (15:20 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 7 May 2024 17:06:42 +0000 (19:06 +0200)
Some integration tests take much more time than others, let's add
a test param that can be used to configure this and integrate it
with the slow-tests meson option.

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

index fcdc9b6352f745dd90568baab50b304459404ee0..c41ca8e55a0b637c2ae09422a99771daf1d96763 100755 (executable)
@@ -39,10 +39,6 @@ ExecStart=false
 
 
 def main():
-    if not bool(int(os.getenv("SYSTEMD_INTEGRATION_TESTS", "0"))):
-        print("SYSTEMD_INTEGRATION_TESTS=1 not found in environment, skipping", file=sys.stderr)
-        exit(77)
-
     parser = argparse.ArgumentParser(description=__doc__)
     parser.add_argument('--meson-source-dir', required=True, type=Path)
     parser.add_argument('--meson-build-dir', required=True, type=Path)
@@ -50,9 +46,18 @@ def main():
     parser.add_argument('--test-number', required=True)
     parser.add_argument('--storage', required=True)
     parser.add_argument('--firmware', required=True)
+    parser.add_argument('--slow', action=argparse.BooleanOptionalAction)
     parser.add_argument('mkosi_args', nargs="*")
     args = parser.parse_args()
 
+    if not bool(int(os.getenv("SYSTEMD_INTEGRATION_TESTS", "0"))):
+        print(f"SYSTEMD_INTEGRATION_TESTS=1 not found in environment, skipping {args.test_name}", file=sys.stderr)
+        exit(77)
+
+    if args.slow and not bool(int(os.getenv("SYSTEMD_SLOW_TESTS", "0"))):
+        print(f"SYSTEMD_SLOW_TESTS=1 not found in environment, skipping {args.test_name}", file=sys.stderr)
+        exit(77)
+
     name = args.test_name + (f"-{i}" if (i := os.getenv("MESON_TEST_ITERATION")) else "")
     test_unit = f"testsuite-{args.test_number}.service"
 
index 63b94b1c7a17ad2573c6d54e8facef6ca23243b4..30a0461f0d9876a36e06eaaf8011af5a3d611744 100644 (file)
@@ -416,6 +416,7 @@ foreach test_number, dirname : integration_tests
                 'storage' : 'volatile',
                 'priority' : 0,
                 'firmware' : 'linux',
+                'slow' : false,
         }
 
         # TODO: This fs.exists call isn't included in rebuild logic
@@ -432,13 +433,22 @@ foreach test_number, dirname : integration_tests
                 '--test-number', test_number,
                 '--storage', test_params['storage'],
                 '--firmware', test_params['firmware'],
-                '--',
-        ] + test_params['mkosi_args']
+        ]
+
+        if test_params['slow']
+                args += ['--slow']
+        endif
+
+        args += ['--'] + test_params['mkosi_args']
 
         integration_test_env = {}
 
         if want_integration_tests
-                integration_test_env = {'SYSTEMD_INTEGRATION_TESTS': '1'}
+                integration_test_env += {'SYSTEMD_INTEGRATION_TESTS': '1'}
+        endif
+
+        if want_slow_tests
+                integration_test_env += {'SYSTEMD_SLOW_TESTS': '1'}
         endif
 
         # We don't explicitly depend on the "mkosi" target because that means the image is rebuilt