diff options
| author | Simon Glass <sjg@chromium.org> | 2025-01-20 14:26:00 -0700 |
|---|---|---|
| committer | Tom Rini <trini@konsulko.com> | 2025-01-24 14:34:41 -0600 |
| commit | 561320beffd10d133a316aacaf3170387324bdae (patch) | |
| tree | 93d839d4a85ce4b77800d761e26bf8b690cdc8fe | |
| parent | 0925659a5226ee70dab8b4d3e9c8aba9ec586548 (diff) | |
test: Keep a track of the numbers of tests run
This is useful information and is not always the same as the 'count' arg
to ut_run_list() so add it as a separate stat.
Signed-off-by: Simon Glass <sjg@chromium.org>
| -rw-r--r-- | include/test/test.h | 3 | ||||
| -rw-r--r-- | test/test-main.c | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/include/test/test.h b/include/test/test.h index bc8f0bbe501..f7087ab4eea 100644 --- a/include/test/test.h +++ b/include/test/test.h @@ -14,10 +14,13 @@ * * @fail_count: Number of tests that failed * @skip_count: Number of tests that were skipped + * @test_count: Number of tests run. If a test is run muiltiple times, only one + * is counted */ struct ut_stats { int fail_count; int skip_count; + int test_count; }; /* diff --git a/test/test-main.c b/test/test-main.c index e8aecd267c7..e36bc37d29e 100644 --- a/test/test-main.c +++ b/test/test-main.c @@ -643,6 +643,7 @@ static int ut_run_tests(struct unit_test_state *uts, const char *prefix, } old_fail_count = uts->cur.fail_count; + uts->cur.test_count++; if (one && upto == pos) { ret = ut_run_test_live_flat(uts, one); if (uts->cur.fail_count != old_fail_count) { @@ -717,6 +718,7 @@ int ut_run_list(struct unit_test_state *uts, const char *category, if (has_dm_tests) dm_test_restore(uts->of_root); + printf("Tests run: %d, ", uts->cur.test_count); if (uts->cur.skip_count) printf("Skipped: %d, ", uts->cur.skip_count); if (ret == -ENOENT) |
