diff options
| author | Wladimir J. van der Laan <[email protected]> | 2018-03-28 16:00:24 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2018-03-28 16:00:33 +0200 |
| commit | 0d8fc8de076d1447df63f4d348a19732f5a0d31e (patch) | |
| tree | 6f7cd147e401a1344c8e0c6009594c0bbf950e6c | |
| parent | Merge #12798: doc: Refer to witness reserved value as spec. in the BIP (diff) | |
| parent | test: List any failed tests at the end of test_runner output (diff) | |
| download | discoin-0d8fc8de076d1447df63f4d348a19732f5a0d31e.tar.xz discoin-0d8fc8de076d1447df63f4d348a19732f5a0d31e.zip | |
Merge #12811: test: Make summary row bold-red if any test failed and show failed tests at end of table
ffb033a test: List any failed tests at the end of test_runner output (Anthony Towns)
f92541f test: Make summary row bold-red if any test failed (Wladimir J. van der Laan)
Pull request description:
Make the summary row of the test runner bold red if *any* test fails. This helps visibility if something fails.
(yesteryday I had a snafu where I missed that `feature_blocksdir.py` had failed because it's one of the earlier tests in the list, this intends to avoid that in the future)
Before:

After:

If tests pass it still looks the same:

Tree-SHA512: 057748c693ca1c80840e4e4cdea8aa1baf8996f03d6805975d8e3c07c4ba0087cd8fa83f891d6bf1af0bfbba88b5d46bd5d852df340d755202bd32ae6f1034b5
| -rwxr-xr-x | test/functional/test_runner.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index 29ec535ca..39f1180a4 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -367,7 +367,7 @@ def run_tests(test_list, src_dir, build_dir, exeext, tmpdir, jobs=1, enable_cove def print_results(test_results, max_len_name, runtime): results = "\n" + BOLD[1] + "%s | %s | %s\n\n" % ("TEST".ljust(max_len_name), "STATUS ", "DURATION") + BOLD[0] - test_results.sort(key=lambda result: result.name.lower()) + test_results.sort(key=TestResult.sort_key) all_passed = True time_sum = 0 @@ -378,7 +378,11 @@ def print_results(test_results, max_len_name, runtime): results += str(test_result) status = TICK + "Passed" if all_passed else CROSS + "Failed" + if not all_passed: + results += RED[1] results += BOLD[1] + "\n%s | %s | %s s (accumulated) \n" % ("ALL".ljust(max_len_name), status.ljust(9), time_sum) + BOLD[0] + if not all_passed: + results += RED[0] results += "Runtime: %s s\n" % (runtime) print(results) @@ -455,6 +459,14 @@ class TestResult(): self.time = time self.padding = 0 + def sort_key(self): + if self.status == "Passed": + return 0, self.name.lower() + elif self.status == "Failed": + return 2, self.name.lower() + elif self.status == "Skipped": + return 1, self.name.lower() + def __repr__(self): if self.status == "Passed": color = BLUE |