-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LIT] Print discovered tests and percentages #66057
Conversation
@llvm/pr-subscribers-testing-tools ChangesThis patch adds "nice-to-have" feature in lit. Further, this patch also prints %ge of tests. Differential Revision: https://reviews.llvm.org/D159081Full diff: https://github.com/llvm/llvm-project/pull/66057.diff 1 Files Affected:
diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py index 6858961752a66f1..70230eda48af86f 100755 --- a/llvm/utils/lit/lit/main.py +++ b/llvm/utils/lit/lit/main.py @@ -311,6 +311,7 @@ def print_histogram(tests): 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 @@ def print_results(tests, elapsed, opts): 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 @@ def print_group(tests, code, shown_codes): 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 @@ def print_summary(tests_by_code, quiet, elapsed): 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)) |
1a563b1
to
c7cfd6f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: could you write percentage instead of shortening it to %ge? LGTM otherwise.
Thanks for the nice feature. Please extend lit's test suite to help lit developers avoid breaking it in the future. |
c7cfd6f
to
c2dbebc
Compare
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 percentages of tests. Differential Revision: https://reviews.llvm.org/D159081
c2dbebc
to
a17a89b
Compare
@RoboTux @jdenny-ornl Thanks for taking a look at it. I have addressed the review comments in the latest patch. |
if not quiet: | ||
print("\nTesting Time: %.2fs" % elapsed) | ||
|
||
print("\nTotal Discovered Tests: %s" % (total_tests)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print("\nTotal Discovered Tests: %s" % (total_tests)) | |
print(f"\nTotal Discovered Tests: {total_tests}") |
@@ -351,4 +353,4 @@ def print_summary(tests_by_code, quiet, elapsed): | |||
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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wishlist: this can probably also be converted to a f-string or if not to use .format() while you are at it. Since this pre-existing I don't mind if you leave it untouched.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Will take it in a separate patch.
@jdenny-ornl @RoboTux Can I please get approval on this? Would like to land soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This reverts commit ba8565f.
This reverts commit ba8565f. Co-authored-by: Madhur A <[email protected]>
Hi, I think the following tests need to be updated as well to avoid breakages:
|
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. This patch fixes tests pointed by previous attempt of landing this patch. Reviewed By: RoboTux, jdenny-ornl Co-authored-by: Madhur A <[email protected]>
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. This patch fixes tests pointed by previous attempt of landing this patch. Reviewed By: RoboTux, jdenny-ornl Co-authored-by: Madhur A <[email protected]>
Local branch amd-gfx ee21db2 Merged main:b99f7e695469 into amd-gfx:a485974c4c95 Remote branch main ba8565f [LIT] Print discovered tests and percentages (llvm#66057)
Local branch amd-gfx 950d1a3 Merged main:00c8da615923 into amd-gfx:1a36b82bb390 Remote branch main 0b7ae41 [LIT] Print discovered tests and percentages (llvm#66057) (llvm#69831)
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.
Differential Revision: https://reviews.llvm.org/D159081