summaryrefslogtreecommitdiff
path: root/rules/shell/test/summarizer
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-07-12 11:54:12 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-07-12 11:54:12 +0200
commitfac7e7680e00dfc63eec41a33dff86d31571eb4b (patch)
treed341e6569290a21554ea9e5251c756b2b68096e8 /rules/shell/test/summarizer
parent8d715c335756e406aea8a7e3e9e2266f69fbdeb9 (diff)
parent6fc2c2f66740c533d80990659cfce29b7db07eda (diff)
downloadrules-cc-fac7e7680e00dfc63eec41a33dff86d31571eb4b.tar.gz
Merge subtree 'rules' into rules-cc
Diffstat (limited to 'rules/shell/test/summarizer')
-rwxr-xr-xrules/shell/test/summarizer15
1 files changed, 13 insertions, 2 deletions
diff --git a/rules/shell/test/summarizer b/rules/shell/test/summarizer
index 72cd1b9..39b66be 100755
--- a/rules/shell/test/summarizer
+++ b/rules/shell/test/summarizer
@@ -21,6 +21,9 @@ from typing import Any, Dict, List
g_RESULTS: Dict[str, List[Any]] = {}
g_COUNT: float = 0
+PASS_count: float = 0
+PASS_time: float = 0
+
time_start: float = time.time()
time_stop: float = 0
@@ -32,14 +35,19 @@ for attempt in os.listdir("."):
g_RESULTS[result] = g_RESULTS.get(result, []) + [int(attempt)]
try:
with open(os.path.join(attempt, "time-start")) as f:
- time_start = min(time_start, float(f.read().strip()))
+ start = float(f.read().strip())
+ time_start = min(time_start, start)
except:
pass
try:
with open(os.path.join(attempt, "time-stop")) as f:
- time_stop = max(time_start, float(f.read().strip()))
+ stop = float(f.read().strip())
+ time_stop = max(time_start, stop)
except:
pass
+ if (start > 0) and (stop >= start) and result == "PASS":
+ PASS_count += 1
+ PASS_time += stop - start
result: str = "UNKNOWN"
if set(g_RESULTS.keys()) <= set(["PASS", "FAIL"]):
@@ -68,6 +76,9 @@ with open("stdout", "w") as f:
f.write("\nother results: %r\n" % (g_RESULTS, ))
if result == "FLAKY":
f.write("\nFailure rate %5.2f%%\n" % (100.0 * len(failures) / g_COUNT))
+ if PASS_count >= 2:
+ f.write("\nAverage time of a passed test instance: %.1fs\n"
+ % (PASS_time / PASS_count))
with open("stderr", "w") as f:
pass