diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2024-04-01 12:33:09 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2024-04-03 15:09:15 +0000 |
commit | 88799c6ec7c0293ac689f21f22974bd218f2e275 (patch) | |
tree | 14052dabe477a2bb8e0f73d26f954c9a01c62e24 | |
parent | eb482c708ec9ffe606f0add8e4a9a442897886ef (diff) |
[contrib] validate_failures.py: Add "total" statistic
Add calculation of the total number of tests in the results.
Change-Id: Iffed3b5dca120590f5dacfb6e054dcf3a3c35346
-rwxr-xr-x | contrib/testsuite-management/validate_failures.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/contrib/testsuite-management/validate_failures.py b/contrib/testsuite-management/validate_failures.py index 9b8d0f5..8c30b58 100755 --- a/contrib/testsuite-management/validate_failures.py +++ b/contrib/testsuite-management/validate_failures.py @@ -65,6 +65,8 @@ _INTERESTING_RESULTS = [ 'FAIL', 'UNRESOLVED', 'XPASS', 'ERROR' ] _INTERESTING_RESULTS_REX = re.compile('(%s):\s*(\S+)\s*(.*)' % "|".join(_INTERESTING_RESULTS)) +_VALID_RESULTS_REX = re.compile('([A-Z]+):\s*(\S+)\s*(.*)') + # Formats of .sum file sections _TOOL_LINE_FORMAT = '\t\t=== %s tests ===\n' _EXP_LINE_FORMAT = '\nRunning %s:%s ...\n' @@ -225,11 +227,13 @@ class ResultSet(set): def __init__(self): super().__init__() self.ResetToolExp() - self.testsuites=set() + self.testsuites = set() + self.total = 0 def update(self, other): super().update(other) self.testsuites.update(other.testsuites) + self.total += other.total def ResetToolExp(self): self.current_tool = None @@ -308,6 +312,20 @@ def IsInterestingResult(result_set, line): return interesting_result +def IsValidResult(result_set, line): + """Return True if line is a valid test result.""" + valid_result = bool(_VALID_RESULTS_REX.match(line)) + + # If there's no .exp defined it means that either the results section hasn't + # started yet, or it is already over. + if valid_result and result_set.current_exp is None: + if _OPTIONS.verbosity >= 3: + print(f'WARNING: Result "{line}" found outside sum file boundaries.') + return False + + return valid_result + + def IsToolLine(line): """Return True if line mentions the tool (in DejaGnu terms) for the following tests.""" return bool(_TOOL_LINE_REX.match(line)) @@ -412,6 +430,9 @@ def ParseSummary(sum_fname): print('WARNING: Expected failure "%s" has expired.' % line.strip()) continue result_set.add(result) + result_set.total += 1 + elif IsValidResult(result_set, line): + result_set.total += 1 elif IsExpLine(line): result_set.current_exp = _EXP_LINE_REX.match(line).groups()[0] if _OPTIONS.srcpath_regex and _OPTIONS.srcpath_regex != '': |