diff options
| author | Xavier Claessens <xavier.claessens@collabora.com> | 2024-02-27 12:00:08 -0500 |
|---|---|---|
| committer | Xavier Claessens <xclaesse@gmail.com> | 2025-10-23 16:53:21 +0100 |
| commit | 1d12e526c478846d3112087e998349f7b968cf38 (patch) | |
| tree | 2695098f9bcfb690368e0d00d2247273476ba564 | |
| parent | 59a46da49a9653caf589669eefef1b39c7a8bdd8 (diff) | |
| download | meson-1d12e526c478846d3112087e998349f7b968cf38.tar.gz | |
mtest: Display test name in format expected by "meson test" argument
This makes easier to run a single test after running them all. For
example the test "test_accsadubl" in the suite "default" of project
"orc" used to be displayed "orc:default / test_accsadubl". To run that
test specifically the command line is `meson test -C builddir
orc:test_accsadubl --suite default`. To make this more consistent
the test is now displayed as "default - orc:test_accsadubl".
| -rw-r--r-- | mesonbuild/mtest.py | 18 | ||||
| -rw-r--r-- | unittests/allplatformstests.py | 4 |
2 files changed, 13 insertions, 9 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index 337b70747..cdba8a60e 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -2073,14 +2073,18 @@ class TestHarness: return wrap def get_pretty_suite(self, test: TestSerialisation) -> str: - if len(self.suites) > 1 and test.suite: - rv = TestHarness.split_suite_string(test.suite[0])[0] - s = "+".join(TestHarness.split_suite_string(s)[1] for s in test.suite) + assert test.suite, 'Interpreter should ensure there is always at least one suite' + prj = TestHarness.split_suite_string(test.suite[0])[0] + suites: T.List[str] = [] + for i in test.suite: + s = TestHarness.split_suite_string(i)[1] if s: - rv += ":" - return rv + s + " / " + test.name - else: - return test.name + suites.append(s) + name = f'{prj}:{test.name}' + if suites: + s = '+'.join(suites) + name = f'{s} - {name}' + return name def run_tests(self, runners: T.List[SingleTestRunner]) -> None: try: diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py index 023b8c2ad..5e4739ce3 100644 --- a/unittests/allplatformstests.py +++ b/unittests/allplatformstests.py @@ -954,7 +954,7 @@ class AllPlatformTests(BasePlatformTests): self.utime(os.path.join(testdir, 'meson.build')) o = self._run(self.mtest_command + ['--list']) self.assertIn('Regenerating build files', o) - self.assertIn('test_features / xfail', o) + self.assertIn('test_features:xfail', o) o = self._run(self.mtest_command + ['--list']) self.assertNotIn('Regenerating build files', o) # no real targets should have been built @@ -5437,7 +5437,7 @@ class AllPlatformTests(BasePlatformTests): '10/10': [10], }.items(): output = self._run(self.mtest_command + ['--slice=' + arg]) - tests = sorted([ int(x) for x in re.findall(r'\n[ 0-9]+/[0-9]+ test-([0-9]*)', output) ]) + tests = sorted([ int(x) for x in re.findall(r'\n[ 0-9]+/[0-9]+ test_slice:test-([0-9]*)', output) ]) self.assertEqual(tests, expectation) for arg, expectation in {'': 'error: argument --slice: value does not conform to format \'SLICE/NUM_SLICES\'', |
