Skip to content

Commit

Permalink
More verbose output: Report passed tests, tool invocations. (#763)
Browse files Browse the repository at this point in the history
* More verbose output: Report passed tests, tool invocations.
  - Also, when used with '-v', let's also report all passed checks in the summary.
  - Set debug log level on second verbose (just like --debug).

Signed-off-by: Kurt Garloff <[email protected]>
  • Loading branch information
garloff authored Oct 4, 2024
1 parent ed85718 commit a76464a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Tests/scs-compliance-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ def apply_argv(self, argv):
usage()
sys.exit(0)
elif opt[0] == "-v" or opt[0] == "--verbose":
if self.verbose:
logger.setLevel(logging.DEBUG)
self.verbose = True
elif opt[0] == "--debug":
logging.getLogger().setLevel(logging.DEBUG)
logger.setLevel(logging.DEBUG)
elif opt[0] == "-q" or opt[0] == "--quiet":
self.quiet = True
logging.getLogger().setLevel(logging.ERROR)
Expand Down Expand Up @@ -271,7 +273,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 +285,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 +368,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 a76464a

Please sign in to comment.