Define named tuple for component outcomes
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
This commit is contained in:
parent
28ae4648a6
commit
18908ec276
1 changed files with 29 additions and 13 deletions
|
@ -12,9 +12,14 @@ import traceback
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
|
import typing
|
||||||
|
|
||||||
import check_test_cases
|
import check_test_cases
|
||||||
|
|
||||||
|
ComponentOutcomes = typing.NamedTuple('ComponentOutcomes',
|
||||||
|
[('successes', typing.Set[str]),
|
||||||
|
('failures', typing.Set[str])])
|
||||||
|
|
||||||
class Results:
|
class Results:
|
||||||
"""Process analysis results."""
|
"""Process analysis results."""
|
||||||
|
|
||||||
|
@ -65,8 +70,8 @@ def analyze_coverage(results, outcomes, allow_list, full_coverage):
|
||||||
for suite_case in available:
|
for suite_case in available:
|
||||||
hits = 0
|
hits = 0
|
||||||
for comp_outcomes in outcomes.values():
|
for comp_outcomes in outcomes.values():
|
||||||
if suite_case in comp_outcomes["successes"] or \
|
if suite_case in comp_outcomes.successes or \
|
||||||
suite_case in comp_outcomes["failures"]:
|
suite_case in comp_outcomes.failures:
|
||||||
hits += 1
|
hits += 1
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -111,11 +116,11 @@ def analyze_driver_vs_reference(results: Results, outcomes,
|
||||||
results.error("required components are missing: bad outcome file?")
|
results.error("required components are missing: bad outcome file?")
|
||||||
return
|
return
|
||||||
|
|
||||||
if not ref_outcomes['successes']:
|
if not ref_outcomes.successes:
|
||||||
results.error("no passing test in reference component: bad outcome file?")
|
results.error("no passing test in reference component: bad outcome file?")
|
||||||
return
|
return
|
||||||
|
|
||||||
for suite_case in ref_outcomes["successes"]:
|
for suite_case in ref_outcomes.successes:
|
||||||
# suite_case is like "test_suite_foo.bar;Description of test case"
|
# suite_case is like "test_suite_foo.bar;Description of test case"
|
||||||
(full_test_suite, test_string) = suite_case.split(';')
|
(full_test_suite, test_string) = suite_case.split(';')
|
||||||
test_suite = full_test_suite.split('.')[0] # retrieve main part of test suite name
|
test_suite = full_test_suite.split('.')[0] # retrieve main part of test suite name
|
||||||
|
@ -133,9 +138,9 @@ def analyze_driver_vs_reference(results: Results, outcomes,
|
||||||
if name_matches_pattern(test_string, str_or_re):
|
if name_matches_pattern(test_string, str_or_re):
|
||||||
ignored = True
|
ignored = True
|
||||||
|
|
||||||
if not ignored and not suite_case in driver_outcomes['successes']:
|
if not ignored and not suite_case in driver_outcomes.successes:
|
||||||
results.error("PASS -> SKIP/FAIL: {}", suite_case)
|
results.error("PASS -> SKIP/FAIL: {}", suite_case)
|
||||||
if ignored and suite_case in driver_outcomes['successes']:
|
if ignored and suite_case in driver_outcomes.successes:
|
||||||
results.error("uselessly ignored: {}", suite_case)
|
results.error("uselessly ignored: {}", suite_case)
|
||||||
|
|
||||||
def analyze_outcomes(results: Results, outcomes, args):
|
def analyze_outcomes(results: Results, outcomes, args):
|
||||||
|
@ -149,12 +154,23 @@ def read_outcome_file(outcome_file):
|
||||||
An outcome collection is a dictionary presentation of the outcome file:
|
An outcome collection is a dictionary presentation of the outcome file:
|
||||||
```
|
```
|
||||||
outcomes = {
|
outcomes = {
|
||||||
"<component>": {
|
"<component>": ComponentOutcomes,
|
||||||
"successes": frozenset(["<suite_case>", ... ]),
|
|
||||||
"failures": frozenset(["<suite_case>", ...])
|
|
||||||
}
|
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CompoentOutcomes is a named tuple which is defined as:
|
||||||
|
|
||||||
|
ComponentOutcomes(
|
||||||
|
successes = {
|
||||||
|
<suite_case>,
|
||||||
|
...
|
||||||
|
},
|
||||||
|
failures = {
|
||||||
|
<suite_case>,
|
||||||
|
...
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
suite_case = "<suite>;<case>"
|
suite_case = "<suite>;<case>"
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
|
@ -164,11 +180,11 @@ suite_case = "<suite>;<case>"
|
||||||
(_platform, component, suite, case, result, _cause) = line.split(';')
|
(_platform, component, suite, case, result, _cause) = line.split(';')
|
||||||
suite_case = ';'.join([suite, case])
|
suite_case = ';'.join([suite, case])
|
||||||
if component not in outcomes:
|
if component not in outcomes:
|
||||||
outcomes[component] = {"successes":set(), "failures":set()}
|
outcomes[component] = ComponentOutcomes(set(), set())
|
||||||
if result == 'PASS':
|
if result == 'PASS':
|
||||||
outcomes[component]['successes'].add(suite_case)
|
outcomes[component].successes.add(suite_case)
|
||||||
elif result == 'FAIL':
|
elif result == 'FAIL':
|
||||||
outcomes[component]['failures'].add(suite_case)
|
outcomes[component].failures.add(suite_case)
|
||||||
|
|
||||||
return outcomes
|
return outcomes
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue