Skip to content

Commit

Permalink
More verbose output: Report passed tests, tool invocations.
Browse files Browse the repository at this point in the history
When running the test suite interactively, I want to see know what it's
currently doing and what the current state of success is.
This is actually already logged, but with log level debug and we have
no way to make this visible by cmd line options. Rather than introducing
an option '-d|--debug', let's just attach it to '-v|--verbose', as it
does not add all that much output.

Also, when used with '-v', let's also report all passed checks in the
summary.

Signed-off-by: Kurt Garloff <[email protected]>
  • Loading branch information
garloff committed Sep 25, 2024
1 parent 4582aec commit 39e740c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Tests/scs-compliance-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def apply_argv(self, argv):
sys.exit(0)
elif opt[0] == "-v" or opt[0] == "--verbose":
self.verbose = True
logger.setLevel(logging.DEBUG)
elif opt[0] == "--debug":
logging.getLogger().setLevel(logging.DEBUG)
elif opt[0] == "-q" or opt[0] == "--quiet":
Expand Down Expand Up @@ -271,7 +272,7 @@ def run_suite(suite: TestSuite, runner: CheckRunner):
return builder.finalize(permissible_ids=suite.ids)


def print_report(subject: str, suite: TestSuite, targets: dict, results: dict):
def print_report(subject: str, suite: TestSuite, targets: dict, results: dict, verbose=False):
print(f"{subject} {suite.name}:")
for tname, target_spec in targets.items():
failed, missing, passed = suite.select(tname, target_spec).eval_buckets(results)
Expand All @@ -283,7 +284,10 @@ def print_report(subject: str, suite: TestSuite, targets: dict, results: dict):
summary_parts.append(f"{len(missing)} missing")
verdict += f" ({', '.join(summary_parts)})"
print(f"- {tname}: {verdict}")
for offenders, category in ((failed, 'FAILED'), (missing, 'MISSING')):
reportcateg = [(failed, 'FAILED'), (missing, 'MISSING')]
if verbose:
reportcateg.append((passed, 'PASSED'))
for offenders, category in reportcateg:
if category == 'MISSING' and suite.partial:
continue # do not report each missing testcase if a filter was used
if not offenders:
Expand Down Expand Up @@ -363,7 +367,7 @@ def main(argv):
if runner.spamminess:
print("********" * 10) # 80 characters
for version, suite, results in report_data:
print_report(config.subject, suite, version['targets'], results)
print_report(config.subject, suite, version['targets'], results, config.verbose)
if config.output:
version_report = {version['version']: results for version, _, results in report_data}
report = create_report(argv, config, spec, version_report, runner.get_invocations())
Expand Down

0 comments on commit 39e740c

Please sign in to comment.