]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: Assign tests a suite based on their directory
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 3 Jul 2022 11:44:05 +0000 (13:44 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 4 Jul 2022 12:46:30 +0000 (14:46 +0200)
This can be used to run only a subset of tests, e.g.
"meson test -C build --suite journal" to run only the journal
unit tests.

meson.build

index 25bcfdba1b232f6a9c18a260ed1b87789a3edfb6..54f4b8f4aaa7975b5284085fa56bd74b99500442 100644 (file)
@@ -3794,6 +3794,10 @@ foreach tuple : tests
                 type = ''
         endif
 
+        suite = fs.name(fs.parent('@0@'.format(sources[0])))
+        # FIXME: Use str.replace() with meson >= 0.58.0
+        suite = suite.split('sd-')[-1]
+
         if condition == '' or conf.get(condition) == 1
                 exe = executable(
                         name,
@@ -3816,7 +3820,8 @@ foreach tuple : tests
                 elif want_tests != 'false'
                         test(name, exe,
                              env : test_env,
-                             timeout : timeout)
+                             timeout : timeout,
+                             suite : suite)
                 endif
         else
                 message('Not compiling @0@ because @1@ is not true'.format(name, condition))