diff options
| author | Simon Glass <sjg@chromium.org> | 2025-02-07 11:30:36 -0700 |
|---|---|---|
| committer | Tom Rini <trini@konsulko.com> | 2025-02-11 20:10:58 -0600 |
| commit | b85df267e1f9f6f53086875975b8e4b24570365d (patch) | |
| tree | 7304d4ff74aecbcc0f913afd8e3c7bd4f3d49842 /test/test-main.c | |
| parent | 5f6a59e03eff0f29295ce12b3807cbac7334e0aa (diff) | |
test: Show the average time per test
Show the average duration of a test, so we can keep track of how it is
trending. Report the suite with the longest average test to encourage
people to improve it.
Add a function to update the stats based on the results from a single
suite and another to show the summary information.
Make this optional, since sandbox's SPL tests do not have a timer driver
and people may want to print results without times.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/test-main.c')
| -rw-r--r-- | test/test-main.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/test-main.c b/test/test-main.c index 1d821a3fe72..597afa25f77 100644 --- a/test/test-main.c +++ b/test/test-main.c @@ -677,12 +677,16 @@ static int ut_run_tests(struct unit_test_state *uts, const char *prefix, void ut_report(struct ut_stats *stats, int run_count) { if (run_count > 1) - printf("Suites run: %d, total tests", run_count); + printf("Total tests"); else printf("Tests"); printf(" run: %d, ", stats->test_count); - if (stats) - printf("%ld ms, ", stats->duration_ms); + if (stats && stats->test_count) { + ulong dur = stats->duration_ms; + + printf("%ld ms, average: %ld ms, ", dur, + dur ? dur / stats->test_count : 0); + } if (stats->skip_count) printf("skipped: %d, ", stats->skip_count); printf("failures: %d\n", stats->fail_count); |
