Move collect_available_test_cases to check_test_cases.py
No behavior change. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
5eb2b02862
commit
686c292e8a
2 changed files with 21 additions and 22 deletions
|
@ -7,7 +7,6 @@ less likely to be useful.
|
|||
"""
|
||||
|
||||
import argparse
|
||||
import re
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
|
@ -51,29 +50,9 @@ class TestCaseOutcomes:
|
|||
"""
|
||||
return len(self.successes) + len(self.failures)
|
||||
|
||||
class TestDescriptions(check_test_cases.TestDescriptionExplorer):
|
||||
"""Collect the available test cases."""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.descriptions = set()
|
||||
|
||||
def process_test_case(self, _per_file_state,
|
||||
file_name, _line_number, description):
|
||||
"""Record an available test case."""
|
||||
base_name = re.sub(r'\.[^.]*$', '', re.sub(r'.*/', '', file_name))
|
||||
key = ';'.join([base_name, description.decode('utf-8')])
|
||||
self.descriptions.add(key)
|
||||
|
||||
def collect_available_test_cases():
|
||||
"""Collect the available test cases."""
|
||||
explorer = TestDescriptions()
|
||||
explorer.walk_all()
|
||||
return sorted(explorer.descriptions)
|
||||
|
||||
def analyze_coverage(results, outcomes):
|
||||
"""Check that all available test cases are executed at least once."""
|
||||
available = collect_available_test_cases()
|
||||
available = check_test_cases.collect_available_test_cases()
|
||||
for key in available:
|
||||
hits = outcomes[key].hits() if key in outcomes else 0
|
||||
if hits == 0:
|
||||
|
|
|
@ -137,6 +137,26 @@ state may override this method.
|
|||
'*.sh')):
|
||||
self.walk_ssl_opt_sh(ssl_opt_file_name)
|
||||
|
||||
class TestDescriptions(TestDescriptionExplorer):
|
||||
"""Collect the available test cases."""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.descriptions = set()
|
||||
|
||||
def process_test_case(self, _per_file_state,
|
||||
file_name, _line_number, description):
|
||||
"""Record an available test case."""
|
||||
base_name = re.sub(r'\.[^.]*$', '', re.sub(r'.*/', '', file_name))
|
||||
key = ';'.join([base_name, description.decode('utf-8')])
|
||||
self.descriptions.add(key)
|
||||
|
||||
def collect_available_test_cases():
|
||||
"""Collect the available test cases."""
|
||||
explorer = TestDescriptions()
|
||||
explorer.walk_all()
|
||||
return sorted(explorer.descriptions)
|
||||
|
||||
class DescriptionChecker(TestDescriptionExplorer):
|
||||
"""Check all test case descriptions.
|
||||
|
||||
|
|
Loading…
Reference in a new issue