diff options
author | Charles Brunet <charles.brunet@optelgroup.com> | 2023-04-03 09:46:26 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2023-05-25 13:44:13 -0400 |
commit | e7b9dfac98d30eb4ea5489c10b8dfef3bb8331f4 (patch) | |
tree | c1cba20c81e41f60d564a50ffa13bde7012ace54 /unittests | |
parent | 11521c6db7facf0703a6037948fdcc1f69cd6246 (diff) | |
download | meson-e7b9dfac98d30eb4ea5489c10b8dfef3bb8331f4.zip meson-e7b9dfac98d30eb4ea5489c10b8dfef3bb8331f4.tar.gz meson-e7b9dfac98d30eb4ea5489c10b8dfef3bb8331f4.tar.bz2 |
mtest: wildcard selection
Allow the use of wildcards (e.g. *) to match test names in `meson test`.
Raise an error is given test name does not match any test.
Optimize the search by looping through the list of tests only once.
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/allplatformstests.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py index b04ee2f..6f91857 100644 --- a/unittests/allplatformstests.py +++ b/unittests/allplatformstests.py @@ -818,6 +818,30 @@ class AllPlatformTests(BasePlatformTests): o = self._run(self.mtest_command + ['--list', '--no-rebuild']) self.assertNotIn('Regenerating build files.', o) + def test_unexisting_test_name(self): + testdir = os.path.join(self.unit_test_dir, '4 suite selection') + self.init(testdir) + self.build() + + self.assertRaises(subprocess.CalledProcessError, self._run, self.mtest_command + ['notatest']) + + def test_select_test_using_wildcards(self): + testdir = os.path.join(self.unit_test_dir, '4 suite selection') + self.init(testdir) + self.build() + + o = self._run(self.mtest_command + ['--list', 'mainprj*']) + self.assertIn('mainprj-failing_test', o) + self.assertIn('mainprj-successful_test_no_suite', o) + self.assertNotIn('subprj', o) + + o = self._run(self.mtest_command + ['--list', '*succ*', 'subprjm*:']) + self.assertIn('mainprj-successful_test_no_suite', o) + self.assertIn('subprjmix-failing_test', o) + self.assertIn('subprjmix-successful_test', o) + self.assertIn('subprjsucc-successful_test_no_suite', o) + self.assertNotIn('subprjfail-failing_test', o) + def test_build_by_default(self): testdir = os.path.join(self.common_test_dir, '129 build by default') self.init(testdir) |