summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-04-29 14:50:10 +0200
committerDylan Baker <dylan@pnwbakers.com>2025-04-29 10:14:33 -0700
commit53f9d60756ee750e93464f8e1b0944ee2b077976 (patch)
treefa61e1f58c84e883377c6c7ab0c2d852d151ff6d
parentca464824ab481b12afa9d90a3ff290ffcd7c6601 (diff)
downloadmeson-53f9d60756ee750e93464f8e1b0944ee2b077976.tar.gz
unittests: fix overly loose regex in tests for `--slice=` option
The unit tests for the `meson test --slice=` option check that the option is working by extracting all tests that have been run from the command output. This is done with a rather loose regular expression "test-[0-9]*", which can easily match other parts of the output, as well. One user for example reported that the test broke because they were executing tests in a directory called "meson-test-1.8.0-build", and given that the "test-1" part of that directory matches the regular expression we have too many matches. Fix the issue by tightening the regex so that is way less likely to match anything from the host's build environment. Reported-by: Dominique Leuenberger <dleuenberger@suse.com> Signed-off-by: Patrick Steinhardt <ps@pks.im>
-rw-r--r--unittests/allplatformstests.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index 2fee06c69..ea220a065 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -5196,7 +5196,7 @@ class AllPlatformTests(BasePlatformTests):
'10/10': [10],
}.items():
output = self._run(self.mtest_command + ['--slice=' + arg])
- tests = sorted([ int(x[5:]) for x in re.findall(r'test-[0-9]*', output) ])
+ tests = sorted([ int(x) for x in re.findall(r'\n[ 0-9]+/[0-9]+ test-([0-9]*)', output) ])
self.assertEqual(tests, expectation)
for arg, expectation in {'': 'error: argument --slice: value does not conform to format \'SLICE/NUM_SLICES\'',