test: Improvements to ut command and test-suite running
cover test: Improvements to ut command and test-suite running
The current method of running unit tests relies on subcommands of the ut command. Only the code in each subcommand knows how to find the tests related to that subcomand.
This is not ideal and we now have quite a few subcommands which do nothing but locate the relevant tests in a linker list, then call a common function to run them.
This series adds a list of test suites, so that these subcommands can be removed.
An issue with 'ut all' is that it doesn't record how many tests failed overall, so it is necessary to examine copious amounts of output to look for failures. This series adds a new 'total' feature allow recording the total number of failed tests.
To help with 'ut all' a new pytest is created which runs it (as well as 'ut info') and makes sure that all is well. Due to the 'ut all' failures this does not pass, so the test is disabled for now. It is here because it provides security against misnaming a test suite and causing it not to run.
Future work may:
- get 'ut all' passing
- enable test_suite() in CL, to ensure that 'ut all' keeps passing
- record duration of each suite
- allow running the tests in random order to tease out dependencies
- tweak the output to remove common prefixes
- getting rid of bootstd, optee and seame 'ut' subcommands
Simon Glass (43):
test: Drop unused suite prototypes
test: Rename test_get_state() to ut_get_state()
test: Add functions to init and uninit the test state
test: Pass the test-state into ut_run_list() Improve support for linker lists in data structures
test: Add newlines to hush-test messages
test: Rename test suites to match their linker-list name
test: Update ut info to show suites
test/py: Add a test which runs all unit tests
test: Drop the _test suffix on linker lists
test: Introduce a better array of test suites
test: Drop the function for running bdinfo tests
test: Drop the function for running cmd tests
test: Drop the function for running common tests
test: Drop the function for running dm tests
test: Drop the function for running env tests
test: Drop the function for running exit tests
test: Drop the function for running fdt tests
test: Drop the function for running font tests
test: Drop the function for running lib tests
test: Drop the function for running log tests
test: Drop the function for running mbr tests
test: Drop the function for running mem tests
test: Drop the function for running setexpr tests
test: Drop the function for running measurement tests
test: Drop the function for running bloblist tests
test: Drop the function for running bootm tests
test: Drop the function for running addrmap tests
test: Drop the function for running hush tests
test: Drop the function for running loadm tests
test: Drop the function for running pci_mps tests
test: Drop the function for running seama tests
test: Drop the function for running upl tests
test: Drop the info test from the list
test: Drop conditional compilation for suites
test: Pass the test state to cmd_ut_category()
test: Move stats into a struct
test: Keep a track of the numbers of tests run
test: Move stat-printing into its own function
test: Record and show the totals for all test runs
test: Sort the test suites
test: Disable test_suite
test: Move help into the suite declaration
arch/sandbox/cpu/spl.c | 6 +- include/dm/test.h | 2 +- include/linker_lists.h | 51 +++++ include/test/cmd.h | 2 +- include/test/common.h | 2 +- include/test/env.h | 2 +- include/test/hush.h | 2 +- include/test/lib.h | 2 +- include/test/log.h | 4 +- include/test/optee.h | 2 +- include/test/overlay.h | 2 +- include/test/suites.h | 53 ++--- include/test/test.h | 23 ++- include/test/ut.h | 45 ++++- test/boot/bootm.c | 11 +- test/boot/bootstd_common.c | 9 +- test/boot/bootstd_common.h | 3 +- test/boot/measurement.c | 12 +- test/boot/upl.c | 11 +- test/cmd/Makefile | 4 +- test/cmd/addrmap.c | 11 +- test/cmd/bdinfo.c | 10 +- test/cmd/cmd_ut_cmd.c | 20 -- test/cmd/exit.c | 11 +- test/cmd/fdt.c | 10 +- test/cmd/font.c | 10 +- test/cmd/loadm.c | 11 +- test/cmd/mbr.c | 10 +- test/cmd/mem.c | 19 -- test/cmd/mem_copy.c | 2 +- test/cmd/mem_search.c | 2 +- test/cmd/pci_mps.c | 12 +- test/cmd/seama.c | 11 +- test/cmd/setexpr.c | 11 +- test/cmd_ut.c | 361 +++++++++++++++++++++------------- test/common/Makefile | 1 - test/common/bloblist.c | 12 +- test/common/cmd_ut_common.c | 21 -- test/dm/Makefile | 2 - test/dm/test-dm.c | 16 -- test/dm/test-driver.c | 10 +- test/dm/test-uclass.c | 8 +- test/env/cmd_ut_env.c | 10 - test/hush/Makefile | 1 - test/hush/cmd_ut_hush.c | 19 -- test/hush/dollar.c | 7 +- test/hush/loop.c | 4 +- test/lib/Makefile | 1 - test/lib/cmd_ut_lib.c | 19 -- test/log/Makefile | 2 - test/log/log_ut.c | 20 -- test/optee/cmd_ut_optee.c | 4 +- test/overlay/cmd_ut_overlay.c | 14 +- test/py/conftest.py | 7 +- test/py/tests/test_spl.py | 2 +- test/py/tests/test_suite.py | 182 +++++++++++++++++ test/py/tests/test_upl.py | 2 +- test/py/tests/test_ut.py | 2 +- test/py/tests/test_vbe.py | 2 +- test/py/tests/test_vpl.py | 2 +- test/test-main.c | 104 ++++++---- test/ut.c | 4 +- 62 files changed, 657 insertions(+), 580 deletions(-) delete mode 100644 test/cmd/cmd_ut_cmd.c delete mode 100644 test/cmd/mem.c delete mode 100644 test/common/cmd_ut_common.c delete mode 100644 test/dm/test-dm.c delete mode 100644 test/hush/cmd_ut_hush.c delete mode 100644 test/lib/cmd_ut_lib.c delete mode 100644 test/log/log_ut.c create mode 100644 test/py/tests/test_suite.py
Signature · 1 line
2.34.1
PATCH 1/43 test: Drop unused suite prototypes
Drop some the prototypes for functions which were removed in earlier series.
---
include/test/suites.h | 7 ------- 1 file changed, 7 deletions(-)
include/test/suites.h +0 -7
@@ -36,8 +36,6 @@ int do_ut_bloblist(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);int do_ut_cmd (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_common (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_compression (struct cmd_tbl *cmdtp,int flag,int argc, -char *const argv[]);int do_ut_dm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_env (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_exit (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
@@ -55,14 +53,9 @@ int do_ut_overlay(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);int do_ut_pci_mps (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_print (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_seama (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_setexpr (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_str (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_time (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_unicode (struct cmd_tbl *cmdtp,int flag,int argc, -char *const argv[]);int do_ut_upl (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);#endif /* __TEST_SUITES_H__ */
Signature · 1 line
2.34.1
PATCH 2/43 test: Rename test_get_state() to ut_get_state()
In reply to Simon GlassRename this function and test_set_state() so use the same ut_ prefix as other functions in ut.h
---
include/test/ut.h | 8 ++++---- test/dm/test-driver.c | 10 +++++----- test/dm/test-uclass.c | 8 ++++---- test/test-main.c | 8 ++++---- 4 files changed, 17 insertions(+), 17 deletions(-)
include/test/ut.h +4 -4
@@ -466,18 +466,18 @@ void ut_unsilence_console(struct unit_test_state *uts);void ut_set_skip_delays (struct unit_test_state *uts,bool skip_delays);/** -* test_get_state() - Get the active test state +* ut_state_get() - Get the active test state * * Return: the currently active test state, or NULL if none */ -struct unit_test_state *test_get_state (void ); +struct unit_test_state *ut_get_state (void );/** -* test_set_state() - Set the active test state +* ut_set_state() - Set the active test state * * @uts: Test state to use as currently active test state, or NULL if none */ -void test_set_state (struct unit_test_state *uts); +void ut_set_state (struct unit_test_state *uts);/** * ut_run_tests() - Run a set of tests
test/dm/test-driver.c +5 -5
@@ -35,7 +35,7 @@ static const struct test_ops test_ops = {static int test_bind (struct udevice *dev) { -struct unit_test_state *uts =test_get_state (); +struct unit_test_state *uts =ut_get_state ();/* Private data should not be allocated */ ut_assert (!dev_get_priv (dev));
@@ -46,7 +46,7 @@ static int test_bind(struct udevice *dev)static int test_probe (struct udevice *dev) { -struct unit_test_state *uts =test_get_state (); +struct unit_test_state *uts =ut_get_state ();struct dm_test_priv *priv =dev_get_priv (dev);/* Private data should be allocated */
@@ -59,7 +59,7 @@ static int test_probe(struct udevice *dev)static int test_remove (struct udevice *dev) { -struct unit_test_state *uts =test_get_state (); +struct unit_test_state *uts =ut_get_state ();/* Private data should still be allocated */ ut_assert (dev_get_priv (dev));
@@ -70,7 +70,7 @@ static int test_remove(struct udevice *dev)static int test_unbind (struct udevice *dev) { -struct unit_test_state *uts =test_get_state (); +struct unit_test_state *uts =ut_get_state ();/* Private data should not be allocated */ ut_assert (!dev_get_priv (dev));
@@ -121,7 +121,7 @@ static int test_manual_bind(struct udevice *dev)static int test_manual_probe (struct udevice *dev) { -struct unit_test_state *uts =test_get_state (); +struct unit_test_state *uts =ut_get_state (); dm_testdrv_op_count[DM_TEST_OP_PROBE ]++;if (!uts->force_fail_alloc)
test/dm/test-uclass.c +4 -4
@@ -28,7 +28,7 @@ int test_ping(struct udevice *dev, int pingval, int *pingret)static int test_post_bind (struct udevice *dev) { -struct unit_test_state *uts =test_get_state (); +struct unit_test_state *uts =ut_get_state ();struct dm_test_perdev_uc_pdata *uc_pdata; dm_testdrv_op_count[DM_TEST_OP_POST_BIND ]++;
@@ -54,7 +54,7 @@ static int test_pre_unbind(struct udevice *dev)static int test_pre_probe (struct udevice *dev) {struct dm_test_uclass_perdev_priv *priv =dev_get_uclass_priv (dev); -struct unit_test_state *uts =test_get_state (); +struct unit_test_state *uts =ut_get_state (); dm_testdrv_op_count[DM_TEST_OP_PRE_PROBE ]++;ut_assert (priv);
@@ -65,7 +65,7 @@ static int test_pre_probe(struct udevice *dev)static int test_post_probe (struct udevice *dev) { -struct unit_test_state *uts =test_get_state (); +struct unit_test_state *uts =ut_get_state ();struct udevice *prev =list_entry (dev->uclass_node.prev, struct udevice, uclass_node);
@@ -100,7 +100,7 @@ static int test_pre_remove(struct udevice *dev)static int test_init (struct uclass *uc) { -struct unit_test_state *uts =test_get_state (); +struct unit_test_state *uts =ut_get_state (); dm_testdrv_op_count[DM_TEST_OP_INIT ]++;ut_assert (uclass_get_priv (uc));
test/test-main.c +4 -4
@@ -63,12 +63,12 @@ static enum fdtchk_t fdt_action(void)/* This is valid when a test is running, NULL otherwise */ static struct unit_test_state *cur_test_state; -struct unit_test_state *test_get_state (void ) +struct unit_test_state *ut_get_state (void ) {return cur_test_state; } -void test_set_state (struct unit_test_state *uts) +void ut_set_state (struct unit_test_state *uts) { cur_test_state = uts; }
@@ -466,7 +466,7 @@ static int ut_run_test(struct unit_test_state *uts, struct unit_test *test,printf ("Test: %s: %s%s\n" , test_name, fname, note);/* Allow access to test state from drivers */ -test_set_state (uts); +ut_set_state (uts); ret =test_pre_run (uts, test);if (ret == -EAGAIN )
@@ -482,7 +482,7 @@ static int ut_run_test(struct unit_test_state *uts, struct unit_test *test,if (ret)return ret; -test_set_state (NULL ); +ut_set_state (NULL );return 0 ; }
Signature · 1 line
2.34.1
PATCH 3/43 test: Add functions to init and uninit the test state
In reply to Simon GlassMove these operations into separate functions so that it is clearer what is needed. These functions can also be called from somewhere other than ut_run_list().
---
test/test-main.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
test/test-main.c +16 -5
@@ -73,6 +73,19 @@ void ut_set_state(struct unit_test_state *uts) cur_test_state = uts; } +void ut_init_state (struct unit_test_state *uts) +{ +memset (uts,'\0' ,sizeof (*uts)); +} + +void ut_uninit_state (struct unit_test_state *uts) +{ +if (IS_ENABLED (CONFIG_SANDBOX )) { +os_free (uts->fdt_copy); +os_free (uts->other_fdt); + } +} +/** * dm_test_pre_run() - Get ready to run a driver model test *
@@ -664,10 +677,11 @@ int ut_run_list(const char *category, const char *prefix, struct unit_test *tests, int count, const char *select_name, int runs_per_test, bool force_run, const char *test_insert) { - struct unit_test_state uts = { .fail_count = 0 }; + struct unit_test_state uts;bool has_dm_tests = false;int ret; +ut_init_state (&uts);if (!CONFIG_IS_ENABLED (OF_PLATDATA ) &&ut_list_has_dm_tests (tests, count, prefix, select_name)) { has_dm_tests = true;
@@ -703,10 +717,6 @@ int ut_run_list(const char *category, const char *prefix,/* Best efforts only...ignore errors */ if (has_dm_tests)dm_test_restore (uts.of_root); -if (IS_ENABLED (CONFIG_SANDBOX )) { -os_free (uts.fdt_copy); -os_free (uts.other_fdt); - }if (uts.skip_count)printf ("Skipped: %d, " , uts.skip_count);
@@ -714,6 +724,7 @@ int ut_run_list(const char *category, const char *prefix,printf ("Test '%s' not found\n" , select_name); else printf("Failures: %d\n", uts.fail_count); +ut_uninit_state (&uts);return ret; }
Signature · 1 line
2.34.1
PATCH 4/43 test: Pass the test-state into ut_run_list()
In reply to Simon GlassPass this into the function so that callers can inspect the state afterwards.
---
arch/sandbox/cpu/spl.c | 5 ++++- include/test/ut.h | 29 ++++++++++++++++++++++++++--- test/cmd_ut.c | 5 ++++- test/test-main.c | 35 +++++++++++++++++------------------ 4 files changed, 51 insertions(+), 23 deletions(-)
arch/sandbox/cpu/spl.c +4 -1
@@ -147,10 +147,13 @@ void spl_board_init(void)if (state->run_unittests) {struct unit_test *tests =UNIT_TEST_ALL_START ();const int count =UNIT_TEST_ALL_COUNT (); +struct unit_test_state uts;int ret; - ret =ut_run_list ("spl" ,NULL , tests, count, +ut_init_state (&uts); + ret =ut_run_list (&uts,"spl" ,NULL , tests, count, state->select_unittests,1 , false,NULL ); +ut_uninit_state (&uts);/* continue execution into U-Boot */ } }
include/test/ut.h +26 -3
@@ -479,12 +479,34 @@ struct unit_test_state *ut_get_state(void);*/ void ut_set_state (struct unit_test_state *uts); +/** +* ut_init_state() - Set up a new test state +* +* This must be called before using the test state with ut_run_tests() +* +* @uts: Test state to init +*/ +void ut_init_state (struct unit_test_state *uts); + +/** +* ut_uninit_state() - Free memory used by test state +* +* This must be called before after the test state with ut_run_tests(). To later +* reuse the test state to run more tests, call test_state_init() first +* +* @uts: Test state to uninit +*/ +void ut_uninit_state (struct unit_test_state *uts); +/** * ut_run_tests() - Run a set of tests * * This runs the test, handling any preparation and clean-up needed. It prints * the name of each test before running it. * +* @uts: Unit-test state, which must be ready for use, i.e. ut_init_state() +* has been called. The caller is responsible for calling +* ut_uninit_state() after this function returns * @category: Category of these tests. This is a string printed at the start to * announce the the number of tests * @prefix: String prefix for the tests. Any tests that have this prefix will be
@@ -503,8 +525,9 @@ void ut_set_state(struct unit_test_state *uts);* Pass NULL to disable this * Return: 0 if all tests passed, -1 if any failed */ -int ut_run_list (const char *name,const char *prefix,struct unit_test *tests, -int count,const char *select_name,int runs_per_test, -bool force_run,const char *test_insert); +int ut_run_list (struct unit_test_state *uts,const char *category, +const char *prefix,struct unit_test *tests,int count, +const char *select_name,int runs_per_test,bool force_run, +const char *test_insert);#endif
test/cmd_ut.c +4 -1
@@ -21,6 +21,7 @@ int cmd_ut_category(const char *name, const char *prefix, struct unit_test *tests, int n_ents, int argc, char *const argv[]) { + struct unit_test_state uts;const char *test_insert =NULL ;int runs_per_text =1 ;bool force_run = false;
@@ -44,9 +45,11 @@ int cmd_ut_category(const char *name, const char *prefix, argc--; } - ret =ut_run_list (name, prefix, tests, n_ents, +ut_init_state (&uts); + ret =ut_run_list (&uts, name, prefix, tests, n_ents,cmd_arg1 (argc, argv), runs_per_text, force_run, test_insert); +ut_uninit_state (&uts);return ret ?CMD_RET_FAILURE :0 ; }
test/test-main.c +17 -18
@@ -673,15 +673,15 @@ static int ut_run_tests(struct unit_test_state *uts, const char *prefix,return uts->fail_count ? -EBADF :0 ; } -int ut_run_list (const char *category,const char *prefix, -struct unit_test *tests,int count,const char *select_name, -int runs_per_test,bool force_run,const char *test_insert) +int ut_run_list (struct unit_test_state *uts,const char *category, +const char *prefix,struct unit_test *tests,int count, +const char *select_name,int runs_per_test,bool force_run, +const char *test_insert) { -struct unit_test_state uts; + ;bool has_dm_tests = false;int ret; -ut_init_state (&uts);if (!CONFIG_IS_ENABLED (OF_PLATDATA ) &&ut_list_has_dm_tests (tests, count, prefix, select_name)) { has_dm_tests = true;
@@ -699,32 +699,31 @@ int ut_run_list(const char *category, const char *prefix,if (!select_name)printf ("Running %d %s tests\n" , count, category); - uts.of_root =gd_of_root (); - uts.runs_per_test = runs_per_test; + uts->of_root =gd_of_root (); + uts->runs_per_test = runs_per_test;if (fdt_action () ==FDTCHK_COPY && gd->fdt_blob) { - uts.fdt_size =fdt_totalsize (gd->fdt_blob); - uts.fdt_copy =os_malloc (uts.fdt_size); -if (!uts.fdt_copy) { + uts->fdt_size =fdt_totalsize (gd->fdt_blob); + uts->fdt_copy =os_malloc (uts->fdt_size); +if (!uts->fdt_copy) {printf ("Out of memory for device tree copy\n" );return -ENOMEM ; } -memcpy (uts.fdt_copy, gd->fdt_blob, uts.fdt_size); +memcpy (uts->fdt_copy, gd->fdt_blob, uts->fdt_size); } - uts.force_run = force_run; - ret =ut_run_tests (&uts, prefix, tests, count, select_name, + uts->force_run = force_run; + ret =ut_run_tests (uts, prefix, tests, count, select_name, test_insert);/* Best efforts only...ignore errors */ if (has_dm_tests) -dm_test_restore (uts.of_root); +dm_test_restore (uts->of_root); -if (uts.skip_count) -printf ("Skipped: %d, " , uts.skip_count); +if (uts->skip_count) +printf ("Skipped: %d, " , uts->skip_count);if (ret == -ENOENT )printf ("Test '%s' not found\n" , select_name);else -printf ("Failures: %d\n" , uts.fail_count); -ut_uninit_state (&uts); +printf ("Failures: %d\n" , uts->fail_count);return ret; }
Signature · 1 line
2.34.1
PATCH 5/43 Improve support for linker lists in data structures
In reply to Simon GlassA limitation of most linker_list macros is that they cannot easily be used in data structures. This is because they include code inside their expressions.
Provide a way to support this, with new ll_start_decl() and ll_end_decl() macros.
---
include/linker_lists.h | 51 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
include/linker_lists.h +51 -0
@@ -186,6 +186,57 @@ _ll_result; \ }) +/** +* Declares a symbol that points to the start/end of the list. The name of the +* (new) symbol is arbitrary and can be anything that is not already declared in +* the file where it appears. It is provided in _sym and can then be used (later +* in the same file) within a data structure. +* +* The _type and _list arguments must match those passed to ll_entry_start/end() +* +* Example: +* +* :: +* Here we want to record the start of each sub-command in a list. We have two +* sub-commands, 'bob' and 'mary'. +* +* In bob.c: +* ll_entry_declare(struct my_sub_cmd, bob_cmd, cmd_sub) = {...} +* +* In mary.c: +* ll_entry_declare(struct my_sub_cmd, mary_cmd, cmd_sub) = {...} +* +* In a different file where we want a list the start of all sub-commands. +* It is not possible to use ll_entry_start() in a data structure, due to its +* use of code inside expressions - ({ ... }) - so this fails to compile: +* +* In sub_cmds.c: +* struct cmd_sub *my_list[] = { +* ll_entry_start(cmd_sub, bob), +* ll_entry_start(cmd_sub, bob), +* } +* +* Instead, we can use: +* +* ll_start_decl(bob, struct my_sub_cmd, cmd_sub); +* ll_start_decl(mary, struct my_sub_cmd, cmd_sub); +* +* struct cmd_sub *my_list[] = { +* bob, +* mary, +* } +* +* So 'bob' is declared as symbol, a struct my_list * which points to the +* start of the bob sub-commands. It is then used in my_list[] +*/ +#define ll_start_decl (_sym, _type, _list) \ + static _type _sym[0] __aligned(CONFIG_LINKER_LIST_ALIGN) \ + __maybe_unused __section("__u_boot_list_2_" #_list "_1") + +#define ll_end_decl (_sym, _type, _list) \ + static _type _sym[0] __aligned(CONFIG_LINKER_LIST_ALIGN) \ + __maybe_unused __section("__u_boot_list_2_" #_list "_3") +/** * ll_entry_get() - Retrieve entry from linker-generated array by name * @_type: Data type of the entry
Signature · 1 line
2.34.1
PATCH 6/43 test: Add newlines to hush-test messages
In reply to Simon GlassA few messages lack a newline so the test output shows the next test-name on the same line. For example:
Beware: this test sets local variable dollar_bar and dollar_quux
and they cannot be unset!Test: hush_test_env_dollar: dollar.c
This is confusing, so fix it.
---
test/hush/dollar.c | 7 ++++--- test/hush/loop.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-)
test/hush/dollar.c +4 -3
@@ -108,7 +108,7 @@ static int hush_test_simple_dollar(struct unit_test_state *uts)/* Reset local variable. */ ut_assertok (run_command ("dollar_foo=" ,0 )); }else if (gd->flags &GD_FLG_HUSH_OLD_PARSER ) { -puts ("Beware: this test set local variable dollar_foo and it cannot be unset!" ); +puts ("Beware: this test set local variable dollar_foo and it cannot be unset!\n" ); }return 0 ;
@@ -140,7 +140,7 @@ static int hush_test_env_dollar(struct unit_test_state *uts)/* Reset local variable. */ ut_assertok (run_command ("env_foo=" ,0 )); }else if (gd->flags &GD_FLG_HUSH_OLD_PARSER ) { -puts ("Beware: this test set local variable env_foo and it cannot be unset!" ); +puts ("Beware: this test set local variable env_foo and it cannot be unset!\n" ); }return 0 ;
@@ -206,7 +206,8 @@ static int hush_test_command_dollar(struct unit_test_state *uts)ut_assertok (run_command ("dollar_bar=" ,0 ));ut_assertok (run_command ("dollar_quux=" ,0 )); }else if (gd->flags &GD_FLG_HUSH_OLD_PARSER ) { -puts ("Beware: this test sets local variable dollar_bar and dollar_quux and they cannot be unset!" ); +puts ("Beware: this test sets local variable dollar_bar and " +"dollar_quux and they cannot be unset!\n" ); }return 0 ;
test/hush/loop.c +2 -2
@@ -25,7 +25,7 @@ static int hush_test_for(struct unit_test_state *uts)/* Reset local variable. */ ut_assertok (run_command ("loop_i=" ,0 )); }else if (gd->flags &GD_FLG_HUSH_OLD_PARSER ) { -puts ("Beware: this test set local variable loop_i and it cannot be unset!" ); +puts ("Beware: this test set local variable loop_i and it cannot be unset!\n" ); }return 0 ;
@@ -56,7 +56,7 @@ static int hush_test_while(struct unit_test_state *uts)/* Reset local variable. */ ut_assertok (run_command ("loop_foo=" ,0 )); }else if (gd->flags &GD_FLG_HUSH_OLD_PARSER ) { -puts ("Beware: this test set local variable loop_foo and it cannot be unset!" ); +puts ("Beware: this test set local variable loop_foo and it cannot be unset!\n" ); }return 0 ;
Signature · 1 line
2.34.1
PATCH 7/43 test: Rename test suites to match their linker-list name
In reply to Simon GlassSome suites have a different name from that used in the linker list. That makes it hard to programmatically match the name printed when the suite runs to the linker-list name it has.
Update the names so they are the same.
---
include/test/cmd.h | 2 +- test/boot/upl.c | 3 +-- test/cmd/addrmap.c | 2 +- test/cmd/cmd_ut_cmd.c | 4 ++-- test/cmd/exit.c | 2 +- test/cmd/mem.c | 2 +- test/cmd/pci_mps.c | 2 +- test/cmd/setexpr.c | 2 +- test/dm/test-dm.c | 3 +-- test/env/cmd_ut_env.c | 3 +-- 10 files changed, 11 insertions(+), 14 deletions(-)
include/test/cmd.h +1 -1
@@ -10,6 +10,6 @@#include <test/test.h> /* Declare a new command test */ -#define CMD_TEST (_name, _flags) UNIT_TEST(_name, _flags, cmd_test) +#define CMD_TEST (_name, _flags) UNIT_TEST(_name, _flags, cmd)#endif /* __TEST_CMD_H__ */
test/boot/upl.c +1 -2
@@ -432,6 +432,5 @@ int do_ut_upl(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])struct unit_test *tests =UNIT_TEST_SUITE_START (upl_test);const int n_ents =UNIT_TEST_SUITE_COUNT (upl_test); -return cmd_ut_category ("cmd_upl" ,"cmd_upl_" , tests, n_ents, argc, - argv); +return cmd_ut_category ("upl" ,"cmd_upl_" , tests, n_ents, argc, argv); }
test/cmd/addrmap.c +1 -1
@@ -30,6 +30,6 @@ int do_ut_addrmap(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])struct unit_test *tests =UNIT_TEST_SUITE_START (addrmap_test);const int n_ents =UNIT_TEST_SUITE_COUNT (addrmap_test); -return cmd_ut_category ("cmd_addrmap" ,"cmd_addrmap_" , tests, n_ents, +return cmd_ut_category ("addrmap" ,"cmd_addrmap_" , tests, n_ents, argc, argv); }
test/cmd/cmd_ut_cmd.c +2 -2
@@ -13,8 +13,8 @@int do_ut_cmd (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (cmd_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (cmd_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (cmd); +const int n_ents =UNIT_TEST_SUITE_COUNT (cmd);return cmd_ut_category ("cmd" ,"cmd_test_" , tests, n_ents, argc, argv); }
test/cmd/exit.c +1 -1
@@ -116,6 +116,6 @@ int do_ut_exit(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])struct unit_test *tests =UNIT_TEST_SUITE_START (exit_test);const int n_ents =UNIT_TEST_SUITE_COUNT (exit_test); -return cmd_ut_category ("cmd_exit" ,"exit_test_" , tests, n_ents, +return cmd_ut_category ("exit" ,"exit_test_" , tests, n_ents, argc, argv); }
test/cmd/mem.c +1 -1
@@ -14,6 +14,6 @@ int do_ut_mem(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])struct unit_test *tests =UNIT_TEST_SUITE_START (mem_test);const int n_ents =UNIT_TEST_SUITE_COUNT (mem_test); -return cmd_ut_category ("cmd_mem" ,"mem_test_" , tests, n_ents, argc, +return cmd_ut_category ("mem" ,"mem_test_" , tests, n_ents, argc, argv); }
test/cmd/pci_mps.c +1 -1
@@ -35,6 +35,6 @@ int do_ut_pci_mps(struct cmd_tbl *cmdtp, int flag, int argc,struct unit_test *tests =UNIT_TEST_SUITE_START (pci_mps_test);const int n =UNIT_TEST_SUITE_COUNT (pci_mps_test); -return cmd_ut_category ("cmd_pci_mps" ,"pci_mps_test_" , tests, n, +return cmd_ut_category ("pci_mps" ,"pci_mps_test_" , tests, n, argc, argv); }
test/cmd/setexpr.c +1 -1
@@ -485,6 +485,6 @@ int do_ut_setexpr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])struct unit_test *tests =UNIT_TEST_SUITE_START (setexpr_test);const int n_ents =UNIT_TEST_SUITE_COUNT (setexpr_test); -return cmd_ut_category ("cmd_setexpr" ,"setexpr_test_" , tests, n_ents, +return cmd_ut_category ("setexpr" ,"setexpr_test_" , tests, n_ents, argc, argv); }
test/dm/test-dm.c +1 -2
@@ -11,6 +11,5 @@ int do_ut_dm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])struct unit_test *tests =UNIT_TEST_SUITE_START (dm_test);const int n_ents =UNIT_TEST_SUITE_COUNT (dm_test); -return cmd_ut_category ("driver model" ,"dm_test_" , tests, n_ents, argc, - argv); +return cmd_ut_category ("dm" ,"dm_test_" , tests, n_ents, argc, argv); }
test/env/cmd_ut_env.c +1 -2
@@ -80,6 +80,5 @@ int do_ut_env(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])struct unit_test *tests =UNIT_TEST_SUITE_START (env_test);const int n_ents =UNIT_TEST_SUITE_COUNT (env_test); -return cmd_ut_category ("environment" ,"env_test_" , - tests, n_ents, argc, argv); +return cmd_ut_category ("env" ,"env_test_" , tests, n_ents, argc, argv); }
Signature · 1 line
2.34.1
PATCH 8/43 test: Update ut info to show suites
In reply to Simon GlassIt is helpful to see a list of available suites. At present this is handled by the longhelp for the 'ut' command, but this is not in a format which can be easily parsed by python tests.
Add a -s option to show this. At present it is not possible to show the number of tests in each suite, but future work will address this. For now, show a ?
---
test/cmd_ut.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
test/cmd_ut.c +13 -1
@@ -151,9 +151,21 @@ static int do_ut_all(struct cmd_tbl *cmdtp, int flag, int argc,static int do_ut_info (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { +const char *flags; +printf ("Test suites: %d\n" , (int )ARRAY_SIZE (cmd_ut_sub));printf ("Total tests: %d\n" , (int )UNIT_TEST_ALL_COUNT ()); + flags =cmd_arg1 (argc, argv); +if (flags && !strcmp ("-s" , flags)) { +int i; + +puts ("\nTests Suite\n" ); +puts ("----- -----\n" ); +for (i =1 ; i <ARRAY_SIZE (cmd_ut_sub); i++) +printf ("%5s %s\n" ,"?" , cmd_ut_sub[i].name); + } +return 0 ; }
@@ -184,7 +196,7 @@ U_BOOT_LONGHELP(ut,"\n" "\nOptions for <suite>:" "\nall - execute all enabled tests" -"\ninfo - show info about tests" +"\ninfo [-s] - show info about tests [and suites]" #ifdef CONFIG_CMD_ADDRMAP"\naddrmap - very basic test of addrmap command" #endif
Signature · 1 line
2.34.1
PATCH 9/43 test/py: Add a test which runs all unit tests
In reply to Simon GlassAdd a Python test which runs 'ut all' and then checks that the expected suites are present and all tests in each suite are run.
This can help to check that nothing is missing.
Update 'ut info' to ignore the 'all' suite when counting the number of suites, since that is really just a combination of all the other suites.
Adjust the message for skipped tests so that appears even if no particular test was selected. This helps the new 'test_suite' test see what is going on.
---
test/cmd_ut.c | 2 +- test/py/tests/test_suite.py | 175 ++++++++++++++++++++++++++++++++++++ test/test-main.c | 6 +- 3 files changed, 178 insertions(+), 5 deletions(-) create mode 100644 test/py/tests/test_suite.py
test/cmd_ut.c +1 -1
@@ -153,7 +153,7 @@ static int do_ut_info(struct cmd_tbl *cmdtp, int flag, int argc, {const char *flags; -printf ("Test suites: %d\n" , (int )ARRAY_SIZE (cmd_ut_sub)); +printf ("Test suites: %d\n" , (int )ARRAY_SIZE (cmd_ut_sub) -1 );printf ("Total tests: %d\n" , (int )UNIT_TEST_ALL_COUNT ()); flags =cmd_arg1 (argc, argv);
test/py/tests/test_suite.py new file +175 -0
175 lines not on this page · raw message
test/test-main.c +2 -4
@@ -636,10 +636,8 @@ static int ut_run_tests(struct unit_test_state *uts, const char *prefix,return -EBADF ; }if (!uts->force_run) { -if (select_name) { -printf ("Test '%s' skipped as it is manual (use -f to run it)\n" , - test_name); - } +printf ("Test: %s: skipped as it is manual (use -f to run it)\n" , + test_name);continue ; } }
Signature · 1 line
2.34.1
PATCH 10/43 test: Drop the _test suffix on linker lists
In reply to Simon GlassMost test suites have a _test suffix. This is not necessary as there is also a ut_ prefix.
Drop the suffix so that (with future work) the suite name can be used as the linker-list name.
Remove the suffix from the pytest regex as well, moving it to the top of the file, as it is a constant.
---
include/dm/test.h | 2 +- include/test/common.h | 2 +- include/test/env.h | 2 +- include/test/hush.h | 2 +- include/test/lib.h | 2 +- include/test/log.h | 4 ++-- include/test/optee.h | 2 +- include/test/overlay.h | 2 +- test/boot/bootm.c | 6 +++--- test/boot/bootstd_common.c | 8 ++++---- test/boot/bootstd_common.h | 3 +-- test/boot/measurement.c | 6 +++--- test/boot/upl.c | 6 +++--- test/cmd/addrmap.c | 6 +++--- test/cmd/bdinfo.c | 6 +++--- test/cmd/exit.c | 6 +++--- test/cmd/fdt.c | 6 +++--- test/cmd/font.c | 6 +++--- test/cmd/loadm.c | 6 +++--- test/cmd/mbr.c | 6 +++--- test/cmd/mem.c | 4 ++-- test/cmd/mem_copy.c | 2 +- test/cmd/mem_search.c | 2 +- test/cmd/pci_mps.c | 6 +++--- test/cmd/seama.c | 6 +++--- test/cmd/setexpr.c | 6 +++--- test/common/bloblist.c | 6 +++--- test/common/cmd_ut_common.c | 4 ++-- test/dm/test-dm.c | 4 ++-- test/env/cmd_ut_env.c | 4 ++-- test/hush/cmd_ut_hush.c | 4 ++-- test/lib/cmd_ut_lib.c | 4 ++-- test/log/log_ut.c | 4 ++-- test/optee/cmd_ut_optee.c | 4 ++-- test/overlay/cmd_ut_overlay.c | 4 ++-- test/py/conftest.py | 7 +++++-- 36 files changed, 81 insertions(+), 79 deletions(-)
include/dm/test.h +1 -1
@@ -143,7 +143,7 @@ extern struct unit_test_state global_dm_test_state;/* Declare a new driver model test */ #define DM_TEST (_name, _flags) \ - UNIT_TEST(_name, UTF_DM | UTF_CONSOLE | (_flags), dm_test) + UNIT_TEST(_name, UTF_DM | UTF_CONSOLE | (_flags), dm)/* * struct sandbox_sdl_plat - Platform data for the SDL video driver
include/test/common.h +1 -1
@@ -10,6 +10,6 @@#include <test/test.h> /* Declare a new common function test */ -#define COMMON_TEST (_name, _flags) UNIT_TEST(_name, _flags, common_test) +#define COMMON_TEST (_name, _flags) UNIT_TEST(_name, _flags, common)#endif /* __TEST_COMMON_H__ */
include/test/env.h +1 -1
@@ -10,6 +10,6 @@#include <test/test.h> /* Declare a new environment test */ -#define ENV_TEST (_name, _flags) UNIT_TEST(_name, _flags, env_test) +#define ENV_TEST (_name, _flags) UNIT_TEST(_name, _flags, env)#endif /* __TEST_ENV_H__ */
include/test/hush.h +1 -1
@@ -10,6 +10,6 @@#include <test/test.h> /* Declare a new environment test */ -#define HUSH_TEST (_name, _flags) UNIT_TEST(_name, _flags, hush_test) +#define HUSH_TEST (_name, _flags) UNIT_TEST(_name, _flags, hush)#endif /* __TEST_HUSH_H__ */
include/test/lib.h +1 -1
@@ -9,6 +9,6 @@#include <test/test.h> /* Declare a new library function test */ -#define LIB_TEST (_name, _flags) UNIT_TEST(_name, _flags, lib_test) +#define LIB_TEST (_name, _flags) UNIT_TEST(_name, _flags, lib)#endif /* __TEST_LIB_H__ */
include/test/log.h +2 -2
@@ -13,8 +13,8 @@#define LOGF_TEST (BIT(LOGF_FUNC) | BIT(LOGF_MSG))/* Declare a new logging test */ -#define LOG_TEST (_name) UNIT_TEST(_name, UTF_CONSOLE, log_test) +#define LOG_TEST (_name) UNIT_TEST(_name, UTF_CONSOLE, log)#define LOG_TEST_FLAGS (_name, _flags) \ - UNIT_TEST(_name, _flags | UTF_CONSOLE, log_test) + UNIT_TEST(_name, _flags | UTF_CONSOLE, log)#endif /* __TEST_LOG_H__ */
include/test/optee.h +1 -1
@@ -9,6 +9,6 @@#include <test/test.h> /* Declare a new environment test */ -#define OPTEE_TEST (_name, _flags) UNIT_TEST(_name, _flags, optee_test) +#define OPTEE_TEST (_name, _flags) UNIT_TEST(_name, _flags, optee)#endif /* __TEST_OPTEE_H__ */
include/test/overlay.h +1 -1
@@ -10,6 +10,6 @@#include <test/test.h> /* Declare a new environment test */ -#define OVERLAY_TEST (_name, _flags) UNIT_TEST(_name, _flags, overlay_test) +#define OVERLAY_TEST (_name, _flags) UNIT_TEST(_name, _flags, overlay)#endif /* __TEST_OVERLAY_H__ */
test/boot/bootm.c +3 -3
@@ -13,7 +13,7 @@DECLARE_GLOBAL_DATA_PTR ; -#define BOOTM_TEST (_name, _flags) UNIT_TEST(_name, _flags, bootm_test) +#define BOOTM_TEST (_name, _flags) UNIT_TEST(_name, _flags, bootm)enum {BUF_SIZE =1024 ,
@@ -259,8 +259,8 @@ BOOTM_TEST(bootm_test_subst_both, 0);int do_ut_bootm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (bootm_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (bootm_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (bootm); +const int n_ents =UNIT_TEST_SUITE_COUNT (bootm);return cmd_ut_category ("bootm" ,"bootm_test_" , tests, n_ents, argc, argv);
test/boot/bootstd_common.c +4 -4
@@ -96,8 +96,8 @@ void bootstd_reset_usb(void)int do_ut_bootstd (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (bootstd_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (bootstd_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (bootstd); +const int n_ents =UNIT_TEST_SUITE_COUNT (bootstd);int ret; ret =bootstd_setup_for_tests ();
@@ -106,6 +106,6 @@ int do_ut_bootstd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])return CMD_RET_FAILURE ; } -return cmd_ut_category ("bootstd" ,"bootstd_test_" , - tests, n_ents, argc, argv); +return cmd_ut_category ("bootstd" ,"bootstd_" , tests, n_ents, + argc, argv); }
test/boot/bootstd_common.h +1 -2
@@ -12,8 +12,7 @@#include <version_string.h> /* Declare a new bootdev test */ -#define BOOTSTD_TEST (_name, _flags) \ - UNIT_TEST(_name, _flags, bootstd_test) +#define BOOTSTD_TEST (_name, _flags) UNIT_TEST(_name, _flags, bootstd)#define NVDATA_START_BLK ((0x400 + 0x400) / MMC_MAX_BLOCK_LEN)#define VERSION_START_BLK ((0x400 + 0x800) / MMC_MAX_BLOCK_LEN)
test/boot/measurement.c +3 -3
@@ -14,7 +14,7 @@#include <asm/io.h> #define MEASUREMENT_TEST (_name, _flags) \ - UNIT_TEST(_name, _flags, measurement_test) + UNIT_TEST(_name, _flags, measurement)static int measure (struct unit_test_state *uts) {
@@ -57,8 +57,8 @@ MEASUREMENT_TEST(measure, 0);int do_ut_measurement (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (measurement_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (measurement_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (measurement); +const int n_ents =UNIT_TEST_SUITE_COUNT (measurement);return cmd_ut_category ("measurement" ,"measurement_test_" , tests, n_ents, argc, argv);
test/boot/upl.c +3 -3
@@ -16,7 +16,7 @@#include "bootstd_common.h" /* Declare a new upl test */ -#define UPL_TEST (_name, _flags) UNIT_TEST(_name, _flags, upl_test) +#define UPL_TEST (_name, _flags) UNIT_TEST(_name, _flags, upl)static int add_region (struct unit_test_state *uts,struct alist *lst,ulong base,ulong size)
@@ -429,8 +429,8 @@ UPL_TEST(upl_test_info_norun, UTF_CONSOLE | UTF_MANUAL);int do_ut_upl (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (upl_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (upl_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (upl); +const int n_ents =UNIT_TEST_SUITE_COUNT (upl);return cmd_ut_category ("upl" ,"cmd_upl_" , tests, n_ents, argc, argv); }
test/cmd/addrmap.c +3 -3
@@ -10,7 +10,7 @@#include <test/ut.h> /* Declare a new addrmap test */ -#define ADDRMAP_TEST (_name, _flags) UNIT_TEST(_name, _flags, addrmap_test) +#define ADDRMAP_TEST (_name, _flags) UNIT_TEST(_name, _flags, addrmap)/* Test 'addrmap' command output */ static int addrmap_test_basic (struct unit_test_state *uts)
@@ -27,8 +27,8 @@ ADDRMAP_TEST(addrmap_test_basic, UTF_CONSOLE);int do_ut_addrmap (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (addrmap_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (addrmap_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (addrmap); +const int n_ents =UNIT_TEST_SUITE_COUNT (addrmap);return cmd_ut_category ("addrmap" ,"cmd_addrmap_" , tests, n_ents, argc, argv);
test/cmd/bdinfo.c +3 -3
@@ -26,7 +26,7 @@DECLARE_GLOBAL_DATA_PTR ;/* Declare a new bdinfo test */ -#define BDINFO_TEST (_name, _flags) UNIT_TEST(_name, _flags, bdinfo_test) +#define BDINFO_TEST (_name, _flags) UNIT_TEST(_name, _flags, bdinfo)static int test_num_l (struct unit_test_state *uts,const char *name,ulong value)
@@ -285,8 +285,8 @@ BDINFO_TEST(bdinfo_test_eth, UTF_CONSOLE);int do_ut_bdinfo (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (bdinfo_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (bdinfo_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (bdinfo); +const int n_ents =UNIT_TEST_SUITE_COUNT (bdinfo);return cmd_ut_category ("bdinfo" ,"bdinfo_test_" , tests, n_ents, argc, argv); }
test/cmd/exit.c +3 -3
@@ -14,7 +14,7 @@DECLARE_GLOBAL_DATA_PTR ;/* Declare a new exit test */ -#define EXIT_TEST (_name, _flags) UNIT_TEST(_name, _flags, exit_test) +#define EXIT_TEST (_name, _flags) UNIT_TEST(_name, _flags, exit)/* Test 'exit addr' getting/setting address */ static int cmd_exit_test (struct unit_test_state *uts)
@@ -113,8 +113,8 @@ EXIT_TEST(cmd_exit_test, UTF_CONSOLE);int do_ut_exit (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (exit_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (exit_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (exit); +const int n_ents =UNIT_TEST_SUITE_COUNT (exit);return cmd_ut_category ("exit" ,"exit_test_" , tests, n_ents, argc, argv);
test/cmd/fdt.c +3 -3
@@ -23,7 +23,7 @@ DECLARE_GLOBAL_DATA_PTR;*/ /* Declare a new fdt test */ -#define FDT_TEST (_name, _flags) UNIT_TEST(_name, _flags, fdt_test) +#define FDT_TEST (_name, _flags) UNIT_TEST(_name, _flags, fdt)/** * make_test_fdt() - Create an FDT with just a root node
@@ -1465,8 +1465,8 @@ FDT_TEST(fdt_test_apply, UTF_CONSOLE);int do_ut_fdt (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (fdt_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (fdt_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (fdt); +const int n_ents =UNIT_TEST_SUITE_COUNT (fdt);return cmd_ut_category ("fdt" ,"fdt_test_" , tests, n_ents, argc, argv); }
test/cmd/font.c +3 -3
@@ -12,7 +12,7 @@#include <test/ut.h> /* Declare a new fdt test */ -#define FONT_TEST (_name, _flags) UNIT_TEST(_name, _flags, font_test) +#define FONT_TEST (_name, _flags) UNIT_TEST(_name, _flags, font)/* Test 'fdt addr' resizing an fdt */ static int font_test_base (struct unit_test_state *uts)
@@ -88,8 +88,8 @@ FONT_TEST(font_test_base, UTF_SCAN_PDATA | UTF_SCAN_FDT | UTF_CONSOLE |int do_ut_font (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (font_Test); -const int n_ents =UNIT_TEST_SUITE_COUNT (font_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (font); +const int n_ents =UNIT_TEST_SUITE_COUNT (font);return cmd_ut_category ("font" ,"font_test_" , tests, n_ents, argc, argv); }
test/cmd/loadm.c +3 -3
@@ -19,7 +19,7 @@#define BUF_SIZE 0x100 -#define LOADM_TEST (_name, _flags) UNIT_TEST(_name, _flags, loadm_test) +#define LOADM_TEST (_name, _flags) UNIT_TEST(_name, _flags, loadm)static int loadm_test_params (struct unit_test_state *uts) {
@@ -61,8 +61,8 @@ LOADM_TEST(loadm_test_load, UTF_CONSOLE);int do_ut_loadm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (loadm_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (loadm_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (loadm); +const int n_ents =UNIT_TEST_SUITE_COUNT (loadm);return cmd_ut_category ("loadm" ,"loadm_test_" , tests, n_ents, argc, argv);
test/cmd/mbr.c +3 -3
@@ -470,12 +470,12 @@ static int mbr_test_run(struct unit_test_state *uts) }/* Declare mbr test */ -UNIT_TEST (mbr_test_run,UTF_CONSOLE , mbr_test); +UNIT_TEST (mbr_test_run,UTF_CONSOLE , mbr);int do_ut_mbr (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (mbr_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (mbr_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (mbr); +const int n_ents =UNIT_TEST_SUITE_COUNT (mbr);return cmd_ut_category ("mbr" ,"mbr_test_" , tests, n_ents, argc, argv); }
test/cmd/mem.c +2 -2
@@ -11,8 +11,8 @@int do_ut_mem (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (mem_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (mem_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (mem); +const int n_ents =UNIT_TEST_SUITE_COUNT (mem);return cmd_ut_category ("mem" ,"mem_test_" , tests, n_ents, argc, argv);
test/cmd/mem_copy.c +1 -1
@@ -12,7 +12,7 @@#define BUF_SIZE 256/* Declare a new mem test */ -#define MEM_TEST (_name) UNIT_TEST(_name, 0, mem_test) +#define MEM_TEST (_name) UNIT_TEST(_name, 0, mem)struct param {int d, s, count;
test/cmd/mem_search.c +1 -1
@@ -14,7 +14,7 @@#define BUF_SIZE 0x100/* Declare a new mem test */ -#define MEM_TEST (_name, _flags) UNIT_TEST(_name, _flags, mem_test) +#define MEM_TEST (_name, _flags) UNIT_TEST(_name, _flags, mem)/* Test 'ms' command with bytes */ static int mem_test_ms_b (struct unit_test_state *uts)
test/cmd/pci_mps.c +3 -3
@@ -11,7 +11,7 @@#include <test/suites.h> #include <test/ut.h> -#define PCI_MPS_TEST (_name, _flags) UNIT_TEST(_name, _flags, pci_mps_test) +#define PCI_MPS_TEST (_name, _flags) UNIT_TEST(_name, _flags, pci_mps)/* Test "pci_mps" command in safe "s" mode */ static int test_pci_mps_safe (struct unit_test_state *uts)
@@ -32,8 +32,8 @@ PCI_MPS_TEST(test_pci_mps_safe, UTF_CONSOLE);int do_ut_pci_mps (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (pci_mps_test); -const int n =UNIT_TEST_SUITE_COUNT (pci_mps_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (pci_mps); +const int n =UNIT_TEST_SUITE_COUNT (pci_mps);return cmd_ut_category ("pci_mps" ,"pci_mps_test_" , tests, n, argc, argv);
test/cmd/seama.c +3 -3
@@ -11,7 +11,7 @@#include <test/test.h> #include <test/ut.h> -#define SEAMA_TEST (_name, _flags) UNIT_TEST(_name, _flags, seama_test) +#define SEAMA_TEST (_name, _flags) UNIT_TEST(_name, _flags, seama)static int seama_test_noargs (struct unit_test_state *uts) {
@@ -59,8 +59,8 @@ SEAMA_TEST(seama_test_index, UTF_CONSOLE);int do_ut_seama (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (seama_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (seama_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (seama); +const int n_ents =UNIT_TEST_SUITE_COUNT (seama);return cmd_ut_category ("seama" ,"seama_test_" , tests, n_ents, argc, argv);
test/cmd/setexpr.c +3 -3
@@ -15,7 +15,7 @@#define BUF_SIZE 0x100/* Declare a new setexpr test */ -#define SETEXPR_TEST (_name, _flags) UNIT_TEST(_name, _flags, setexpr_test) +#define SETEXPR_TEST (_name, _flags) UNIT_TEST(_name, _flags, setexpr)/* Test 'setexpr' command with simply setting integers */ static int setexpr_test_int (struct unit_test_state *uts)
@@ -482,8 +482,8 @@ SETEXPR_TEST(setexpr_test_fmt, UTF_CONSOLE);int do_ut_setexpr (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (setexpr_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (setexpr_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (setexpr); +const int n_ents =UNIT_TEST_SUITE_COUNT (setexpr);return cmd_ut_category ("setexpr" ,"setexpr_test_" , tests, n_ents, argc, argv);
test/common/bloblist.c +3 -3
@@ -12,7 +12,7 @@/* Declare a new bloblist test */ #define BLOBLIST_TEST (_name, _flags) \ - UNIT_TEST(_name, _flags, bloblist_test) + UNIT_TEST(_name, _flags, bloblist)enum {TEST_TAG =BLOBLISTT_U_BOOT_SPL_HANDOFF ,
@@ -606,8 +606,8 @@ BLOBLIST_TEST(bloblist_test_blob_maxsize, UFT_BLOBLIST);int do_ut_bloblist (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (bloblist_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (bloblist_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (bloblist); +const int n_ents =UNIT_TEST_SUITE_COUNT (bloblist);return cmd_ut_category ("bloblist" ,"bloblist_test_" , tests, n_ents, argc, argv);
test/common/cmd_ut_common.c +2 -2
@@ -13,8 +13,8 @@int do_ut_common (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (common_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (common_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (common); +const int n_ents =UNIT_TEST_SUITE_COUNT (common);return cmd_ut_category ("common" ,"common_test_" , tests, n_ents, argc, argv);
test/dm/test-dm.c +2 -2
@@ -8,8 +8,8 @@int do_ut_dm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (dm_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (dm_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (dm); +const int n_ents =UNIT_TEST_SUITE_COUNT (dm);return cmd_ut_category ("dm" ,"dm_test_" , tests, n_ents, argc, argv); }
test/env/cmd_ut_env.c +2 -2
@@ -77,8 +77,8 @@ ENV_TEST(env_test_env_cmd, UTF_CONSOLE);int do_ut_env (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (env_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (env_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (env); +const int n_ents =UNIT_TEST_SUITE_COUNT (env);return cmd_ut_category ("env" ,"env_test_" , tests, n_ents, argc, argv); }
test/hush/cmd_ut_hush.c +2 -2
@@ -11,8 +11,8 @@int do_ut_hush (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (hush_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (hush_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (hush); +const int n_ents =UNIT_TEST_SUITE_COUNT (hush);return cmd_ut_category ("hush" ,"hush_test_" , tests, n_ents, argc, argv);
test/lib/cmd_ut_lib.c +2 -2
@@ -12,8 +12,8 @@int do_ut_lib (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (lib_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (lib_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (lib); +const int n_ents =UNIT_TEST_SUITE_COUNT (lib);return cmd_ut_category ("lib" ,"lib_test_" , tests, n_ents, argc, argv); }
test/log/log_ut.c +2 -2
@@ -12,8 +12,8 @@int do_ut_log (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (log_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (log_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (log); +const int n_ents =UNIT_TEST_SUITE_COUNT (log);return cmd_ut_category ("log" ,"log_test_" , tests, n_ents, argc, argv);
test/optee/cmd_ut_optee.c +2 -2
@@ -93,8 +93,8 @@ OPTEE_TEST(optee_fdt_protected_memory, 0);int do_ut_optee (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (optee_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (optee_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (optee); +const int n_ents =UNIT_TEST_SUITE_COUNT (optee);struct unit_test_state *uts;void *fdt_optee = &__dtb_test_optee_optee_begin;void *fdt_no_optee = &__dtb_test_optee_no_optee_begin;
test/overlay/cmd_ut_overlay.c +2 -2
@@ -212,8 +212,8 @@ OVERLAY_TEST(fdt_overlay_stacked, 0);int do_ut_overlay (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -struct unit_test *tests =UNIT_TEST_SUITE_START (overlay_test); -const int n_ents =UNIT_TEST_SUITE_COUNT (overlay_test); +struct unit_test *tests =UNIT_TEST_SUITE_START (overlay); +const int n_ents =UNIT_TEST_SUITE_COUNT (overlay);struct unit_test_state *uts;void *fdt_base = &__dtb_test_fdt_base_begin;void *fdt_overlay = &__dtbo_test_fdt_overlay_begin;
test/py/conftest.py +5 -2
@@ -33,6 +33,9 @@ console = None TEST_PY_DIR = os.path.dirname(os.path.abspath(__file__)) +# Regex for test-function symbols +RE_UT_TEST_LIST = re.compile(r'[^a-zA-Z0-9_]_u_boot_list_2_ut_(.*)_2_(.*)\s*$') + def mkdir_p(path): """Create a directory path.
@@ -341,7 +344,7 @@ def pytest_configure(config): import u_boot_console_exec_attach console = u_boot_console_exec_attach.ConsoleExecAttach(log, ubconfig) -re_ut_test_list = re.compile(r'[^a-zA-Z0-9_]_u_boot_list_2_ut_(.*)_test_2_(.*)\s*$') + def generate_ut_subtest(metafunc, fixture_name, sym_path): """Provide parametrization for a ut_subtest fixture.
@@ -368,7 +371,7 @@ def generate_ut_subtest(metafunc, fixture_name, sym_path): vals = [] for l in lines: - m = re_ut_test_list.search(l) + m = RE_UT_TEST_LIST.search(l) if not m: continue suite, name = m.groups()
Signature · 1 line
2.34.1
PATCH 11/43 test: Introduce a better array of test suites
In reply to Simon GlassThe current cmd_ut_sub[] array was fine when there were only a few test suites. But is quite unwieldy now:
- it requires a separate do_ut_xxx for each suite, even though the code for most is almost identical
- running more than one suite requires running multiple commands, and there is no record of which suites passed or failed
- 'ut all' runs all suites but reports their results individually
- we need lots of #ifdefs in the array, mirroring those in the makefile but maintained in a separate place
In fact the tests are all in the same linker list. The suites are grouped, so it is possible to access the information without a command.
Introduce a 'suite' array, which holds the cmd_ut_...() function to call, but can also support running a suite without that function. This means that the array of struct cmd_tbl is transformed into an array of 'struct suite'.
This will allow removal of many of the functions, particularly those without test-specific init.
---
include/test/suites.h | 4 + test/cmd_ut.c | 205 +++++++++++++++++++++++++++++++++--------- 2 files changed, 166 insertions(+), 43 deletions(-)
include/test/suites.h +4 -0
@@ -10,6 +10,10 @@struct cmd_tbl ;struct unit_test ; +/* 'command' functions normally called do_xxx where xxx is the command name */ +typedef int (*ut_cmd_func )(struct cmd_tbl *cmd,int flags,int argc, +char *const argv[]); +/** * cmd_ut_category() - Run a category of unit tests *
test/cmd_ut.c +162 -43
295 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 12/43 test: Drop the function for running bdinfo tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 1 - test/cmd/bdinfo.c | 8 -------- test/cmd_ut.c | 2 +- 3 files changed, 1 insertion(+), 10 deletions(-)
include/test/suites.h +0 -1
@@ -32,7 +32,6 @@ int cmd_ut_category(const char *name, const char *prefix,int do_ut_addrmap (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_bdinfo (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_bootm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_bootstd (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
test/cmd/bdinfo.c +0 -8
@@ -282,11 +282,3 @@ static int bdinfo_test_eth(struct unit_test_state *uts)return 0 ; }BDINFO_TEST (bdinfo_test_eth,UTF_CONSOLE ); - -int do_ut_bdinfo (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (bdinfo); -const int n_ents =UNIT_TEST_SUITE_COUNT (bdinfo); - -return cmd_ut_category ("bdinfo" ,"bdinfo_test_" , tests, n_ents, argc, argv); -}
test/cmd_ut.c +1 -1
@@ -123,7 +123,7 @@ SUITE_DECL(upl);static struct suite suites[] = {SUITE_CMD (info, do_ut_info), #ifdef CONFIG_CMD_BDI -SUITE_CMD (bdinfo, do_ut_bdinfo), +SUITE (bdinfo), #endif #ifdef CONFIG_UT_BOOTSTD SUITE_CMD(bootstd, do_ut_bootstd),
Signature · 1 line
2.34.1
PATCH 13/43 test: Drop the function for running cmd tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 1 - test/cmd/Makefile | 2 -- test/cmd/cmd_ut_cmd.c | 20 -------------------- test/cmd_ut.c | 2 +- 4 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 test/cmd/cmd_ut_cmd.c
include/test/suites.h +0 -1
@@ -37,7 +37,6 @@ int do_ut_bootstd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);int do_ut_bloblist (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_cmd (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_common (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_dm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_env (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
test/cmd/Makefile +0 -2
@@ -3,8 +3,6 @@ # Copyright (c) 2013 Google, Inc # Copyright 2022-2023 Arm Limited and/or its affiliates <[email protected]> -obj-y += cmd_ut_cmd.o - obj-$(CONFIG_$(XPL_)CMDLINE) += command.o ifdef CONFIG_HUSH_PARSER obj-$(CONFIG_CONSOLE_RECORD) += test_echo.o
test/cmd/cmd_ut_cmd.c deleted +0 -20
@@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* -* Copyright 2023 Google LLC -* Written by Simon Glass <[email protected]> -* -* Unit tests for command functions -*/ - -#include <command.h> -#include <test/cmd.h> -#include <test/suites.h> -#include <test/ut.h> - -int do_ut_cmd (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (cmd); -const int n_ents =UNIT_TEST_SUITE_COUNT (cmd); - -return cmd_ut_category ("cmd" ,"cmd_test_" , tests, n_ents, argc, argv); -}
test/cmd_ut.c +1 -1
@@ -129,7 +129,7 @@ static struct suite suites[] = { SUITE_CMD(bootstd, do_ut_bootstd),#endif #ifdef CONFIG_CMDLINE - SUITE_CMD(cmd, do_ut_cmd), + SUITE(cmd), #endif SUITE_CMD(common, do_ut_common),#if defined(CONFIG_UT_DM )
Signature · 1 line
2.34.1
PATCH 14/43 test: Drop the function for running common tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 1 - test/cmd_ut.c | 2 +- test/common/Makefile | 1 - test/common/cmd_ut_common.c | 21 --------------------- 4 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 test/common/cmd_ut_common.c
include/test/suites.h +0 -1
@@ -37,7 +37,6 @@ int do_ut_bootstd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);int do_ut_bloblist (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_common (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_dm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_env (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_exit (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
test/cmd_ut.c +1 -1
@@ -131,7 +131,7 @@ static struct suite suites[] = {#ifdef CONFIG_CMDLINE SUITE(cmd), #endif - SUITE_CMD(common, do_ut_common), + SUITE(common),#if defined(CONFIG_UT_DM ) SUITE_CMD(dm, do_ut_dm),#endif
test/common/Makefile +0 -1
@@ -1,5 +1,4 @@ # SPDX-License-Identifier: GPL-2.0+ -obj-y += cmd_ut_common.o obj-$(CONFIG_AUTOBOOT) += test_autoboot.o ifneq ($(CONFIG_$(XPL_)BLOBLIST),) obj-$(CONFIG_$(XPL_)CMDLINE) += bloblist.o
test/common/cmd_ut_common.c deleted +0 -21
@@ -1,21 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* -* Copyright (c) 2019 Heinrich Schuchardt <[email protected]> -* Copyright (c) 2021 Steffen Jaeckel <[email protected]> -* -* Unit tests for common functions -*/ - -#include <command.h> -#include <test/common.h> -#include <test/suites.h> -#include <test/ut.h> - -int do_ut_common (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (common); -const int n_ents =UNIT_TEST_SUITE_COUNT (common); - -return cmd_ut_category ("common" ,"common_test_" , tests, n_ents, argc, - argv); -}
Signature · 1 line
2.34.1
PATCH 15/43 test: Drop the function for running dm tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 1 - test/cmd_ut.c | 2 +- test/dm/Makefile | 2 -- test/dm/test-dm.c | 15 --------------- 4 files changed, 1 insertion(+), 19 deletions(-) delete mode 100644 test/dm/test-dm.c
include/test/suites.h +0 -1
@@ -37,7 +37,6 @@ int do_ut_bootstd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);int do_ut_bloblist (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_dm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_env (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_exit (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_fdt (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
test/cmd_ut.c +1 -1
@@ -133,7 +133,7 @@ static struct suite suites[] = {#endif SUITE(common),#if defined(CONFIG_UT_DM ) - SUITE_CMD(dm, do_ut_dm), + SUITE(dm),#endif #if defined(CONFIG_UT_ENV ) SUITE_CMD(env, do_ut_env),
test/dm/Makefile +0 -2
@@ -3,8 +3,6 @@ # Copyright (c) 2013 Google, Inc # Copyright 2022-2023 Arm Limited and/or its affiliates <[email protected]> -obj-$(CONFIG_UT_DM) += test-dm.o - # Tests for particular subsystems - when enabling driver model for a new # subsystem you must add sandbox tests here. ifeq ($(CONFIG_XPL_BUILD),y)
test/dm/test-dm.c deleted +0 -15
@@ -1,15 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* -* Copyright (c) 2013 Google, Inc -*/ - -#include <test/suites.h> -#include <test/test.h> - -int do_ut_dm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (dm); -const int n_ents =UNIT_TEST_SUITE_COUNT (dm); - -return cmd_ut_category ("dm" ,"dm_test_" , tests, n_ents, argc, argv); -}
Signature · 1 line
2.34.1
PATCH 16/43 test: Drop the function for running env tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 1 - test/cmd_ut.c | 2 +- test/env/cmd_ut_env.c | 9 --------- 3 files changed, 1 insertion(+), 11 deletions(-)
include/test/suites.h +0 -1
@@ -37,7 +37,6 @@ int do_ut_bootstd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);int do_ut_bloblist (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_env (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_exit (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_fdt (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_font (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
test/cmd_ut.c +1 -1
@@ -136,7 +136,7 @@ static struct suite suites[] = { SUITE(dm),#endif #if defined(CONFIG_UT_ENV ) -SUITE_CMD (env, do_ut_env), +SUITE (env), #endifSUITE_CMD (exit, do_ut_exit), #ifdef CONFIG_CMD_FDT
test/env/cmd_ut_env.c +0 -9
@@ -4,7 +4,6 @@* Joe Hershberger, National Instruments, [email protected] */ -#include <command.h> #include <test/env.h> #include <test/suites.h> #include <test/ut.h>
@@ -74,11 +73,3 @@ static int env_test_env_cmd(struct unit_test_state *uts)return 0 ; }ENV_TEST (env_test_env_cmd,UTF_CONSOLE ); - -int do_ut_env (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (env); -const int n_ents =UNIT_TEST_SUITE_COUNT (env); - -return cmd_ut_category ("env" ,"env_test_" , tests, n_ents, argc, argv); -}
Signature · 1 line
2.34.1
PATCH 17/43 test: Drop the function for running exit tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 1 - test/cmd/exit.c | 9 --------- test/cmd_ut.c | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-)
include/test/suites.h +0 -1
@@ -37,7 +37,6 @@ int do_ut_bootstd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);int do_ut_bloblist (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_exit (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_fdt (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_font (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_hush (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
test/cmd/exit.c +0 -9
@@ -110,12 +110,3 @@ static int cmd_exit_test(struct unit_test_state *uts)return 0 ; }EXIT_TEST (cmd_exit_test,UTF_CONSOLE ); - -int do_ut_exit (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (exit); -const int n_ents =UNIT_TEST_SUITE_COUNT (exit); - -return cmd_ut_category ("exit" ,"exit_test_" , tests, n_ents, - argc, argv); -}
test/cmd_ut.c +1 -1
@@ -138,7 +138,7 @@ static struct suite suites[] = {#if defined(CONFIG_UT_ENV ) SUITE(env), #endif - SUITE_CMD(exit, do_ut_exit), + SUITE(exit),#ifdef CONFIG_CMD_FDT SUITE_CMD(fdt, do_ut_fdt),#endif
Signature · 1 line
2.34.1
PATCH 18/43 test: Drop the function for running fdt tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 1 - test/cmd/fdt.c | 8 -------- test/cmd_ut.c | 2 +- 3 files changed, 1 insertion(+), 10 deletions(-)
include/test/suites.h +0 -1
@@ -37,7 +37,6 @@ int do_ut_bootstd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);int do_ut_bloblist (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_fdt (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_font (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_hush (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_lib (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
test/cmd/fdt.c +0 -8
@@ -1462,11 +1462,3 @@ static int fdt_test_apply(struct unit_test_state *uts)return 0 ; }FDT_TEST (fdt_test_apply,UTF_CONSOLE ); - -int do_ut_fdt (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (fdt); -const int n_ents =UNIT_TEST_SUITE_COUNT (fdt); - -return cmd_ut_category ("fdt" ,"fdt_test_" , tests, n_ents, argc, argv); -}
test/cmd_ut.c +1 -1
@@ -140,7 +140,7 @@ static struct suite suites[] = {#endif SUITE(exit),#ifdef CONFIG_CMD_FDT - SUITE_CMD(fdt, do_ut_fdt), + SUITE(fdt),#endif #ifdef CONFIG_CONSOLE_TRUETYPE SUITE_CMD(font, do_ut_font),
Signature · 1 line
2.34.1
PATCH 19/43 test: Drop the function for running font tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 1 - test/cmd/font.c | 8 -------- test/cmd_ut.c | 2 +- 3 files changed, 1 insertion(+), 10 deletions(-)
include/test/suites.h +0 -1
@@ -37,7 +37,6 @@ int do_ut_bootstd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);int do_ut_bloblist (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_font (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_hush (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_lib (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_loadm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
test/cmd/font.c +0 -8
@@ -85,11 +85,3 @@ static int font_test_base(struct unit_test_state *uts) }FONT_TEST (font_test_base,UTF_SCAN_PDATA |UTF_SCAN_FDT |UTF_CONSOLE |UTF_DM ); - -int do_ut_font (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (font); -const int n_ents =UNIT_TEST_SUITE_COUNT (font); - -return cmd_ut_category ("font" ,"font_test_" , tests, n_ents, argc, argv); -}
test/cmd_ut.c +1 -1
@@ -143,7 +143,7 @@ static struct suite suites[] = { SUITE(fdt),#endif #ifdef CONFIG_CONSOLE_TRUETYPE - SUITE_CMD(font, do_ut_font), + SUITE(font),#endif #ifdef CONFIG_UT_OPTEE SUITE_CMD(optee, do_ut_optee),
Signature · 1 line
2.34.1
PATCH 20/43 test: Drop the function for running lib tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 1 - test/cmd_ut.c | 2 +- test/lib/Makefile | 1 - test/lib/cmd_ut_lib.c | 19 ------------------- 4 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 test/lib/cmd_ut_lib.c
include/test/suites.h +0 -1
@@ -38,7 +38,6 @@ int do_ut_bootstd(struct cmd_tbl *cmdtp, int flag, int argc,int do_ut_bloblist (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_hush (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_lib (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_loadm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_log (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_mbr (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
test/cmd_ut.c +1 -1
@@ -152,7 +152,7 @@ static struct suite suites[] = { SUITE_CMD(overlay, do_ut_overlay),#endif #ifdef CONFIG_UT_LIB - SUITE_CMD(lib, do_ut_lib), + SUITE(lib),#endif #ifdef CONFIG_UT_LOG SUITE_CMD(log, do_ut_log),
test/lib/Makefile +0 -1
@@ -6,7 +6,6 @@ obj-$(CONFIG_$(XPL_)UT_COMPRESSION) += compression.o ifeq ($(CONFIG_XPL_BUILD),) -obj-y += cmd_ut_lib.o obj-y += abuf.o obj-y += alist.o obj-$(CONFIG_EFI_LOADER) += efi_device_path.o
test/lib/cmd_ut_lib.c deleted +0 -19
@@ -1,19 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* -* Copyright (c) 2019 Heinrich Schuchardt <[email protected]> -* -* Unit tests for library functions -*/ - -#include <command.h> -#include <test/lib.h> -#include <test/suites.h> -#include <test/ut.h> - -int do_ut_lib (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (lib); -const int n_ents =UNIT_TEST_SUITE_COUNT (lib); - -return cmd_ut_category ("lib" ,"lib_test_" , tests, n_ents, argc, argv); -}
Signature · 1 line
2.34.1
PATCH 21/43 test: Drop the function for running log tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 1 - test/cmd_ut.c | 2 +- test/log/Makefile | 2 -- test/log/log_ut.c | 20 -------------------- 4 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 test/log/log_ut.c
include/test/suites.h +0 -1
@@ -39,7 +39,6 @@ int do_ut_bloblist(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);int do_ut_hush (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_loadm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_log (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_mbr (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_measurement (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_mem (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
test/cmd_ut.c +1 -1
@@ -155,7 +155,7 @@ static struct suite suites[] = { SUITE(lib),#endif #ifdef CONFIG_UT_LOG - SUITE_CMD(log, do_ut_log), + SUITE(log),#endif #if defined(CONFIG_SANDBOX ) && defined(CONFIG_CMD_MBR ) && defined(CONFIG_CMD_MMC ) \ && defined(CONFIG_MMC_SANDBOX ) && defined(CONFIG_MMC_WRITE )
test/log/Makefile +0 -2
@@ -7,8 +7,6 @@ obj-$(CONFIG_CMD_LOG) += log_filter.o ifdef CONFIG_UT_LOG -obj-y += log_ut.o - ifdef CONFIG_SANDBOX obj-$(CONFIG_LOG_SYSLOG) += syslog_test.o obj-$(CONFIG_LOG_SYSLOG) += syslog_test_ndebug.o
test/log/log_ut.c deleted +0 -20
@@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* -* Copyright (c) 2020, Heinrich Schuchardt <[email protected]> -* -* Logging function tests. -*/ - -#include <console.h> -#include <log.h> -#include <test/log.h> -#include <test/suites.h> - -int do_ut_log (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (log); -const int n_ents =UNIT_TEST_SUITE_COUNT (log); - -return cmd_ut_category ("log" ,"log_test_" , - tests, n_ents, argc, argv); -}
Signature · 1 line
2.34.1
PATCH 22/43 test: Drop the function for running mbr tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 1 - test/cmd/mbr.c | 8 -------- test/cmd_ut.c | 2 +- 3 files changed, 1 insertion(+), 10 deletions(-)
include/test/suites.h +0 -1
@@ -39,7 +39,6 @@ int do_ut_bloblist(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);int do_ut_hush (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_loadm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_mbr (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_measurement (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_mem (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_optee (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
test/cmd/mbr.c +0 -8
@@ -471,11 +471,3 @@ static int mbr_test_run(struct unit_test_state *uts)/* Declare mbr test */ UNIT_TEST (mbr_test_run,UTF_CONSOLE , mbr); - -int do_ut_mbr (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (mbr); -const int n_ents =UNIT_TEST_SUITE_COUNT (mbr); - -return cmd_ut_category ("mbr" ,"mbr_test_" , tests, n_ents, argc, argv); -}
test/cmd_ut.c +1 -1
@@ -159,7 +159,7 @@ static struct suite suites[] = {#endif #if defined(CONFIG_SANDBOX ) && defined(CONFIG_CMD_MBR ) && defined(CONFIG_CMD_MMC ) \ && defined(CONFIG_MMC_SANDBOX ) && defined(CONFIG_MMC_WRITE ) - SUITE_CMD(mbr, do_ut_mbr), + SUITE(mbr), #endif SUITE_CMD(mem, do_ut_mem),#if defined(CONFIG_SANDBOX ) && defined(CONFIG_CMD_SETEXPR )
Signature · 1 line
2.34.1
PATCH 23/43 test: Drop the function for running mem tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 1 - test/cmd/Makefile | 2 +- test/cmd/mem.c | 19 ------------------- test/cmd_ut.c | 2 +- 4 files changed, 2 insertions(+), 22 deletions(-) delete mode 100644 test/cmd/mem.c
include/test/suites.h +0 -1
@@ -40,7 +40,6 @@ int do_ut_bloblist(struct cmd_tbl *cmdtp, int flag, int argc,int do_ut_hush (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_loadm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_measurement (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_mem (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_optee (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_overlay (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
test/cmd/Makefile +1 -1
@@ -10,7 +10,7 @@ endif ifdef CONFIG_CONSOLE_RECORD obj-$(CONFIG_CMD_PAUSE) += test_pause.o endif -obj-y += exit.o mem.o +obj-y += exit.o obj-$(CONFIG_X86) += cpuid.o msr.o obj-$(CONFIG_CMD_ADDRMAP) += addrmap.o obj-$(CONFIG_CMD_BDI) += bdinfo.o
test/cmd/mem.c deleted +0 -19
@@ -1,19 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* -* Executes tests for memory-related commands -* -* Copyright 2020 Google LLC -*/ - -#include <command.h> -#include <test/suites.h> -#include <test/test.h> - -int do_ut_mem (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (mem); -const int n_ents =UNIT_TEST_SUITE_COUNT (mem); - -return cmd_ut_category ("mem" ,"mem_test_" , tests, n_ents, argc, - argv); -}
test/cmd_ut.c +1 -1
@@ -161,7 +161,7 @@ static struct suite suites[] = { && defined(CONFIG_MMC_SANDBOX) && defined(CONFIG_MMC_WRITE) SUITE(mbr), #endif - SUITE_CMD(mem, do_ut_mem), + SUITE(mem),#if defined(CONFIG_SANDBOX ) && defined(CONFIG_CMD_SETEXPR ) SUITE_CMD(setexpr, do_ut_setexpr),#endif
Signature · 1 line
2.34.1
PATCH 24/43 test: Drop the function for running setexpr tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 2 -- test/cmd/setexpr.c | 9 --------- test/cmd_ut.c | 2 +- 3 files changed, 1 insertion(+), 12 deletions(-)
include/test/suites.h +0 -2
@@ -46,8 +46,6 @@ int do_ut_overlay(struct cmd_tbl *cmdtp, int flag, int argc,int do_ut_pci_mps (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_seama (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_setexpr (struct cmd_tbl *cmdtp,int flag,int argc, -char *const argv[]);int do_ut_upl (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);#endif /* __TEST_SUITES_H__ */
test/cmd/setexpr.c +0 -9
@@ -479,12 +479,3 @@ static int setexpr_test_fmt(struct unit_test_state *uts) }SETEXPR_TEST (setexpr_test_fmt,UTF_CONSOLE );#endif - -int do_ut_setexpr (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (setexpr); -const int n_ents =UNIT_TEST_SUITE_COUNT (setexpr); - -return cmd_ut_category ("setexpr" ,"setexpr_test_" , tests, n_ents, - argc, argv); -}
test/cmd_ut.c +1 -1
@@ -163,7 +163,7 @@ static struct suite suites[] = {#endif SUITE(mem),#if defined(CONFIG_SANDBOX ) && defined(CONFIG_CMD_SETEXPR ) - SUITE_CMD(setexpr, do_ut_setexpr), + SUITE(setexpr),#endif #ifdef CONFIG_MEASURED_BOOT SUITE_CMD(measurement, do_ut_measurement),
Signature · 1 line
2.34.1
PATCH 25/43 test: Drop the function for running measurement tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 1 - test/boot/measurement.c | 10 ---------- test/cmd_ut.c | 2 +- 3 files changed, 1 insertion(+), 12 deletions(-)
include/test/suites.h +0 -1
@@ -39,7 +39,6 @@ int do_ut_bloblist(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);int do_ut_hush (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_loadm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_measurement (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_optee (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_overlay (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
test/boot/measurement.c +0 -10
@@ -53,13 +53,3 @@ static int measure(struct unit_test_state *uts)return 0 ; }MEASUREMENT_TEST (measure,0 ); - -int do_ut_measurement (struct cmd_tbl *cmdtp,int flag,int argc, -char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (measurement); -const int n_ents =UNIT_TEST_SUITE_COUNT (measurement); - -return cmd_ut_category ("measurement" ,"measurement_test_" , tests, - n_ents, argc, argv); -}
test/cmd_ut.c +1 -1
@@ -166,7 +166,7 @@ static struct suite suites[] = { SUITE(setexpr),#endif #ifdef CONFIG_MEASURED_BOOT - SUITE_CMD(measurement, do_ut_measurement), + SUITE(measurement),#endif #ifdef CONFIG_SANDBOX SUITE_CMD(bloblist, do_ut_bloblist),
Signature · 1 line
2.34.1
PATCH 26/43 test: Drop the function for running bloblist tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 2 -- test/cmd_ut.c | 2 +- test/common/bloblist.c | 10 ---------- 3 files changed, 1 insertion(+), 13 deletions(-)
include/test/suites.h +0 -2
@@ -35,8 +35,6 @@ int do_ut_addrmap(struct cmd_tbl *cmdtp, int flag, int argc,int do_ut_bootm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_bootstd (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_bloblist (struct cmd_tbl *cmdtp,int flag,int argc, -char *const argv[]);int do_ut_hush (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_loadm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_optee (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
test/cmd_ut.c +1 -1
@@ -169,7 +169,7 @@ static struct suite suites[] = { SUITE(measurement),#endif #ifdef CONFIG_SANDBOX -SUITE_CMD (bloblist, do_ut_bloblist), +SUITE (bloblist),SUITE_CMD (bootm, do_ut_bootm), #endif #ifdef CONFIG_CMD_ADDRMAP
test/common/bloblist.c +0 -10
@@ -602,13 +602,3 @@ static int bloblist_test_blob_maxsize(struct unit_test_state *uts)return 0 ; }BLOBLIST_TEST (bloblist_test_blob_maxsize,UFT_BLOBLIST ); - -int do_ut_bloblist (struct cmd_tbl *cmdtp,int flag,int argc, -char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (bloblist); -const int n_ents =UNIT_TEST_SUITE_COUNT (bloblist); - -return cmd_ut_category ("bloblist" ,"bloblist_test_" , - tests, n_ents, argc, argv); -}
Signature · 1 line
2.34.1
PATCH 27/43 test: Drop the function for running bootm tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 1 - test/boot/bootm.c | 9 --------- test/cmd_ut.c | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-)
include/test/suites.h +0 -1
@@ -32,7 +32,6 @@ int cmd_ut_category(const char *name, const char *prefix,int do_ut_addrmap (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_bootm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_bootstd (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_hush (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
test/boot/bootm.c +0 -9
@@ -256,12 +256,3 @@ static int bootm_test_subst_both(struct unit_test_state *uts)return 0 ; }BOOTM_TEST (bootm_test_subst_both,0 ); - -int do_ut_bootm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (bootm); -const int n_ents =UNIT_TEST_SUITE_COUNT (bootm); - -return cmd_ut_category ("bootm" ,"bootm_test_" , tests, n_ents, - argc, argv); -}
test/cmd_ut.c +1 -1
@@ -170,7 +170,7 @@ static struct suite suites[] = {#endif #ifdef CONFIG_SANDBOX SUITE(bloblist), - SUITE_CMD(bootm, do_ut_bootm), + SUITE(bootm),#endif #ifdef CONFIG_CMD_ADDRMAP SUITE_CMD(addrmap, do_ut_addrmap),
Signature · 1 line
2.34.1
PATCH 28/43 test: Drop the function for running addrmap tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 2 -- test/cmd/addrmap.c | 9 --------- test/cmd_ut.c | 2 +- 3 files changed, 1 insertion(+), 12 deletions(-)
include/test/suites.h +0 -2
@@ -30,8 +30,6 @@ int cmd_ut_category(const char *name, const char *prefix, struct unit_test *tests, int n_ents, int argc, char *const argv[]); -int do_ut_addrmap (struct cmd_tbl *cmdtp,int flag,int argc, -char *const argv[]);int do_ut_bootstd (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_hush (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
test/cmd/addrmap.c +0 -9
@@ -24,12 +24,3 @@ static int addrmap_test_basic(struct unit_test_state *uts)return 0 ; }ADDRMAP_TEST (addrmap_test_basic,UTF_CONSOLE ); - -int do_ut_addrmap (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (addrmap); -const int n_ents =UNIT_TEST_SUITE_COUNT (addrmap); - -return cmd_ut_category ("addrmap" ,"cmd_addrmap_" , tests, n_ents, - argc, argv); -}
test/cmd_ut.c +1 -1
@@ -173,7 +173,7 @@ static struct suite suites[] = { SUITE(bootm),#endif #ifdef CONFIG_CMD_ADDRMAP - SUITE_CMD(addrmap, do_ut_addrmap), + SUITE(addrmap),#endif #if CONFIG_IS_ENABLED (HUSH_PARSER ) SUITE_CMD(hush, do_ut_hush),
Signature · 1 line
2.34.1
PATCH 29/43 test: Drop the function for running hush tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 1 - test/cmd_ut.c | 2 +- test/hush/Makefile | 1 - test/hush/cmd_ut_hush.c | 19 ------------------- 4 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 test/hush/cmd_ut_hush.c
include/test/suites.h +0 -1
@@ -32,7 +32,6 @@ int cmd_ut_category(const char *name, const char *prefix,int do_ut_bootstd (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_hush (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_loadm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_optee (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); int do_ut_overlay(struct cmd_tbl *cmdtp, int flag, int argc,
test/cmd_ut.c +1 -1
@@ -176,7 +176,7 @@ static struct suite suites[] = { SUITE(addrmap),#endif #if CONFIG_IS_ENABLED (HUSH_PARSER ) - SUITE_CMD(hush, do_ut_hush), + SUITE(hush),#endif #ifdef CONFIG_CMD_LOADM SUITE_CMD(loadm, do_ut_loadm),
test/hush/Makefile +0 -1
@@ -3,7 +3,6 @@ # (C) Copyright 2021 # Francis Laniel, Amarula Solutions, [email protected] -obj-y += cmd_ut_hush.o obj-y += if.o ifdef CONFIG_CONSOLE_RECORD obj-y += dollar.o
test/hush/cmd_ut_hush.c deleted +0 -19
@@ -1,19 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* -* (C) Copyright 2021 -* Francis Laniel, Amarula Solutions, [email protected] -*/ - -#include <command.h> -#include <test/hush.h> -#include <test/suites.h> -#include <test/ut.h> - -int do_ut_hush (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (hush); -const int n_ents =UNIT_TEST_SUITE_COUNT (hush); - -return cmd_ut_category ("hush" ,"hush_test_" , - tests, n_ents, argc, argv); -}
Signature · 1 line
2.34.1
PATCH 30/43 test: Drop the function for running loadm tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 1 - test/cmd/loadm.c | 9 --------- test/cmd_ut.c | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-)
include/test/suites.h +0 -1
@@ -32,7 +32,6 @@ int cmd_ut_category(const char *name, const char *prefix,int do_ut_bootstd (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_loadm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_optee (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_overlay (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
test/cmd/loadm.c +0 -9
@@ -58,12 +58,3 @@ static int loadm_test_load (struct unit_test_state *uts)return 0 ; }LOADM_TEST (loadm_test_load,UTF_CONSOLE ); - -int do_ut_loadm (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (loadm); -const int n_ents =UNIT_TEST_SUITE_COUNT (loadm); - -return cmd_ut_category ("loadm" ,"loadm_test_" , tests, n_ents, argc, - argv); -}
test/cmd_ut.c +1 -1
@@ -179,7 +179,7 @@ static struct suite suites[] = { SUITE(hush),#endif #ifdef CONFIG_CMD_LOADM - SUITE_CMD(loadm, do_ut_loadm), + SUITE(loadm),#endif #ifdef CONFIG_CMD_PCI_MPS SUITE_CMD(pci_mps, do_ut_pci_mps),
Signature · 1 line
2.34.1
PATCH 31/43 test: Drop the function for running pci_mps tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
---
include/test/suites.h | 2 -- test/cmd/pci_mps.c | 10 ---------- test/cmd_ut.c | 2 +- 3 files changed, 1 insertion(+), 13 deletions(-)
include/test/suites.h +0 -2
@@ -35,8 +35,6 @@ int do_ut_bootstd(struct cmd_tbl *cmdtp, int flag, int argc,int do_ut_optee (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_overlay (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_pci_mps (struct cmd_tbl *cmdtp,int flag,int argc, -char *const argv[]);int do_ut_seama (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_upl (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);
test/cmd/pci_mps.c +0 -10
@@ -28,13 +28,3 @@ static int test_pci_mps_safe(struct unit_test_state *uts)return 0 ; }PCI_MPS_TEST (test_pci_mps_safe,UTF_CONSOLE ); - -int do_ut_pci_mps (struct cmd_tbl *cmdtp,int flag,int argc, -char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (pci_mps); -const int n =UNIT_TEST_SUITE_COUNT (pci_mps); - -return cmd_ut_category ("pci_mps" ,"pci_mps_test_" , tests, n, - argc, argv); -}
test/cmd_ut.c +1 -1
@@ -182,7 +182,7 @@ static struct suite suites[] = { SUITE(loadm),#endif #ifdef CONFIG_CMD_PCI_MPS - SUITE_CMD(pci_mps, do_ut_pci_mps), + SUITE(pci_mps),#endif #ifdef CONFIG_CMD_SEAMA SUITE_CMD(seama, do_ut_seama),
Signature · 1 line
2.34.1
PATCH 32/43 test: Drop the function for running seama tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
It is not clear that these actually work, since they are not enabled on sandbox for some reason.
---
include/test/suites.h | 1 - test/cmd/seama.c | 9 --------- test/cmd_ut.c | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-)
include/test/suites.h +0 -1
@@ -35,7 +35,6 @@ int do_ut_bootstd(struct cmd_tbl *cmdtp, int flag, int argc,int do_ut_optee (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_overlay (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_seama (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_upl (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);#endif /* __TEST_SUITES_H__ */
test/cmd/seama.c +0 -9
@@ -56,12 +56,3 @@ static int seama_test_index(struct unit_test_state *uts)return 0 ; }SEAMA_TEST (seama_test_index,UTF_CONSOLE ); - -int do_ut_seama (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (seama); -const int n_ents =UNIT_TEST_SUITE_COUNT (seama); - -return cmd_ut_category ("seama" ,"seama_test_" , tests, n_ents, argc, - argv); -}
test/cmd_ut.c +1 -1
@@ -185,7 +185,7 @@ static struct suite suites[] = { SUITE(pci_mps),#endif #ifdef CONFIG_CMD_SEAMA - SUITE_CMD(seama, do_ut_seama), + SUITE(seama),#endif #ifdef CONFIG_CMD_UPL SUITE_CMD(upl, do_ut_upl),
Signature · 1 line
2.34.1
PATCH 33/43 test: Drop the function for running upl tests
In reply to Simon GlassUse the new suite-runner to run these tests instead.
It is not clear that these actually work, since they are not enabled on sandbox for some reason.
---
include/test/suites.h | 1 - test/boot/upl.c | 8 -------- test/cmd_ut.c | 2 +- 3 files changed, 1 insertion(+), 10 deletions(-)
include/test/suites.h +0 -1
@@ -35,6 +35,5 @@ int do_ut_bootstd(struct cmd_tbl *cmdtp, int flag, int argc,int do_ut_optee (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);int do_ut_overlay (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_upl (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]);#endif /* __TEST_SUITES_H__ */
test/boot/upl.c +0 -8
@@ -426,11 +426,3 @@ static int upl_test_info_norun(struct unit_test_state *uts)return 0 ; }UPL_TEST (upl_test_info_norun,UTF_CONSOLE |UTF_MANUAL ); - -int do_ut_upl (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) -{ -struct unit_test *tests =UNIT_TEST_SUITE_START (upl); -const int n_ents =UNIT_TEST_SUITE_COUNT (upl); - -return cmd_ut_category ("upl" ,"cmd_upl_" , tests, n_ents, argc, argv); -}
test/cmd_ut.c +1 -1
@@ -188,7 +188,7 @@ static struct suite suites[] = { SUITE(seama),#endif #ifdef CONFIG_CMD_UPL - SUITE_CMD(upl, do_ut_upl), + SUITE(upl),#endif };
Signature · 1 line
2.34.1
PATCH 34/43 test: Drop the info test from the list
In reply to Simon GlassThe 'info' test is not a real test. With the new suite array we can drop this and the associated special-case code.
---
test/cmd_ut.c | 4 +--- test/py/tests/test_suite.py | 13 +++++-------- 2 files changed, 6 insertions(+), 11 deletions(-)
test/cmd_ut.c +1 -3
@@ -93,7 +93,6 @@ int cmd_ut_category(const char *name, const char *prefix,NULL , \ } -SUITE_DECL (info);SUITE_DECL (bdinfo);SUITE_DECL (bootstd);SUITE_DECL (cmd);
@@ -121,7 +120,6 @@ SUITE_DECL(seama);SUITE_DECL (upl); static struct suite suites[] = { -SUITE_CMD (info, do_ut_info),#ifdef CONFIG_CMD_BDI SUITE(bdinfo),#endif
@@ -247,7 +245,7 @@ static int do_ut_info(struct cmd_tbl *cmdtp, int flag, int argc,puts ("\nTests Suite\n" );puts ("----- -----\n" ); -for (i =1 ; i <ARRAY_SIZE (suites); i++) { +for (i =0 ; i <ARRAY_SIZE (suites); i++) {struct suite *ste = &suites[i];long n_ent = ste->end - ste->start;
test/py/tests/test_suite.py +5 -8
@@ -8,7 +8,7 @@ import re EXPECTED_SUITES = [ 'addrmap', 'bdinfo', 'bloblist', 'bootm', 'bootstd', 'cmd', 'common', 'dm', 'env', 'exit', - 'fdt', 'font', 'hush', 'info', 'lib', + 'fdt', 'font', 'hush', 'lib', 'loadm', 'log', 'mbr', 'measurement', 'mem', 'overlay', 'pci_mps', 'setexpr', 'upl', ]
@@ -145,9 +145,8 @@ def test_suite(u_boot_console): suites, all_tests, exp_test_count, missing, extra = collect_info(cons, output) - # Make sure we got a test count for each suite (ignore 'info' since it isn't - # a real suite - assert suites - exp_test_count.keys() == {'info'} + # Make sure we got a test count for each suite + assert suites - exp_test_count.keys() == set() # Run 'ut info' and compare with the log results with cons.log.section('Check suite test-counts'):
@@ -166,10 +165,8 @@ def test_suite(u_boot_console): cons.log.info(str(exp_test_count)) for suite in EXPECTED_SUITES: - # 'info' is not really a suite, just a subcommand of 'ut' - if suite != 'info': - assert test_count[suite] in ['?', str(exp_test_count[suite])],\ - f'suite {suite} expected {exp_test_count[suite]}' + assert test_count[suite] in ['?', str(exp_test_count[suite])], \ + f'suite {suite} expected {exp_test_count[suite]}' assert suite_count == len(EXPECTED_SUITES) assert total_test_count == len(all_tests)
Signature · 1 line
2.34.1
PATCH 35/43 test: Drop conditional compilation for suites
In reply to Simon GlassThis is not needed anymore. If a test suite is not built, then it will have no linker-list entries. So we can just check for that and know that the suite is not present.
This allows removal of the #ifdefs and the need to keep them in sync with the associated Makefile rules, which has actually failed, since the help does not match what commands are actually present.
---
test/cmd_ut.c | 75 ++++++++++++++++--------------------- test/py/tests/test_suite.py | 19 +++++++--- 2 files changed, 46 insertions(+), 48 deletions(-)
test/cmd_ut.c +32 -43
@@ -120,76 +120,55 @@ SUITE_DECL(seama);SUITE_DECL (upl);static struct suite suites[] = { -#ifdef CONFIG_CMD_BDI SUITE (bdinfo), -#endif #ifdef CONFIG_UT_BOOTSTDSUITE_CMD (bootstd, do_ut_bootstd), #endif -#ifdef CONFIG_CMDLINESUITE (cmd), -#endifSUITE (common), -#if defined(CONFIG_UT_DM)SUITE (dm), -#endif -#if defined(CONFIG_UT_ENV)SUITE (env), -#endifSUITE (exit), -#ifdef CONFIG_CMD_FDTSUITE (fdt), -#endif -#ifdef CONFIG_CONSOLE_TRUETYPESUITE (font), -#endif #ifdef CONFIG_UT_OPTEESUITE_CMD (optee, do_ut_optee), #endif #ifdef CONFIG_UT_OVERLAYSUITE_CMD (overlay, do_ut_overlay), #endif -#ifdef CONFIG_UT_LIBSUITE (lib), -#endif -#ifdef CONFIG_UT_LOGSUITE (log), -#endif -#if defined(CONFIG_SANDBOX) && defined(CONFIG_CMD_MBR) && defined(CONFIG_CMD_MMC) \ - && defined(CONFIG_MMC_SANDBOX) && defined(CONFIG_MMC_WRITE)SUITE (mbr), -#endifSUITE (mem), -#if defined(CONFIG_SANDBOX) && defined(CONFIG_CMD_SETEXPR)SUITE (setexpr), -#endif -#ifdef CONFIG_MEASURED_BOOTSUITE (measurement), -#endif -#ifdef CONFIG_SANDBOXSUITE (bloblist),SUITE (bootm), -#endif -#ifdef CONFIG_CMD_ADDRMAPSUITE (addrmap), -#endif -#if CONFIG_IS_ENABLED(HUSH_PARSER)SUITE (hush), -#endif -#ifdef CONFIG_CMD_LOADMSUITE (loadm), -#endif -#ifdef CONFIG_CMD_PCI_MPSSUITE (pci_mps), -#endif -#ifdef CONFIG_CMD_SEAMASUITE (seama), -#endif -#ifdef CONFIG_CMD_UPLSUITE (upl), -#endif }; +/** +* has_tests() - Check if a suite has tests, i.e. is supported in this build +* +* If the suite is run using a command, we have to assume that tests may be +* present, since we have no visibility +* +* @ste: Suite to check +* Return: true if supported, false if not +*/ +static bool has_tests (struct suite *ste) +{ +int n_ents = ste->end - ste->start; + +return n_ents || ste->cmd; +} +/** run_suite() - Run a suite of tests */ static int run_suite (struct suite *ste,struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[])
@@ -222,10 +201,12 @@ static int do_ut_all(struct cmd_tbl *cmdtp, int flag, int argc,struct suite *ste = &suites[i];char *const argv[] = {(char *)ste->name,NULL }; -printf ("----Running %s tests----\n" , ste->name); - retval =run_suite (ste, cmdtp, flag,1 , argv); -if (!any_fail) - any_fail = retval; +if (has_tests (ste)) { +printf ("----Running %s tests----\n" , ste->name); + retval =run_suite (ste, cmdtp, flag,1 , argv); +if (!any_fail) + any_fail = retval; + } }return any_fail;
@@ -234,9 +215,17 @@ static int do_ut_all(struct cmd_tbl *cmdtp, int flag, int argc,static int do_ut_info (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { +int suite_count, i;const char *flags; -printf ("Test suites: %d\n" , (int )ARRAY_SIZE (suites)); +for (suite_count =0 , i =0 ; i <ARRAY_SIZE (suites); i++) { +struct suite *ste = &suites[i]; + +if (has_tests (ste)) + suite_count++; + } + +printf ("Test suites: %d\n" , suite_count);printf ("Total tests: %d\n" , (int )UNIT_TEST_ALL_COUNT ()); flags =cmd_arg1 (argc, argv);
@@ -251,7 +240,7 @@ static int do_ut_info(struct cmd_tbl *cmdtp, int flag, int argc,if (n_ent)printf ("%5ld %s\n" , n_ent, ste->name); -else +else if (ste->cmd)printf ("%5s %s\n" ,"?" , ste->name); } }
test/py/tests/test_suite.py +14 -5
@@ -106,7 +106,7 @@ def process_ut_info(cons, output): test_count = {} for line in output.splitlines(): if DEBUG_ME: - cons.log.info(f'line: {line}') + cons.log.info(f'line: {line.rstrip()}') m = re.match(r'Test suites: (.*)', line) if m: suite_count = int(m.group(1))
@@ -122,7 +122,7 @@ def process_ut_info(cons, output): @pytest.mark.buildconfigspec('sandbox') @pytest.mark.notbuildconfigspec('sandbox_spl') @pytest.mark.notbuildconfigspec('sandbox64') -def test_suite(u_boot_console): +def test_suite(u_boot_console, u_boot_config): """Perform various checks on the unit tests, including: - The number of suites matches that reported by the 'ut info'
@@ -135,6 +135,7 @@ def test_suite(u_boot_console): """ cons = u_boot_console + buildconfig = u_boot_config.buildconfig with cons.log.section('Run all unit tests'): # ut hush hush_test_simple_dollar prints "Unknown command" on purpose. with u_boot_console.disable_check('unknown_command'):
@@ -144,9 +145,17 @@ def test_suite(u_boot_console): with cons.log.section('Check output'): suites, all_tests, exp_test_count, missing, extra = collect_info(cons, output) + cons.log.info(f'missing {missing}') + cons.log.info(f'extra {extra}') # Make sure we got a test count for each suite - assert suites - exp_test_count.keys() == set() + assert not (suites - exp_test_count.keys()) + + # Deal with missing suites + with cons.log.section('Check missing suites'): + if 'config_cmd_seama' not in buildconfig: + cons.log.info("CMD_SEAMA not enabled: Ignoring suite 'seama'") + missing.discard('seama') # Run 'ut info' and compare with the log results with cons.log.section('Check suite test-counts'):
@@ -160,8 +169,8 @@ def test_suite(u_boot_console): cons.log.error(f'missing: {sorted(list(missing))}') cons.log.error(f'extra: {sorted(list(extra))}') - assert not missing - assert not extra + assert not missing, f'Missing suites {missing}' + assert not extra, f'Extra suites {extra}' cons.log.info(str(exp_test_count)) for suite in EXPECTED_SUITES:
Signature · 1 line
2.34.1
PATCH 36/43 test: Pass the test state to cmd_ut_category()
In reply to Simon GlassUpdate this function to access a unit-test state, so that the caller can collect results from running multiple suites.
---
include/test/suites.h | 20 +++++++++++-------- test/boot/bootstd_common.c | 7 ++++--- test/cmd_ut.c | 37 ++++++++++++++++++----------------- test/overlay/cmd_ut_overlay.c | 10 +++------- 4 files changed, 38 insertions(+), 36 deletions(-)
include/test/suites.h +12 -8
@@ -9,14 +9,18 @@struct cmd_tbl ;struct unit_test ; +struct unit_test_state ;/* 'command' functions normally called do_xxx where xxx is the command name */ -typedef int (*ut_cmd_func )(struct cmd_tbl *cmd,int flags,int argc, -char *const argv[]); +typedef int (*ut_cmd_func )(struct unit_test_state *uts,struct cmd_tbl *cmd, +int flags,int argc,char *const argv[]);/** * cmd_ut_category() - Run a category of unit tests * +* @uts: Unit-test state, which must be ready for use, i.e. ut_init_state() +* has been called. The caller is responsible for calling +* ut_uninit_state() after this function returns * @name: Category name * @prefix: Prefix of test name * @tests: List of tests to run
@@ -26,14 +30,14 @@ typedef int (*ut_cmd_func)(struct cmd_tbl *cmd, int flags, int argc,* @argv: Arguments: argv[1] is the test to run (if @argc >= 2) * Return: 0 if OK, CMD_RET_FAILURE on failure */ -int cmd_ut_category (const char *name,const char *prefix, -struct unit_test *tests,int n_ents, +int cmd_ut_category (struct unit_test_state *uts,const char *name, +const char *prefix,struct unit_test *tests,int n_ents,int argc,char *const argv[]); -int do_ut_bootstd (struct cmd_tbl *cmdtp,int flag,int argc, -char *const argv[]); +int do_ut_bootstd (struct unit_test_state *uts,struct cmd_tbl *cmdtp,int flag, +int argc,char *const argv[]);int do_ut_optee (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int do_ut_overlay (struct cmd_tbl *cmdtp,int flag,int argc, -char *const argv[]); +int do_ut_overlay (struct unit_test_state *uts,struct cmd_tbl *cmdtp,int flag, +int argc,char *const argv[]);#endif /* __TEST_SUITES_H__ */
test/boot/bootstd_common.c +4 -3
@@ -94,7 +94,8 @@ void bootstd_reset_usb(void) usb_started = false; } -int do_ut_bootstd (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) +int do_ut_bootstd (struct unit_test_state *uts,struct cmd_tbl *cmdtp,int flag, +int argc,char *const argv[]) {struct unit_test *tests =UNIT_TEST_SUITE_START (bootstd);const int n_ents =UNIT_TEST_SUITE_COUNT (bootstd);
@@ -106,6 +107,6 @@ int do_ut_bootstd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])return CMD_RET_FAILURE ; } -return cmd_ut_category ("bootstd" ,"bootstd_" , tests, n_ents, - argc, argv); +return cmd_ut_category (uts,"bootstd" ,"bootstd_" , + tests, n_ents, argc, argv); }
test/cmd_ut.c +19 -18
@@ -29,17 +29,16 @@ struct suite {ut_cmd_func cmd; }; -static int do_ut_all (struct cmd_tbl *cmdtp,int flag,int argc, -char *const argv[]); +static int do_ut_all (struct unit_test_state *uts,struct cmd_tbl *cmdtp, +int flag,int argc,char *const argv[]);static int do_ut_info (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]); -int cmd_ut_category (const char *name,const char *prefix, -struct unit_test *tests,int n_ents, +int cmd_ut_category (struct unit_test_state *uts,const char *name, +const char *prefix,struct unit_test *tests,int n_ents,int argc,char *const argv[]) { -struct unit_test_state uts;const char *test_insert =NULL ;int runs_per_text =1 ;bool force_run = false;
@@ -63,11 +62,9 @@ int cmd_ut_category(const char *name, const char *prefix, argc--; } -ut_init_state (&uts); - ret =ut_run_list (&uts, name, prefix, tests, n_ents, + ret =ut_run_list (uts, name, prefix, tests, n_ents,cmd_arg1 (argc, argv), runs_per_text, force_run, test_insert); -ut_uninit_state (&uts);return ret ?CMD_RET_FAILURE :0 ; }
@@ -170,28 +167,29 @@ static bool has_tests(struct suite *ste) }/** run_suite() - Run a suite of tests */ -static int run_suite (struct suite *ste,struct cmd_tbl *cmdtp,int flag, -int argc,char *const argv[]) +static int run_suite (struct unit_test_state *uts,struct suite *ste, +struct cmd_tbl *cmdtp,int flag,int argc, +char *const argv[]) {int ret;if (ste->cmd) { - ret = ste->cmd (cmdtp, flag, argc, argv); + ret = ste->cmd (uts, cmdtp, flag, argc, argv); }else {int n_ents = ste->end - ste->start;char prefix[30 ];/* use a standard prefix */ snprintf (prefix,sizeof (prefix),"%s_test" , ste->name); - ret =cmd_ut_category (ste->name, prefix, ste->start, n_ents, - argc, argv); + ret =cmd_ut_category (uts, ste->name, prefix, ste->start, + n_ents, argc, argv); }return ret; } -static int do_ut_all (struct cmd_tbl *cmdtp,int flag,int argc, -char *const argv[]) +static int do_ut_all (struct unit_test_state *uts,struct cmd_tbl *cmdtp, +int flag,int argc,char *const argv[]) {int i;int retval;
@@ -203,7 +201,7 @@ static int do_ut_all(struct cmd_tbl *cmdtp, int flag, int argc,if (has_tests (ste)) {printf ("----Running %s tests----\n" , ste->name); - retval =run_suite (ste, cmdtp, flag,1 , argv); + retval =run_suite (uts, ste, cmdtp, flag,1 , argv);if (!any_fail) any_fail = retval; }
@@ -263,6 +261,7 @@ static struct suite *find_suite(const char *name)static int do_ut (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { +struct unit_test_state uts;struct suite *ste;const char *name;int ret;
@@ -274,9 +273,10 @@ static int do_ut(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) argc--; argv++; +ut_init_state (&uts); name = argv[0 ];if (!strcmp (name,"all" )) { - ret =do_ut_all (cmdtp, flag, argc, argv); + ret =do_ut_all (&uts, cmdtp, flag, argc, argv); }else if (!strcmp (name,"info" )) { ret =do_ut_info (cmdtp, flag, argc, argv); }else {
@@ -286,10 +286,11 @@ static int do_ut(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])return CMD_RET_FAILURE ; } - ret =run_suite (ste, cmdtp, flag, argc, argv); + ret =run_suite (&uts, ste, cmdtp, flag, argc, argv); }if (ret)return ret; +ut_uninit_state (&uts);return 0 ; }
test/overlay/cmd_ut_overlay.c +3 -7
@@ -210,21 +210,17 @@ static int fdt_overlay_stacked(struct unit_test_state *uts) }OVERLAY_TEST (fdt_overlay_stacked,0 ); -int do_ut_overlay (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) +int do_ut_overlay (struct unit_test_state *uts,struct cmd_tbl *cmdtp,int flag, +int argc,char *const argv[]) {struct unit_test *tests =UNIT_TEST_SUITE_START (overlay);const int n_ents =UNIT_TEST_SUITE_COUNT (overlay); -struct unit_test_state *uts;void *fdt_base = &__dtb_test_fdt_base_begin;void *fdt_overlay = &__dtbo_test_fdt_overlay_begin;void *fdt_overlay_stacked = &__dtbo_test_fdt_overlay_stacked_begin;void *fdt_overlay_copy, *fdt_overlay_stacked_copy;int ret = -ENOMEM ; - uts =calloc (1 ,sizeof (*uts)); -if (!uts) -return -ENOMEM ; -ut_assertok (fdt_check_header (fdt_base));ut_assertok (fdt_check_header (fdt_overlay));
@@ -272,7 +268,7 @@ int do_ut_overlay(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])/* Apply the stacked overlay */ ut_assertok (fdt_overlay_apply (fdt, fdt_overlay_stacked_copy)); - ret =cmd_ut_category ("overlay" ,"" , tests, n_ents, argc, argv); + ret =cmd_ut_category (uts,"overlay" ,"" , tests, n_ents, argc, argv);free (fdt_overlay_stacked_copy); err3:
Signature · 1 line
2.34.1
PATCH 37/43 test: Move stats into a struct
In reply to Simon GlassUse a struct to hold the stats, since we also want to have the same stats for all runs as we have for each suite.
---
include/test/test.h | 17 +++++++++++++---- test/test-main.c | 29 +++++++++++++++-------------- test/ut.c | 4 ++-- 3 files changed, 30 insertions(+), 20 deletions(-)
include/test/test.h +13 -4
@@ -9,11 +9,21 @@#include <malloc.h> #include <linux/bitops.h> -/* -* struct unit_test_state - Entire state of test system +/** +* struct ut_stats - Statistics about tests run * * @fail_count: Number of tests that failed * @skip_count: Number of tests that were skipped +*/ +struct ut_stats { +int fail_count; +int skip_count; +}; + +/* +* struct unit_test_state - Entire state of test system +* +* @cur: Statistics for the current run * @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)
@@ -34,8 +44,7 @@* @actual_str: Temporary string used to hold actual string value */ struct unit_test_state { -int fail_count; -int skip_count; +struct ut_stats cur;struct mallinfo start;struct device_node *of_root;bool of_live;
test/test-main.c +15 -14
@@ -448,7 +448,7 @@ static int test_post_run(struct unit_test_state *uts, struct unit_test *test)*/ static int skip_test (struct unit_test_state *uts) { - uts->skip_count++; + uts->cur.skip_count++;return -EAGAIN ; }
@@ -460,7 +460,7 @@ static int skip_test(struct unit_test_state *uts)* the name of each test before running it. * * @uts: Test state to update. The caller should ensure that this is zeroed for -* the first call to this function. On exit, @uts->fail_count is +* the first call to this function. On exit, @uts->cur.fail_count is * incremented by the number of failures (0, one hopes) * @test_name: Test to run * @name: Name of test, possibly skipping a prefix that should not be displayed
@@ -510,7 +510,7 @@ static int ut_run_test(struct unit_test_state *uts, struct unit_test *test,* SPL. * * @uts: Test state to update. The caller should ensure that this is zeroed for -* the first call to this function. On exit, @uts->fail_count is +* the first call to this function. On exit, @uts->cur.fail_count is * incremented by the number of failures (0, one hopes) * @test: Test to run * Return: 0 if all tests passed, -EAGAIN if the test should be skipped, -1 if
@@ -574,7 +574,7 @@ static int ut_run_test_live_flat(struct unit_test_state *uts,* the name of each test before running it. * * @uts: Test state to update. The caller should ensure that this is zeroed for -* the first call to this function. On exit, @uts->fail_count is +* the first call to this function. On exit, @uts->cur.fail_count is * incremented by the number of failures (0, one hopes) * @prefix: String prefix for the tests. Any tests that have this prefix will be * printed without the prefix, so that it is easier to see the unique part
@@ -632,7 +632,7 @@ static int ut_run_tests(struct unit_test_state *uts, const char *prefix,if (len <6 ||strcmp (test_name + len -6 ,"_norun" )) {printf ("Test '%s' is manual so must have a name ending in _norun\n" , test_name); - uts->fail_count++; + uts->cur.fail_count++;return -EBADF ; }if (!uts->force_run) {
@@ -641,23 +641,24 @@ static int ut_run_tests(struct unit_test_state *uts, const char *prefix,continue ; } } - old_fail_count = uts->fail_count; + old_fail_count = uts->cur.fail_count;if (one && upto == pos) { ret =ut_run_test_live_flat (uts, one); -if (uts->fail_count != old_fail_count) { +if (uts->cur.fail_count != old_fail_count) {printf ("Test '%s' failed %d times (position %d)\n" , one->name, - uts->fail_count - old_fail_count, pos); + uts->cur.fail_count - old_fail_count, + pos); }return -EBADF ; }for (i =0 ; i < uts->runs_per_test; i++) ret =ut_run_test_live_flat (uts, test); -if (uts->fail_count != old_fail_count) { +if (uts->cur.fail_count != old_fail_count) {printf ("Test '%s' failed %d times\n" , test_name, - uts->fail_count - old_fail_count); + uts->cur.fail_count - old_fail_count); } found++;if (ret == -EAGAIN )
@@ -668,7 +669,7 @@ static int ut_run_tests(struct unit_test_state *uts, const char *prefix,if (select_name && !found)return -ENOENT ; -return uts->fail_count ? -EBADF :0 ; +return uts->cur.fail_count ? -EBADF :0 ; } int ut_run_list(struct unit_test_state *uts, const char *category,
@@ -716,12 +717,12 @@ int ut_run_list(struct unit_test_state *uts, const char *category,if (has_dm_tests)dm_test_restore (uts->of_root); -if (uts->skip_count) -printf ("Skipped: %d, " , uts->skip_count); +if (uts->cur.skip_count) +printf ("Skipped: %d, " , uts->cur.skip_count);if (ret == -ENOENT )printf ("Test '%s' not found\n" , select_name);else -printf ("Failures: %d\n" , uts->fail_count); +printf ("Failures: %d\n" , uts->cur.fail_count);return ret; }
test/ut.c +2 -2
@@ -21,7 +21,7 @@ void ut_fail(struct unit_test_state *uts, const char *fname, int line, { gd->flags &= ~(GD_FLG_SILENT |GD_FLG_RECORD );printf ("%s:%d, %s(): %s\n" , fname, line, func, cond); - uts->fail_count++; + uts->cur.fail_count++; } void ut_failf(struct unit_test_state *uts, const char *fname, int line,
@@ -35,7 +35,7 @@ void ut_failf(struct unit_test_state *uts, const char *fname, int line,vprintf (fmt, args);va_end (args);putc ('\n' ); - uts->fail_count++; + uts->cur.fail_count++; }ulong ut_check_free (void )
Signature · 1 line
2.34.1
PATCH 38/43 test: Keep a track of the numbers of tests run
In reply to Simon GlassThis is useful information and is not always the same as the 'count' arg to ut_run_list() so add it as a separate stat.
---
include/test/test.h | 3 +++ test/test-main.c | 2 ++ 2 files changed, 5 insertions(+)
include/test/test.h +3 -0
@@ -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; };/*
test/test-main.c +2 -0
@@ -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 )
Signature · 1 line
2.34.1
PATCH 39/43 test: Move stat-printing into its own function
In reply to Simon GlassAdd a function to show the stats, so we can decide when to print it.
This slightly adjusts the output, so that any 'test not found' message appears on its own line after all other output.
The 'failures' message now appears in lower case so update pytest accordingly.
---
arch/sandbox/cpu/spl.c | 1 + include/test/ut.h | 8 ++++++++ test/py/tests/test_spl.py | 2 +- test/py/tests/test_upl.py | 2 +- test/py/tests/test_ut.py | 2 +- test/py/tests/test_vbe.py | 2 +- test/py/tests/test_vpl.py | 2 +- test/test-main.c | 14 +++++++++----- 8 files changed, 23 insertions(+), 10 deletions(-)
arch/sandbox/cpu/spl.c +1 -0
@@ -153,6 +153,7 @@ void spl_board_init(void)ut_init_state (&uts); ret =ut_run_list (&uts,"spl" ,NULL , tests, count, state->select_unittests,1 , false,NULL ); +ut_report (&uts.cur,"Tests" );ut_uninit_state (&uts);/* continue execution into U-Boot */ }
include/test/ut.h +8 -0
@@ -530,4 +530,12 @@ int ut_run_list(struct unit_test_state *uts, const char *category, const char *select_name, int runs_per_test, bool force_run, const char *test_insert); +/** +* ut_report() - Report stats on a test run +* +* @stats: Stats to show +* @prefix: Name of this run type, e.g. "Tests" or "Total tests" +*/ +void ut_report (struct ut_stats *stats,const char *prefix); +#endif
test/py/tests/test_spl.py +1 -1
@@ -36,7 +36,7 @@ def test_spl(u_boot_console, ut_spl_subtest): cons = u_boot_console cons.restart_uboot_with_flags(['-u', '-k', ut_spl_subtest.split()[1]]) output = cons.get_spawn_output().replace('\r', '') - assert 'Failures: 0' in output + assert 'failures: 0' in output finally: # Restart afterward in case a non-SPL test is run next. This should not # happen since SPL tests are run in their own invocation of test.py, but
test/py/tests/test_upl.py +1 -1
@@ -35,4 +35,4 @@ def test_upl_handoff(u_boot_console): # Check the FIT offsets look correct output = cons.run_command('ut upl -f upl_test_info_norun') - assert 'Failures: 0' in output + assert 'failures: 0' in output
test/py/tests/test_ut.py +1 -1
@@ -607,4 +607,4 @@ def test_ut(u_boot_console, ut_subtest): assert 'Unknown command \'quux\' - try \'help\'' in output else: output = u_boot_console.run_command('ut ' + ut_subtest) - assert output.endswith('Failures: 0') + assert output.endswith('failures: 0')
test/py/tests/test_vbe.py +1 -1
@@ -117,4 +117,4 @@ def test_vbe(u_boot_console): with cons.log.section('Kernel load'): output = cons.run_command_list(cmd.splitlines()) - assert 'Failures: 0' in output[-1] + assert 'failures: 0' in output[-1]
test/py/tests/test_vpl.py +1 -1
@@ -26,7 +26,7 @@ def test_vpl(u_boot_console, ut_vpl_subtest): cons = u_boot_console cons.restart_uboot_with_flags(['-u', '-k', ut_vpl_subtest.split()[1]]) output = cons.get_spawn_output().replace('\r', '') - assert 'Failures: 0' in output + assert 'failures: 0' in output finally: # Restart afterward in case a non-VPL test is run next. This should not # happen since VPL tests are run in their own invocation of test.py, but
test/test-main.c +9 -5
@@ -673,6 +673,14 @@ static int ut_run_tests(struct unit_test_state *uts, const char *prefix,return uts->cur.fail_count ? -EBADF :0 ; } +void ut_report (struct ut_stats *stats,const char *prefix) +{ +printf ("%s run: %d, " , prefix, stats->test_count); +if (stats->skip_count) +printf ("skipped: %d, " , stats->skip_count); +printf ("failures: %d\n" , stats->fail_count); +} + int ut_run_list(struct unit_test_state *uts, const char *category, const char *prefix, struct unit_test *tests, int count, const char *select_name, int runs_per_test, bool force_run,
@@ -718,13 +726,9 @@ 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); +ut_report (&uts->cur,"Tests" );if (ret == -ENOENT )printf ("Test '%s' not found\n" , select_name); -else -printf ("Failures: %d\n" , uts->cur.fail_count);return ret; }
Signature · 1 line
2.34.1
PATCH 40/43 test: Record and show the totals for all test runs
In reply to Simon GlassWith 'ut all' multiple test suites are run. Add a way to collect totals and show them at the end.
---
include/test/test.h | 3 +++ test/cmd_ut.c | 2 ++ test/test-main.c | 9 +++++++-- 3 files changed, 12 insertions(+), 2 deletions(-)
include/test/test.h +3 -0
@@ -27,6 +27,7 @@ struct ut_stats {* struct unit_test_state - Entire state of test system * * @cur: Statistics for the current run +* @run_count: Number of times ut_run_list() has been called * @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)
@@ -48,6 +49,8 @@ struct ut_stats {*/ struct unit_test_state {struct ut_stats cur; +struct ut_stats total; +int run_count;struct mallinfo start;struct device_node *of_root;bool of_live;
test/cmd_ut.c +2 -0
@@ -206,6 +206,8 @@ static int do_ut_all(struct unit_test_state *uts, struct cmd_tbl *cmdtp, any_fail = retval; } } +if (uts->run_count >1 ) +ut_report (&uts->total,"Total tests" );return any_fail; }
test/test-main.c +7 -2
@@ -690,6 +690,8 @@ int ut_run_list(struct unit_test_state *uts, const char *category,bool has_dm_tests = false;int ret; +memset (&uts->cur,'\0' ,sizeof (struct ut_stats )); +if (!CONFIG_IS_ENABLED (OF_PLATDATA ) &&ut_list_has_dm_tests (tests, count, prefix, select_name)) { has_dm_tests = true;
@@ -727,8 +729,11 @@ int ut_run_list(struct unit_test_state *uts, const char *category,dm_test_restore (uts->of_root);ut_report (&uts->cur,"Tests" ); -if (ret == -ENOENT ) -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; }
Signature · 1 line
2.34.1
PATCH 41/43 test: Sort the test suites
In reply to Simon GlassPut the suites in order by name, for easier code-maintenance. This also helps find test results for a particular swuit in the 'ut all' output.
---
test/cmd_ut.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-)
test/cmd_ut.c +20 -20
@@ -90,7 +90,10 @@ int cmd_ut_category(struct unit_test_state *uts, const char *name,NULL , \ } +SUITE_DECL (addrmap);SUITE_DECL (bdinfo); +SUITE_DECL (bloblist); +SUITE_DECL (bootm);SUITE_DECL (bootstd);SUITE_DECL (cmd);SUITE_DECL (common);
@@ -99,25 +102,25 @@ SUITE_DECL(env);SUITE_DECL (exit);SUITE_DECL (fdt);SUITE_DECL (font); -SUITE_DECL (optee); -SUITE_DECL (overlay); +SUITE_DECL (hush);SUITE_DECL (lib); +SUITE_DECL (loadm);SUITE_DECL (log);SUITE_DECL (mbr); -SUITE_DECL (mem); -SUITE_DECL (setexpr);SUITE_DECL (measurement); -SUITE_DECL (bloblist); -SUITE_DECL (bootm); -SUITE_DECL (addrmap); -SUITE_DECL (hush); -SUITE_DECL (loadm); +SUITE_DECL (mem); +SUITE_DECL (optee); +SUITE_DECL (overlay);SUITE_DECL (pci_mps);SUITE_DECL (seama); +SUITE_DECL (setexpr);SUITE_DECL (upl);static struct suite suites[] = { +SUITE (addrmap),SUITE (bdinfo), +SUITE (bloblist), +SUITE (bootm), #ifdef CONFIG_UT_BOOTSTDSUITE_CMD (bootstd, do_ut_bootstd), #endif
@@ -128,25 +131,22 @@ static struct suite suites[] = {SUITE (exit),SUITE (fdt),SUITE (font), +SUITE (hush), +SUITE (lib), +SUITE (loadm), +SUITE (log), +SUITE (mbr), +SUITE (measurement), +SUITE (mem), #ifdef CONFIG_UT_OPTEESUITE_CMD (optee, do_ut_optee), #endif #ifdef CONFIG_UT_OVERLAYSUITE_CMD (overlay, do_ut_overlay), #endif -SUITE (lib), -SUITE (log), -SUITE (mbr), -SUITE (mem), -SUITE (setexpr), -SUITE (measurement), -SUITE (bloblist), -SUITE (bootm), -SUITE (addrmap), -SUITE (hush), -SUITE (loadm),SUITE (pci_mps),SUITE (seama), +SUITE (setexpr), SUITE(upl), };
Signature · 1 line
2.34.1
PATCH 42/43 test: Disable test_suite
In reply to Simon GlassThis fails at present, so disable it until it can pass.
---
test/py/tests/test_suite.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
test/py/tests/test_suite.py +2 -1
@@ -122,7 +122,8 @@ def process_ut_info(cons, output): @pytest.mark.buildconfigspec('sandbox') @pytest.mark.notbuildconfigspec('sandbox_spl') @pytest.mark.notbuildconfigspec('sandbox64') -def test_suite(u_boot_console, u_boot_config): +# This test is disabled since it fails; remove the leading 'x' to try it +def xtest_suite(u_boot_console, u_boot_config): """Perform various checks on the unit tests, including: - The number of suites matches that reported by the 'ut info'
Signature · 1 line
2.34.1
PATCH 43/43 test: Move help into the suite declaration
In reply to Simon GlassRather than having the help in the longhelp, put it in the suite info so 'ut info -s' can show it. This is tidier, particular due to the removal of #ifdefs
This means that the help text is present in the image (although not displayed with 'ut info -s') so the image-size increases. But with UNIT_TEST enabled, we expect large images so this doesn't seem important.
---
test/cmd_ut.c | 127 ++++++++++++++++---------------------------------- 1 file changed, 40 insertions(+), 87 deletions(-)
test/cmd_ut.c +40 -87
@@ -19,14 +19,16 @@* * @name: Name of suite * @start: First test in suite -* end: End test in suite (points to the first test in the next suite -* cmd: Command to use to run the suite +* @end: End test in suite (points to the first test in the next suite +* @cmd: Command to use to run the suite +* @help: Help-string to show for this suite */ struct suite {const char *name;struct unit_test *start;struct unit_test *end;ut_cmd_func cmd; +const char *help; }; static int do_ut_all(struct unit_test_state *uts, struct cmd_tbl *cmdtp,
@@ -75,19 +77,21 @@ int cmd_ut_category(struct unit_test_state *uts, const char *name, ll_end_decl(suite_end_ ## _name, struct unit_test, ut_ ## _name) /* declare a test suite which uses a subcommand to run */ -#define SUITE_CMD (_name, _cmd_func) { \ +#define SUITE_CMD (_name, _cmd_func, _help) { \ #_name, \ suite_start_ ## _name, \ suite_end_ ## _name, \ _cmd_func, \ + _help, \ }/* declare a test suite which can be run directly without a subcommand */ -#define SUITE (_name) { \ +#define SUITE (_name, _help) { \ #_name, \ suite_start_ ## _name, \ suite_end_ ## _name, \ NULL, \ + _help, \ }SUITE_DECL (addrmap);
@@ -117,37 +121,37 @@ SUITE_DECL(setexpr);SUITE_DECL (upl);static struct suite suites[] = { -SUITE (addrmap), -SUITE (bdinfo), -SUITE (bloblist), -SUITE (bootm), +SUITE (addrmap,"very basic test of addrmap command" ), +SUITE (bdinfo,"bdinfo (board info) command" ), +SUITE (bloblist,"bloblist implementation" ), +SUITE (bootm,"bootm command" ), #ifdef CONFIG_UT_BOOTSTD -SUITE_CMD (bootstd, do_ut_bootstd), +SUITE_CMD (bootstd, do_ut_bootstd,"standard boot implementation" ), #endif -SUITE (cmd), -SUITE (common), -SUITE (dm), -SUITE (env), -SUITE (exit), -SUITE (fdt), -SUITE (font), -SUITE (hush), -SUITE (lib), -SUITE (loadm), -SUITE (log), -SUITE (mbr), -SUITE (measurement), -SUITE (mem), +SUITE (cmd,"various commands" ), +SUITE (common,"tests for common/ directory" ), +SUITE (dm,"driver model" ), +SUITE (env,"environment" ), +SUITE (exit,"shell exit and variables" ), +SUITE (fdt,"fdt command" ), +SUITE (font,"font command" ), +SUITE (hush,"hush behaviour" ), +SUITE (lib,"library functions" ), +SUITE (loadm,"loadm command parameters and loading memory blob" ), +SUITE (log,"logging functions" ), +SUITE (mbr,"mbr command" ), +SUITE (measurement,"TPM-based measured boot" ), +SUITE (mem,"memory-related commands" ), #ifdef CONFIG_UT_OPTEE -SUITE_CMD (optee, do_ut_optee), +SUITE_CMD (optee, do_ut_optee,"OP-TEE" ), #endif #ifdef CONFIG_UT_OVERLAY -SUITE_CMD (overlay, do_ut_overlay), +SUITE_CMD (overlay, do_ut_overlay,"device tree overlays" ), #endif -SUITE (pci_mps), -SUITE (seama), -SUITE (setexpr), -SUITE (upl), +SUITE (pci_mps,"PCI Express Maximum Payload Size" ), +SUITE (seama,"seama command parameters loading and decoding" ), +SUITE (setexpr,"setexpr command" ), +SUITE (upl,"Universal payload support" ), };/**
@@ -232,16 +236,19 @@ static int do_ut_info(struct cmd_tbl *cmdtp, int flag, int argc,if (flags && !strcmp ("-s" , flags)) {int i; -puts ("\nTests Suite\n" ); -puts ("----- -----\n" ); +puts ("\nTests Suite Purpose" ); +puts ("\n----- ------------ -------------------------\n" );for (i =0 ; i <ARRAY_SIZE (suites); i++) {struct suite *ste = &suites[i];long n_ent = ste->end - ste->start;if (n_ent) -printf ("%5ld %s\n" , n_ent, ste->name); +printf ("%5ld" , n_ent);else if (ste->cmd) -printf ("%5s %s\n" ,"?" , ste->name); +printf ("%5s" ,"?" ); +else /* suite is not present */ +continue ; +printf (" %-13.13s %s\n" , ste->name, ste->help); } }
@@ -306,60 +313,6 @@ U_BOOT_LONGHELP(ut,"\nOptions for <suite>:" "\nall - execute all enabled tests" "\ninfo [-s] - show info about tests [and suites]" -#ifdef CONFIG_CMD_ADDRMAP - "\naddrmap - very basic test of addrmap command" -#endif -#ifdef CONFIG_CMD_BDI - "\nbdinfo - bdinfo command" -#endif -#ifdef CONFIG_SANDBOX - "\nbloblist - bloblist implementation" -#endif -#ifdef CONFIG_BOOTSTD - "\nbootstd - standard boot implementation" -#endif -#ifdef CONFIG_CMDLINE -"\ncmd - test various commands" -#endif -"\ncommon - tests for common/ directory" -#ifdef CONFIG_UT_DM - "\ndm - driver model" -#endif -#ifdef CONFIG_UT_ENV - "\nenv - environment" -#endif -#ifdef CONFIG_CMD_FDT - "\nfdt - fdt command" -#endif -#ifdef CONFIG_CONSOLE_TRUETYPE - "\nfont - font command" -#endif -#if CONFIG_IS_ENABLED (HUSH_PARSER ) - "\nhush - Test hush behavior" -#endif -#ifdef CONFIG_CMD_LOADM - "\nloadm - loadm command parameters and loading memory blob" -#endif -#ifdef CONFIG_UT_LIB - "\nlib - library functions" -#endif -#ifdef CONFIG_UT_LOG -"\nlog - logging functions" -#endif -"\nmem - memory-related commands" -#ifdef CONFIG_UT_OPTEE - "\noptee - test OP-TEE" -#endif -#ifdef CONFIG_UT_OVERLAY - "\noverlay - device tree overlays" -#endif -#ifdef CONFIG_CMD_PCI_MPS -"\npci_mps - PCI Express Maximum Payload Size" -#endif -"\nsetexpr - setexpr command" -#ifdef CONFIG_CMD_SEAMA -"\nseama - seama command parameters loading and decoding" -#endif ); U_BOOT_CMD(
Signature · 1 line
2.34.1
Quoted 22 lines · Simon Glass
The current method of running unit tests relies on subcommands of the ut command. Only the code in each subcommand knows how to find the tests related to that subcomand.
This is not ideal and we now have quite a few subcommands which do nothing but locate the relevant tests in a linker list, then call a common function to run them.
This series adds a list of test suites, so that these subcommands can be removed.
An issue with 'ut all' is that it doesn't record how many tests failed overall, so it is necessary to examine copious amounts of output to look for failures. This series adds a new 'total' feature allow recording the total number of failed tests.
To help with 'ut all' a new pytest is created which runs it (as well as 'ut info') and makes sure that all is well. Due to the 'ut all' failures this does not pass, so the test is disabled for now. It is here because it provides security against misnaming a test suite and causing it not to run.
Quoted 7 lines
Future work may:
- get 'ut all' passing
- enabletest_suite()in CL, to ensure that 'ut all' keeps passing
- record duration of each suite
- allow running the tests in random order to tease out dependencies
- tweak the output to remove common prefixes
- getting rid of bootstd, optee and seame 'ut' subcommands
Am I missing a patch for doc/ or will the usage of the ut command remain unchanged?
How would you specify a test suite like 'lib' in future? How would you specify running all tests in future?
Best regards
Heinrich
Quoted 119 lines
Simon Glass (43):
test: Drop unused suite prototypes
test: Renametest_get_state()tout_get_state()
test: Add functions to init and uninit the test state
test: Pass the test-state intout_run_list()Improve support for linker lists in data structures
test: Add newlines to hush-test messages
test: Rename test suites to match their linker-list name
test: Update ut info to show suites
test/py: Add a test which runs all unit tests
test: Drop the_testsuffix on linker lists
test: Introduce a better array of test suites
test: Drop the function for running bdinfo tests
test: Drop the function for running cmd tests
test: Drop the function for running common tests
test: Drop the function for running dm tests
test: Drop the function for running env tests
test: Drop the function for running exit tests
test: Drop the function for running fdt tests
test: Drop the function for running font tests
test: Drop the function for running lib tests
test: Drop the function for running log tests
test: Drop the function for running mbr tests
test: Drop the function for running mem tests
test: Drop the function for running setexpr tests
test: Drop the function for running measurement tests
test: Drop the function for running bloblist tests
test: Drop the function for running bootm tests
test: Drop the function for running addrmap tests
test: Drop the function for running hush tests
test: Drop the function for running loadm tests
test: Drop the function for runningpci_mpstests
test: Drop the function for running seama tests
test: Drop the function for running upl tests
test: Drop the info test from the list
test: Drop conditional compilation for suites
test: Pass the test state tocmd_ut_category()
test: Move stats into a struct
test: Keep a track of the numbers of tests run
test: Move stat-printing into its own function
test: Record and show the totals for all test runs
test: Sort the test suites
test: Disabletest_suite
test: Move help into the suite declarationarch/sandbox/cpu/spl.c | 6 +- include/dm/test.h | 2 +- include/linker_lists.h | 51 +++++ include/test/cmd.h | 2 +- include/test/common.h | 2 +- include/test/env.h | 2 +- include/test/hush.h | 2 +- include/test/lib.h | 2 +- include/test/log.h | 4 +- include/test/optee.h | 2 +- include/test/overlay.h | 2 +- include/test/suites.h | 53 ++--- include/test/test.h | 23 ++- include/test/ut.h | 45 ++++- test/boot/bootm.c | 11 +- test/boot/bootstd_common.c | 9 +- test/boot/bootstd_common.h | 3 +- test/boot/measurement.c | 12 +- test/boot/upl.c | 11 +- test/cmd/Makefile | 4 +- test/cmd/addrmap.c | 11 +- test/cmd/bdinfo.c | 10 +- test/cmd/cmd_ut_cmd.c | 20 -- test/cmd/exit.c | 11 +- test/cmd/fdt.c | 10 +- test/cmd/font.c | 10 +- test/cmd/loadm.c | 11 +- test/cmd/mbr.c | 10 +- test/cmd/mem.c | 19 -- test/cmd/mem_copy.c | 2 +- test/cmd/mem_search.c | 2 +- test/cmd/pci_mps.c | 12 +- test/cmd/seama.c | 11 +- test/cmd/setexpr.c | 11 +- test/cmd_ut.c | 361 +++++++++++++++++++++------------- test/common/Makefile | 1 - test/common/bloblist.c | 12 +- test/common/cmd_ut_common.c | 21 -- test/dm/Makefile | 2 - test/dm/test-dm.c | 16 -- test/dm/test-driver.c | 10 +- test/dm/test-uclass.c | 8 +- test/env/cmd_ut_env.c | 10 - test/hush/Makefile | 1 - test/hush/cmd_ut_hush.c | 19 -- test/hush/dollar.c | 7 +- test/hush/loop.c | 4 +- test/lib/Makefile | 1 - test/lib/cmd_ut_lib.c | 19 -- test/log/Makefile | 2 - test/log/log_ut.c | 20 -- test/optee/cmd_ut_optee.c | 4 +- test/overlay/cmd_ut_overlay.c | 14 +- test/py/conftest.py | 7 +- test/py/tests/test_spl.py | 2 +- test/py/tests/test_suite.py | 182 +++++++++++++++++ test/py/tests/test_upl.py | 2 +- test/py/tests/test_ut.py | 2 +- test/py/tests/test_vbe.py | 2 +- test/py/tests/test_vpl.py | 2 +- test/test-main.c | 104 ++++++---- test/ut.c | 4 +- 62 files changed, 657 insertions(+), 580 deletions(-)delete mode 100644
test/cmd/cmd_ut_cmd.c
delete mode 100644test/cmd/mem.c
delete mode 100644test/common/cmd_ut_common.c
delete mode 100644test/dm/test-dm.c
delete mode 100644test/hush/cmd_ut_hush.c
delete mode 100644test/lib/cmd_ut_lib.c
delete mode 100644test/log/log_ut.c
create mode 100644test/py/tests/test_suite.py
Hi Heinrich,
Quoted 32 lines · Heinrich Schuchardt
Quoted 22 lines · Simon Glass
The current method of running unit tests relies on subcommands of the ut command. Only the code in each subcommand knows how to find the tests related to that subcomand.
This is not ideal and we now have quite a few subcommands which do nothing but locate the relevant tests in a linker list, then call a common function to run them.
This series adds a list of test suites, so that these subcommands can be removed.
An issue with 'ut all' is that it doesn't record how many tests failed overall, so it is necessary to examine copious amounts of output to look for failures. This series adds a new 'total' feature allow recording the total number of failed tests.
To help with 'ut all' a new pytest is created which runs it (as well as 'ut info') and makes sure that all is well. Due to the 'ut all' failures this does not pass, so the test is disabled for now. It is here because it provides security against misnaming a test suite and causing it not to run.
Quoted 7 lines
Future work may:
- get 'ut all' passing
- enabletest_suite()in CL, to ensure that 'ut all' keeps passing
- record duration of each suite
- allow running the tests in random order to tease out dependencies
- tweak the output to remove common prefixes
- getting rid of bootstd, optee and seame 'ut' subcommands
Quoted 2 lines
Am I missing a patch for doc/ or will the usage of the ut command remain unchanged?
No change to the command, but the output changes, so I can add an update to the 'examples' section.
Quoted 2 lines
How would you specify a test suite like 'lib' in future?
LIB_TEST(...)
If you want to create a new one, you need to add it to the list in cmd_ut.c as now. But it is now in a new format which is easier to maintain.
Quoted 1 line
How would you specify running all tests in future?
'ut -a' as now
[..]
Regards,
Simon
Hi Simon,
Thank you for the series.
Quoted 16 lines · Simon Glass
The current method of running unit tests relies on subcommands of the ut command. Only the code in each subcommand knows how to find the tests related to that subcomand.
This is not ideal and we now have quite a few subcommands which do nothing but locate the relevant tests in a linker list, then call a common function to run them.
This series adds a list of test suites, so that these subcommands can be removed.
An issue with 'ut all' is that it doesn't record how many tests failed overall, so it is necessary to examine copious amounts of output to look for failures. This series adds a new 'total' feature allow recording the total number of failed tests.
Quoted 5 lines
To help with 'ut all' a new pytest is created which runs it (as well as 'ut info') and makes sure that all is well. Due to the 'ut all' failures this does not pass, so the test is disabled for now. It is here because it provides security against misnaming a test suite and causing it not to run.
I wanted to test this, but it seems it does not apply on both master or next:
With master: 178f6ecb21fe ("Merge patch series "bootstd: Support recording images"") With next: d6da3dbaef57 ("Merge patch series "cmd: Add support for optee commands."")
When running:
$ b4 shazam -s -l --check [email protected]
I see:
"""
[...] snip
Total patches: 43
---
Applying: test: Drop unused suite prototypes
Applying: test: Rename test_get_state() to ut_get_state()
Applying: test: Add functions to init and uninit the test state
Applying: test: Pass the test-state into ut_run_list()
Applying: Improve support for linker lists in data structures
Applying: test: Add newlines to hush-test messages
Applying: test: Rename test suites to match their linker-list name
Applying: test: Update ut info to show suites
Applying: test/py: Add a test which runs all unit tests
Applying: test: Drop the _test suffix on linker lists
Applying: test: Introduce a better array of test suites
Patch failed at 0011 test: Introduce a better array of test suites
error: sha1 information is lacking or useless (test/cmd_ut.c).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort". """
On what base should this be applied if we want to test this? Sorry if this is a sily question, usually I get dependencies from the cover letter but I could not find any here.
Quoted 129 lines
Future work may:
- get 'ut all' passing
- enabletest_suite()in CL, to ensure that 'ut all' keeps passing
- record duration of each suite
- allow running the tests in random order to tease out dependencies
- tweak the output to remove common prefixes
- getting rid of bootstd, optee and seame 'ut' subcommandsSimon Glass (43):
test: Drop unused suite prototypes
test: Renametest_get_state()tout_get_state()
test: Add functions to init and uninit the test state
test: Pass the test-state intout_run_list()Improve support for linker lists in data structures
test: Add newlines to hush-test messages
test: Rename test suites to match their linker-list name
test: Update ut info to show suites
test/py: Add a test which runs all unit tests
test: Drop the_testsuffix on linker lists
test: Introduce a better array of test suites
test: Drop the function for running bdinfo tests
test: Drop the function for running cmd tests
test: Drop the function for running common tests
test: Drop the function for running dm tests
test: Drop the function for running env tests
test: Drop the function for running exit tests
test: Drop the function for running fdt tests
test: Drop the function for running font tests
test: Drop the function for running lib tests
test: Drop the function for running log tests
test: Drop the function for running mbr tests
test: Drop the function for running mem tests
test: Drop the function for running setexpr tests
test: Drop the function for running measurement tests
test: Drop the function for running bloblist tests
test: Drop the function for running bootm tests
test: Drop the function for running addrmap tests
test: Drop the function for running hush tests
test: Drop the function for running loadm tests
test: Drop the function for runningpci_mpstests
test: Drop the function for running seama tests
test: Drop the function for running upl tests
test: Drop the info test from the list
test: Drop conditional compilation for suites
test: Pass the test state tocmd_ut_category()
test: Move stats into a struct
test: Keep a track of the numbers of tests run
test: Move stat-printing into its own function
test: Record and show the totals for all test runs
test: Sort the test suites
test: Disabletest_suite
test: Move help into the suite declarationarch/sandbox/cpu/spl.c | 6 +- include/dm/test.h | 2 +- include/linker_lists.h | 51 +++++ include/test/cmd.h | 2 +- include/test/common.h | 2 +- include/test/env.h | 2 +- include/test/hush.h | 2 +- include/test/lib.h | 2 +- include/test/log.h | 4 +- include/test/optee.h | 2 +- include/test/overlay.h | 2 +- include/test/suites.h | 53 ++--- include/test/test.h | 23 ++- include/test/ut.h | 45 ++++- test/boot/bootm.c | 11 +- test/boot/bootstd_common.c | 9 +- test/boot/bootstd_common.h | 3 +- test/boot/measurement.c | 12 +- test/boot/upl.c | 11 +- test/cmd/Makefile | 4 +- test/cmd/addrmap.c | 11 +- test/cmd/bdinfo.c | 10 +- test/cmd/cmd_ut_cmd.c | 20 -- test/cmd/exit.c | 11 +- test/cmd/fdt.c | 10 +- test/cmd/font.c | 10 +- test/cmd/loadm.c | 11 +- test/cmd/mbr.c | 10 +- test/cmd/mem.c | 19 -- test/cmd/mem_copy.c | 2 +- test/cmd/mem_search.c | 2 +- test/cmd/pci_mps.c | 12 +- test/cmd/seama.c | 11 +- test/cmd/setexpr.c | 11 +- test/cmd_ut.c | 361 +++++++++++++++++++++------------- test/common/Makefile | 1 - test/common/bloblist.c | 12 +- test/common/cmd_ut_common.c | 21 -- test/dm/Makefile | 2 - test/dm/test-dm.c | 16 -- test/dm/test-driver.c | 10 +- test/dm/test-uclass.c | 8 +- test/env/cmd_ut_env.c | 10 - test/hush/Makefile | 1 - test/hush/cmd_ut_hush.c | 19 -- test/hush/dollar.c | 7 +- test/hush/loop.c | 4 +- test/lib/Makefile | 1 - test/lib/cmd_ut_lib.c | 19 -- test/log/Makefile | 2 - test/log/log_ut.c | 20 -- test/optee/cmd_ut_optee.c | 4 +- test/overlay/cmd_ut_overlay.c | 14 +- test/py/conftest.py | 7 +- test/py/tests/test_spl.py | 2 +- test/py/tests/test_suite.py | 182 +++++++++++++++++ test/py/tests/test_upl.py | 2 +- test/py/tests/test_ut.py | 2 +- test/py/tests/test_vbe.py | 2 +- test/py/tests/test_vpl.py | 2 +- test/test-main.c | 104 ++++++---- test/ut.c | 4 +- 62 files changed, 657 insertions(+), 580 deletions(-) delete mode 100644 test/cmd/cmd_ut_cmd.c delete mode 100644 test/cmd/mem.c delete mode 100644 test/common/cmd_ut_common.c delete mode 100644 test/dm/test-dm.c delete mode 100644 test/hush/cmd_ut_hush.c delete mode 100644 test/lib/cmd_ut_lib.c delete mode 100644 test/log/log_ut.c create mode 100644 test/py/tests/test_suite.pySignature · 1 line
2.34.1
Hi Mattijs,
Quoted 65 lines · Mattijs Korpershoek
Hi Simon,
Thank you for the series.
Quoted 16 lines · Simon Glass
The current method of running unit tests relies on subcommands of the ut command. Only the code in each subcommand knows how to find the tests related to that subcomand.
This is not ideal and we now have quite a few subcommands which do nothing but locate the relevant tests in a linker list, then call a common function to run them.
This series adds a list of test suites, so that these subcommands can be removed.
An issue with 'ut all' is that it doesn't record how many tests failed overall, so it is necessary to examine copious amounts of output to look for failures. This series adds a new 'total' feature allow recording the total number of failed tests.
Quoted 5 lines
To help with 'ut all' a new pytest is created which runs it (as well as 'ut info') and makes sure that all is well. Due to the 'ut all' failures this does not pass, so the test is disabled for now. It is here because it provides security against misnaming a test suite and causing it not to run.
I wanted to test this, but it seems it does not apply on both master or next:
With master:
178f6ecb21fe("Merge patch series "bootstd: Support recording images"") With next:d6da3dbaef57("Merge patch series "cmd: Add support for optee commands."")When running:
$ b4 shazam -s -l --check [email protected]I see:
"""
[...] snipTotal patches: 43
---
Applying: test: Drop unused suite prototypes
Applying: test: Renametest_get_state()tout_get_state()
Applying: test: Add functions to init and uninit the test state
Applying: test: Pass the test-state intout_run_list()
Applying: Improve support for linker lists in data structures
Applying: test: Add newlines to hush-test messages
Applying: test: Rename test suites to match their linker-list name
Applying: test: Update ut info to show suites
Applying: test/py: Add a test which runs all unit tests
Applying: test: Drop the_testsuffix on linker lists
Applying: test: Introduce a better array of test suites
Patch failed at 0011 test: Introduce a better array of test suites
error: sha1 information is lacking or useless (test/cmd_ut.c).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort". """
Quoted 3 lines
On what base should this be applied if we want to test this? Sorry if this is a sily question, usually I get dependencies from the cover letter but I could not find any here.
Yes, it is supposed to be based on -next but there are two patches in -next but not in the tree I used:
90856d695f2 test: sandbox: fix link error with do_ut_bootm if BLOBLIST=n 6970eeb7885 test: sandbox: fix link error with do_ut_bloblist if BLOBLIST=n
The series is available at sjg.u-boot.org/u-boot/u-boot/-/tree/tes?ref_type=heads
I'll sort this out when I send v2, but will wait for some more feedback.
[..]
Regards,
SImon