mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-17 14:18:14 +01:00
test: Record and show the totals for all test runs
With 'ut all' multiple test suites are run. Add a way to collect totals and show them at the end. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
15c39587cf
commit
6d97c98095
@ -27,6 +27,8 @@ struct ut_stats {
|
|||||||
* struct unit_test_state - Entire state of test system
|
* struct unit_test_state - Entire state of test system
|
||||||
*
|
*
|
||||||
* @cur: Statistics for the current run
|
* @cur: Statistics for the current run
|
||||||
|
* @total: Statistics for all test runs
|
||||||
|
* @run_count: Number of times ut_run_list() has been called
|
||||||
* @start: Store the starting mallinfo when doing leak test
|
* @start: Store the starting mallinfo when doing leak test
|
||||||
* @of_live: true to use livetree if available, false to use flattree
|
* @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)
|
* @of_root: Record of the livetree root node (used for setting up tests)
|
||||||
@ -48,6 +50,8 @@ struct ut_stats {
|
|||||||
*/
|
*/
|
||||||
struct unit_test_state {
|
struct unit_test_state {
|
||||||
struct ut_stats cur;
|
struct ut_stats cur;
|
||||||
|
struct ut_stats total;
|
||||||
|
int run_count;
|
||||||
struct mallinfo start;
|
struct mallinfo start;
|
||||||
struct device_node *of_root;
|
struct device_node *of_root;
|
||||||
bool of_live;
|
bool of_live;
|
||||||
|
@ -206,6 +206,7 @@ static int do_ut_all(struct unit_test_state *uts, struct cmd_tbl *cmdtp,
|
|||||||
any_fail = retval;
|
any_fail = retval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ut_report(&uts->total, uts->run_count);
|
||||||
|
|
||||||
return any_fail;
|
return any_fail;
|
||||||
}
|
}
|
||||||
|
@ -694,6 +694,8 @@ int ut_run_list(struct unit_test_state *uts, const char *category,
|
|||||||
bool has_dm_tests = false;
|
bool has_dm_tests = false;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
memset(&uts->cur, '\0', sizeof(struct ut_stats));
|
||||||
|
|
||||||
if (!CONFIG_IS_ENABLED(OF_PLATDATA) &&
|
if (!CONFIG_IS_ENABLED(OF_PLATDATA) &&
|
||||||
ut_list_has_dm_tests(tests, count, prefix, select_name)) {
|
ut_list_has_dm_tests(tests, count, prefix, select_name)) {
|
||||||
has_dm_tests = true;
|
has_dm_tests = true;
|
||||||
@ -734,5 +736,10 @@ int ut_run_list(struct unit_test_state *uts, const char *category,
|
|||||||
if (ret == -ENOENT)
|
if (ret == -ENOENT)
|
||||||
printf("Test '%s' not found\n", select_name);
|
printf("Test '%s' not found\n", select_name);
|
||||||
|
|
||||||
|
uts->total.skip_count += uts->cur.skip_count;
|
||||||
|
uts->total.fail_count += uts->cur.fail_count;
|
||||||
|
uts->total.test_count += uts->cur.test_count;
|
||||||
|
uts->run_count++;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user