[PATCH] D159081: [LIT] Print discovered tests and percentages

Madhur Amilkanthwar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 29 03:47:47 PDT 2023


madhur13490 created this revision.
madhur13490 added reviewers: yln, davezarzycki.
Herald added a subscriber: delcypher.
Herald added a project: All.
madhur13490 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch adds "nice-to-have" feature in lit.
it prints the total number of discovered tests at the beginning.
It is covenient to see the total number of tests and avoid
scrolling up to the beginning of log.

Further, this patch also prints %ge of tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159081

Files:
  llvm/utils/lit/lit/main.py


Index: llvm/utils/lit/lit/main.py
===================================================================
--- llvm/utils/lit/lit/main.py
+++ llvm/utils/lit/lit/main.py
@@ -311,6 +311,7 @@
 
 def print_results(tests, elapsed, opts):
     tests_by_code = {code: [] for code in lit.Test.ResultCode.all_codes()}
+    total_tests = len(tests)
     for test in tests:
         tests_by_code[test.result.code].append(test)
 
@@ -321,7 +322,7 @@
             opts.shown_codes,
         )
 
-    print_summary(tests_by_code, opts.quiet, elapsed)
+    print_summary(total_tests, tests_by_code, opts.quiet, elapsed)
 
 
 def print_group(tests, code, shown_codes):
@@ -336,10 +337,11 @@
     sys.stdout.write("\n")
 
 
-def print_summary(tests_by_code, quiet, elapsed):
+def print_summary(total_tests, tests_by_code, quiet, elapsed):
     if not quiet:
         print("\nTesting Time: %.2fs" % elapsed)
 
+    print("\nTotal Discovered Tests: %s" %(total_tests))
     codes = [c for c in lit.Test.ResultCode.all_codes() if not quiet or c.isFailure]
     groups = [(c.label, len(tests_by_code[c])) for c in codes]
     groups = [(label, count) for label, count in groups if count]
@@ -352,4 +354,4 @@
     for (label, count) in groups:
         label = label.ljust(max_label_len)
         count = str(count).rjust(max_count_len)
-        print("  %s: %s" % (label, count))
+        print("  %s: %s (%.2f%%)" % (label, count, float(count) / total_tests * 100))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159081.554250.patch
Type: text/x-patch
Size: 1443 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230829/ab9177b2/attachment.bin>


More information about the llvm-commits mailing list