diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-03-05 11:51:28 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-03-05 11:52:54 +0100 |
commit | 051d662d05b67685f9496c3a3190fc7549b42dd7 (patch) | |
tree | 7baf53aa6f6a8e6703f60e673570d8e5bbd809f4 /rules | |
parent | 444fc1fb49bde80244420dcd58e5fc26ea430fbd (diff) | |
download | justbuild-051d662d05b67685f9496c3a3190fc7549b42dd7.tar.gz |
test summarizer: in case of FLAKY tests, also report failure rate
Diffstat (limited to 'rules')
-rwxr-xr-x | rules/shell/test/summarizer | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/rules/shell/test/summarizer b/rules/shell/test/summarizer index 5fb03110..72cd1b94 100755 --- a/rules/shell/test/summarizer +++ b/rules/shell/test/summarizer @@ -19,12 +19,14 @@ import time from typing import Any, Dict, List g_RESULTS: Dict[str, List[Any]] = {} +g_COUNT: float = 0 time_start: float = time.time() time_stop: float = 0 for attempt in os.listdir("."): if os.path.isdir(attempt): + g_COUNT += 1 with open(os.path.join(attempt, "result")) as f: result = f.read().strip() g_RESULTS[result] = g_RESULTS.get(result, []) + [int(attempt)] @@ -58,11 +60,14 @@ with open("time-stop", "w") as f: with open("stdout", "w") as f: f.write("Summary: %s\n\n" % (result, )) f.write("PASS: %s\n" % (sorted(g_RESULTS.get("PASS", [])), )) - f.write("FAIL: %s\n" % (sorted(g_RESULTS.get("FAIL", [])), )) + failures =sorted(g_RESULTS.get("FAIL", [])) + f.write("FAIL: %s\n" % (failures, )) g_RESULTS.pop("PASS", None) g_RESULTS.pop("FAIL", None) if g_RESULTS: f.write("\nother results: %r\n" % (g_RESULTS, )) + if result == "FLAKY": + f.write("\nFailure rate %5.2f%%\n" % (100.0 * len(failures) / g_COUNT)) with open("stderr", "w") as f: pass |