Skip to content

Commit

Permalink
Fix project tests category name used in skippable() and XML output
Browse files Browse the repository at this point in the history
Since 25df6e7 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
  • Loading branch information
jon-turney authored and mensinda committed Jun 22, 2021
1 parent 5650c9b commit bee4dc9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions run_project_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ def get_paths(self, compiler: str, env: environment.Environment, installdir: Pat
@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
Expand Down Expand Up @@ -1270,9 +1271,9 @@ def tqdm_print(*args: mlog.TV_Loggable, sep: str = ' ') -> None:
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
Expand Down Expand Up @@ -1323,7 +1324,7 @@ def tqdm_print(*args: mlog.TV_Loggable, sep: str = ' ') -> None:
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})
Expand Down

0 comments on commit bee4dc9

Please sign in to comment.