From 70997ca969dab0de7a800af7f7c7d6c7e25cf4ac Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 1 May 2019 10:04:50 +1000 Subject: mtest: check for an empty suite list For consistency, it can be useful to have an explicit empty test suite list for a test: test('test-name', binary, suite: []) This currently passes meson but fails when running meson tests: Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/mesonbuild/mesonmain.py", line 122, in run return options.run_func(options) File "/usr/lib/python3.7/site-packages/mesonbuild/mtest.py", line 1005, in run return th.doit() File "/usr/lib/python3.7/site-packages/mesonbuild/mtest.py", line 756, in doit self.run_tests(tests) File "/usr/lib/python3.7/site-packages/mesonbuild/mtest.py", line 896, in run_tests visible_name = self.get_pretty_suite(test) File "/usr/lib/python3.7/site-packages/mesonbuild/mtest.py", line 875, in get_pretty_suite rv = TestHarness.split_suite_string(test.suite[0])[0] IndexError: list index out of range Fix it by simply checking for the test suite to be a valid list we can pass on Fixes #5340 Signed-off-by: Peter Hutterer --- mesonbuild/mtest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mesonbuild/mtest.py') diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index 17af4df..8df8f48 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -873,7 +873,7 @@ Timeout: %4d return wrap def get_pretty_suite(self, test): - if len(self.suites) > 1: + 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) if len(s): -- cgit v1.1