From c3b0676470c3eb9e26754f01940a5b379d712d9f Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sat, 1 Nov 2025 09:40:43 +0100 Subject: [PATCH] scripts/unittest: Add total test execution time to summary. Signed-off-by: iabdalkader igned-off-by: iabdalkader --- scripts/unittest/run.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/unittest/run.py b/scripts/unittest/run.py index 4029d7cc1..42daaabbe 100644 --- a/scripts/unittest/run.py +++ b/scripts/unittest/run.py @@ -44,6 +44,8 @@ def main(): if not "temp" in os.listdir(): os.mkdir("temp") # Make a temp directory + total_start_time = time.ticks_ms() + for test in tests: result = "PASSED" path = "/".join((TEST_PATH, test)) @@ -72,14 +74,21 @@ def main(): print_result(test, result, time_ms) gc.collect() + total_time_ms = time.ticks_diff(time.ticks_ms(), total_start_time) + # Print summary total_tests = passed_count + failed_count + skipped_count - print("\n" + "=" * 60) + stats_line = ("Total: %d | Passed: %d | Failed: %d | Skipped: %d | Time: %dms" % + (total_tests, passed_count, failed_count, skipped_count, total_time_ms)) + separator = "=" * len(stats_line) + + print("\n" + separator) print("Total: %d | " % total_tests + COLOR_GREEN + "Passed: %d" % passed_count + COLOR_RESET + " | " + COLOR_RED + "Failed: %d" % failed_count + COLOR_RESET + " | " + - COLOR_YELLOW + "Skipped: %d" % skipped_count + COLOR_RESET) - print("=" * 60) + COLOR_YELLOW + "Skipped: %d" % skipped_count + COLOR_RESET + " | " + + "Time: %dms" % total_time_ms) + print(separator) if failed_count > 0: print(COLOR_RED + "Some tests FAILED." + COLOR_RESET)