diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2021-06-20 17:45:56 +0100 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2021-06-22 16:23:09 +0200 |
commit | bee4dc9f78ad6f6d81df34816d28c06520e972a1 (patch) | |
tree | d7113e5306edfcff9d772b363a107fb48d81256f | |
parent | 5650c9b76986e33982a4089d3e37de439934adf7 (diff) | |
download | meson-bee4dc9f78ad6f6d81df34816d28c06520e972a1.zip meson-bee4dc9f78ad6f6d81df34816d28c06520e972a1.tar.gz meson-bee4dc9f78ad6f6d81df34816d28c06520e972a1.tar.bz2 |
Fix project tests category name used in skippable() and XML output
Since 25df6e7d split the iteration over tests to start them from the
iteration to collect their results, the variable 'name' is only being
set in the first iteratiorn, so all tests are treated as being in the
last test category read (probably 'wasm') for skipppable() and in the
XML output.
Store the category name in the TestDef object
Use it in skippable()
Use it in classname attribute of XML test results
-rwxr-xr-x | run_project_tests.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/run_project_tests.py b/run_project_tests.py index 2e9992a..3522009 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -224,6 +224,7 @@ class InstalledFile: @functools.total_ordering class TestDef: def __init__(self, path: Path, name: T.Optional[str], args: T.List[str], skip: bool = False): + self.category = path.parts[1] self.path = path self.name = name self.args = args @@ -1270,9 +1271,9 @@ def _run_tests(all_tests: T.List[T.Tuple[str, T.List[TestDef], bool]], continue # Handle skipped tests - if (result is None) or (('MESON_SKIP_TEST' in result.stdo) and (skippable(name, t.path.as_posix()))): + if (result is None) or (('MESON_SKIP_TEST' in result.stdo) and (skippable(t.category, t.path.as_posix()))): f.update_log(TestStatus.SKIP) - current_test = ET.SubElement(current_suite, 'testcase', {'name': testname, 'classname': name}) + current_test = ET.SubElement(current_suite, 'testcase', {'name': testname, 'classname': t.category}) ET.SubElement(current_test, 'skipped', {}) skipped_tests += 1 continue @@ -1323,7 +1324,7 @@ def _run_tests(all_tests: T.List[T.Tuple[str, T.List[TestDef], bool]], current_test = ET.SubElement( current_suite, 'testcase', - {'name': testname, 'classname': name, 'time': '%.3f' % total_time} + {'name': testname, 'classname': t.category, 'time': '%.3f' % total_time} ) if result.msg != '': ET.SubElement(current_test, 'failure', {'message': result.msg}) |