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>
This commit is contained in:
Simon Glass
2025-02-07 11:30:36 -07:00
parent a36b12022e
commit 835ede55fd
3 changed files with 43 additions and 3 deletions

View File

@@ -33,6 +33,8 @@ struct ut_stats {
* @cur: Statistics for the current run
* @total: Statistics for all test runs
* @run_count: Number of times ut_run_list() has been called
* @worst: Sute which had the first per-text run time
* @worst_ms: Time taken by that test
* @start: Store the starting mallinfo when doing leak test
* @of_live: true to use livetree if available, false to use flattree
* @of_root: Record of the livetree root node (used for setting up tests)
@@ -56,6 +58,8 @@ struct unit_test_state {
struct ut_stats cur;
struct ut_stats total;
int run_count;
const struct suite *worst;
int worst_ms;
struct mallinfo start;
struct device_node *of_root;
bool of_live;