From 725c438c6271f1870636f61a68d6904dc27a1357 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 22 Aug 2024 07:57:48 -0600 Subject: test: Rename unit-test flags The UT_TESTF_ macros read as 'unit test test flags' which is not right. Rename to UTF ('unit test flags'). This has the benefit of being shorter, which helps keep UNIT_TEST() declarations on a single line. Give the enum a name and reference it from the UNIT_TEST() macros while we are here. Signed-off-by: Simon Glass --- test/cmd/addrmap.c | 2 +- test/cmd/armffa.c | 2 +- test/cmd/bdinfo.c | 8 ++++---- test/cmd/exit.c | 2 +- test/cmd/fdt.c | 38 +++++++++++++++++++------------------- test/cmd/font.c | 4 ++-- test/cmd/history.c | 2 +- test/cmd/loadm.c | 4 ++-- test/cmd/mbr.c | 4 ++-- test/cmd/mem_search.c | 18 +++++++++--------- test/cmd/pci_mps.c | 2 +- test/cmd/pinmux.c | 2 +- test/cmd/pwm.c | 2 +- test/cmd/rw.c | 2 +- test/cmd/seama.c | 6 +++--- test/cmd/setexpr.c | 22 +++++++++++----------- test/cmd/temperature.c | 2 +- 17 files changed, 61 insertions(+), 61 deletions(-) (limited to 'test/cmd') diff --git a/test/cmd/addrmap.c b/test/cmd/addrmap.c index 7b8f49fd375..fb4ec316781 100644 --- a/test/cmd/addrmap.c +++ b/test/cmd/addrmap.c @@ -24,7 +24,7 @@ static int addrmap_test_basic(struct unit_test_state *uts) return 0; } -ADDRMAP_TEST(addrmap_test_basic, UT_TESTF_CONSOLE_REC); +ADDRMAP_TEST(addrmap_test_basic, UTF_CONSOLE_REC); int do_ut_addrmap(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { diff --git a/test/cmd/armffa.c b/test/cmd/armffa.c index 38f40b72f5e..f5d5a1b54a3 100644 --- a/test/cmd/armffa.c +++ b/test/cmd/armffa.c @@ -29,4 +29,4 @@ static int dm_test_armffa_cmd(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_armffa_cmd, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC); +DM_TEST(dm_test_armffa_cmd, UTF_SCAN_FDT | UTF_CONSOLE_REC); diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c index 027848c3e24..973544f63f6 100644 --- a/test/cmd/bdinfo.c +++ b/test/cmd/bdinfo.c @@ -245,7 +245,7 @@ static int bdinfo_test_full(struct unit_test_state *uts) return 0; } -BDINFO_TEST(bdinfo_test_full, UT_TESTF_CONSOLE_REC); +BDINFO_TEST(bdinfo_test_full, UTF_CONSOLE_REC); static int bdinfo_test_help(struct unit_test_state *uts) { @@ -267,7 +267,7 @@ static int bdinfo_test_help(struct unit_test_state *uts) return 0; } -BDINFO_TEST(bdinfo_test_help, UT_TESTF_CONSOLE_REC); +BDINFO_TEST(bdinfo_test_help, UTF_CONSOLE_REC); static int bdinfo_test_memory(struct unit_test_state *uts) { @@ -283,7 +283,7 @@ static int bdinfo_test_memory(struct unit_test_state *uts) return 0; } -BDINFO_TEST(bdinfo_test_memory, UT_TESTF_CONSOLE_REC); +BDINFO_TEST(bdinfo_test_memory, UTF_CONSOLE_REC); static int bdinfo_test_eth(struct unit_test_state *uts) { @@ -299,7 +299,7 @@ static int bdinfo_test_eth(struct unit_test_state *uts) return 0; } -BDINFO_TEST(bdinfo_test_eth, UT_TESTF_CONSOLE_REC); +BDINFO_TEST(bdinfo_test_eth, UTF_CONSOLE_REC); int do_ut_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { diff --git a/test/cmd/exit.c b/test/cmd/exit.c index d310ec8531b..d4aac0facf6 100644 --- a/test/cmd/exit.c +++ b/test/cmd/exit.c @@ -122,7 +122,7 @@ static int cmd_exit_test(struct unit_test_state *uts) return 0; } -EXIT_TEST(cmd_exit_test, UT_TESTF_CONSOLE_REC); +EXIT_TEST(cmd_exit_test, UTF_CONSOLE_REC); int do_ut_exit(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { diff --git a/test/cmd/fdt.c b/test/cmd/fdt.c index e09a929a5e4..4f935d053c6 100644 --- a/test/cmd/fdt.c +++ b/test/cmd/fdt.c @@ -213,7 +213,7 @@ static int fdt_test_addr(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_addr, UT_TESTF_CONSOLE_REC); +FDT_TEST(fdt_test_addr, UTF_CONSOLE_REC); /* Test 'fdt addr' resizing an fdt */ static int fdt_test_addr_resize(struct unit_test_state *uts) @@ -247,7 +247,7 @@ static int fdt_test_addr_resize(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_addr_resize, UT_TESTF_CONSOLE_REC); +FDT_TEST(fdt_test_addr_resize, UTF_CONSOLE_REC); static int fdt_test_move(struct unit_test_state *uts) { @@ -281,7 +281,7 @@ static int fdt_test_move(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_move, UT_TESTF_CONSOLE_REC); +FDT_TEST(fdt_test_move, UTF_CONSOLE_REC); static int fdt_test_resize(struct unit_test_state *uts) { @@ -305,7 +305,7 @@ static int fdt_test_resize(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_resize, UT_TESTF_CONSOLE_REC); +FDT_TEST(fdt_test_resize, UTF_CONSOLE_REC); static int fdt_test_print_list_common(struct unit_test_state *uts, const char *opc, const char *node) @@ -442,13 +442,13 @@ static int fdt_test_print(struct unit_test_state *uts) { return fdt_test_print_list(uts, true); } -FDT_TEST(fdt_test_print, UT_TESTF_CONSOLE_REC); +FDT_TEST(fdt_test_print, UTF_CONSOLE_REC); static int fdt_test_list(struct unit_test_state *uts) { return fdt_test_print_list(uts, false); } -FDT_TEST(fdt_test_list, UT_TESTF_CONSOLE_REC); +FDT_TEST(fdt_test_list, UTF_CONSOLE_REC); /* Test 'fdt get value' reading an fdt */ static int fdt_test_get_value_string(struct unit_test_state *uts, @@ -554,7 +554,7 @@ static int fdt_test_get_value(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_get_value, UT_TESTF_CONSOLE_REC); +FDT_TEST(fdt_test_get_value, UTF_CONSOLE_REC); static int fdt_test_get_name(struct unit_test_state *uts) { @@ -633,7 +633,7 @@ static int fdt_test_get_name(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_get_name, UT_TESTF_CONSOLE_REC); +FDT_TEST(fdt_test_get_name, UTF_CONSOLE_REC); static int fdt_test_get_addr_common(struct unit_test_state *uts, char *fdt, const char *path, const char *prop) @@ -700,7 +700,7 @@ static int fdt_test_get_addr(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_get_addr, UT_TESTF_CONSOLE_REC); +FDT_TEST(fdt_test_get_addr, UTF_CONSOLE_REC); static int fdt_test_get_size_common(struct unit_test_state *uts, const char *path, const char *prop, @@ -787,7 +787,7 @@ static int fdt_test_get_size(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_get_size, UT_TESTF_CONSOLE_REC); +FDT_TEST(fdt_test_get_size, UTF_CONSOLE_REC); static int fdt_test_set_single(struct unit_test_state *uts, const char *path, const char *prop, @@ -929,7 +929,7 @@ static int fdt_test_set(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_set, UT_TESTF_CONSOLE_REC); +FDT_TEST(fdt_test_set, UTF_CONSOLE_REC); static int fdt_test_mknode(struct unit_test_state *uts) { @@ -997,7 +997,7 @@ static int fdt_test_mknode(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_mknode, UT_TESTF_CONSOLE_REC); +FDT_TEST(fdt_test_mknode, UTF_CONSOLE_REC); static int fdt_test_rm(struct unit_test_state *uts) { @@ -1081,7 +1081,7 @@ static int fdt_test_rm(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_rm, UT_TESTF_CONSOLE_REC); +FDT_TEST(fdt_test_rm, UTF_CONSOLE_REC); static int fdt_test_bootcpu(struct unit_test_state *uts) { @@ -1114,7 +1114,7 @@ static int fdt_test_bootcpu(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_bootcpu, UT_TESTF_CONSOLE_REC); +FDT_TEST(fdt_test_bootcpu, UTF_CONSOLE_REC); static int fdt_test_header_get(struct unit_test_state *uts, const char *field, const unsigned long val) @@ -1173,7 +1173,7 @@ static int fdt_test_header(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_header, UT_TESTF_CONSOLE_REC); +FDT_TEST(fdt_test_header, UTF_CONSOLE_REC); static int fdt_test_memory_cells(struct unit_test_state *uts, const unsigned int cells) @@ -1256,7 +1256,7 @@ static int fdt_test_memory(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_memory, UT_TESTF_CONSOLE_REC); +FDT_TEST(fdt_test_memory, UTF_CONSOLE_REC); static int fdt_test_rsvmem(struct unit_test_state *uts) { @@ -1319,7 +1319,7 @@ static int fdt_test_rsvmem(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_rsvmem, UT_TESTF_CONSOLE_REC); +FDT_TEST(fdt_test_rsvmem, UTF_CONSOLE_REC); static int fdt_test_chosen(struct unit_test_state *uts) { @@ -1375,7 +1375,7 @@ static int fdt_test_chosen(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_chosen, UT_TESTF_CONSOLE_REC); +FDT_TEST(fdt_test_chosen, UTF_CONSOLE_REC); static int fdt_test_apply(struct unit_test_state *uts) { @@ -1527,7 +1527,7 @@ static int fdt_test_apply(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_apply, UT_TESTF_CONSOLE_REC); +FDT_TEST(fdt_test_apply, UTF_CONSOLE_REC); int do_ut_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { diff --git a/test/cmd/font.c b/test/cmd/font.c index a8905ce617e..3ea262bb703 100644 --- a/test/cmd/font.c +++ b/test/cmd/font.c @@ -69,8 +69,8 @@ static int font_test_base(struct unit_test_state *uts) return 0; } -FONT_TEST(font_test_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | - UT_TESTF_CONSOLE_REC | UT_TESTF_DM); +FONT_TEST(font_test_base, UTF_SCAN_PDATA | UTF_SCAN_FDT | UTF_CONSOLE_REC | + UTF_DM); int do_ut_font(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { diff --git a/test/cmd/history.c b/test/cmd/history.c index 6964bfa9e1e..9fec4a811f4 100644 --- a/test/cmd/history.c +++ b/test/cmd/history.c @@ -45,4 +45,4 @@ static int lib_test_history(struct unit_test_state *uts) return 0; } -LIB_TEST(lib_test_history, UT_TESTF_CONSOLE_REC); +LIB_TEST(lib_test_history, UTF_CONSOLE_REC); diff --git a/test/cmd/loadm.c b/test/cmd/loadm.c index dff8a97d139..0b6390ebc53 100644 --- a/test/cmd/loadm.c +++ b/test/cmd/loadm.c @@ -41,7 +41,7 @@ static int loadm_test_params(struct unit_test_state *uts) return 0; } -LOADM_TEST(loadm_test_params, UT_TESTF_CONSOLE_REC); +LOADM_TEST(loadm_test_params, UTF_CONSOLE_REC); static int loadm_test_load (struct unit_test_state *uts) { @@ -59,7 +59,7 @@ static int loadm_test_load (struct unit_test_state *uts) return 0; } -LOADM_TEST(loadm_test_load, UT_TESTF_CONSOLE_REC); +LOADM_TEST(loadm_test_load, UTF_CONSOLE_REC); int do_ut_loadm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { diff --git a/test/cmd/mbr.c b/test/cmd/mbr.c index 235b363290e..fd601ee5f53 100644 --- a/test/cmd/mbr.c +++ b/test/cmd/mbr.c @@ -465,7 +465,7 @@ static int mbr_test_run(struct unit_test_state *uts) } /* Declare mbr test */ -UNIT_TEST(mbr_test_run, UT_TESTF_CONSOLE_REC, mbr_test); +UNIT_TEST(mbr_test_run, UTF_CONSOLE_REC, mbr_test); int do_ut_mbr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -480,4 +480,4 @@ static int dm_test_cmd_mbr(struct unit_test_state *uts) return mbr_test_run(uts); } -DM_TEST(dm_test_cmd_mbr, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC); +DM_TEST(dm_test_cmd_mbr, UTF_SCAN_FDT | UTF_CONSOLE_REC); diff --git a/test/cmd/mem_search.c b/test/cmd/mem_search.c index 55ad2fac1e3..9ad0c18152f 100644 --- a/test/cmd/mem_search.c +++ b/test/cmd/mem_search.c @@ -43,7 +43,7 @@ static int mem_test_ms_b(struct unit_test_state *uts) return 0; } -MEM_TEST(mem_test_ms_b, UT_TESTF_CONSOLE_REC); +MEM_TEST(mem_test_ms_b, UTF_CONSOLE_REC); /* Test 'ms' command with 16-bit values */ static int mem_test_ms_w(struct unit_test_state *uts) @@ -68,7 +68,7 @@ static int mem_test_ms_w(struct unit_test_state *uts) return 0; } -MEM_TEST(mem_test_ms_w, UT_TESTF_CONSOLE_REC); +MEM_TEST(mem_test_ms_w, UTF_CONSOLE_REC); /* Test 'ms' command with 32-bit values */ static int mem_test_ms_l(struct unit_test_state *uts) @@ -102,7 +102,7 @@ static int mem_test_ms_l(struct unit_test_state *uts) return 0; } -MEM_TEST(mem_test_ms_l, UT_TESTF_CONSOLE_REC); +MEM_TEST(mem_test_ms_l, UTF_CONSOLE_REC); /* Test 'ms' command with continuation */ static int mem_test_ms_cont(struct unit_test_state *uts) @@ -152,7 +152,7 @@ static int mem_test_ms_cont(struct unit_test_state *uts) return 0; } -MEM_TEST(mem_test_ms_cont, UT_TESTF_CONSOLE_REC); +MEM_TEST(mem_test_ms_cont, UTF_CONSOLE_REC); /* Test that an 'ms' command with continuation stops at the end of the range */ static int mem_test_ms_cont_end(struct unit_test_state *uts) @@ -196,7 +196,7 @@ static int mem_test_ms_cont_end(struct unit_test_state *uts) return 0; } -MEM_TEST(mem_test_ms_cont_end, UT_TESTF_CONSOLE_REC); +MEM_TEST(mem_test_ms_cont_end, UTF_CONSOLE_REC); /* Test 'ms' command with multiple values */ static int mem_test_ms_mult(struct unit_test_state *uts) @@ -225,7 +225,7 @@ static int mem_test_ms_mult(struct unit_test_state *uts) return 0; } -MEM_TEST(mem_test_ms_mult, UT_TESTF_CONSOLE_REC); +MEM_TEST(mem_test_ms_mult, UTF_CONSOLE_REC); /* Test 'ms' command with string */ static int mem_test_ms_s(struct unit_test_state *uts) @@ -268,7 +268,7 @@ static int mem_test_ms_s(struct unit_test_state *uts) return 0; } -MEM_TEST(mem_test_ms_s, UT_TESTF_CONSOLE_REC); +MEM_TEST(mem_test_ms_s, UTF_CONSOLE_REC); /* Test 'ms' command with limit */ static int mem_test_ms_limit(struct unit_test_state *uts) @@ -297,7 +297,7 @@ static int mem_test_ms_limit(struct unit_test_state *uts) return 0; } -MEM_TEST(mem_test_ms_limit, UT_TESTF_CONSOLE_REC); +MEM_TEST(mem_test_ms_limit, UTF_CONSOLE_REC); /* Test 'ms' command in quiet mode */ static int mem_test_ms_quiet(struct unit_test_state *uts) @@ -321,4 +321,4 @@ static int mem_test_ms_quiet(struct unit_test_state *uts) return 0; } -MEM_TEST(mem_test_ms_quiet, UT_TESTF_CONSOLE_REC); +MEM_TEST(mem_test_ms_quiet, UTF_CONSOLE_REC); diff --git a/test/cmd/pci_mps.c b/test/cmd/pci_mps.c index 2a64143eecd..f7f77e73a30 100644 --- a/test/cmd/pci_mps.c +++ b/test/cmd/pci_mps.c @@ -28,7 +28,7 @@ static int test_pci_mps_safe(struct unit_test_state *uts) return 0; } -PCI_MPS_TEST(test_pci_mps_safe, UT_TESTF_CONSOLE_REC); +PCI_MPS_TEST(test_pci_mps_safe, UTF_CONSOLE_REC); int do_ut_pci_mps(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]) diff --git a/test/cmd/pinmux.c b/test/cmd/pinmux.c index 4253baa5646..23f9b9a9f3a 100644 --- a/test/cmd/pinmux.c +++ b/test/cmd/pinmux.c @@ -37,4 +37,4 @@ static int dm_test_cmd_pinmux_status_pinname(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_cmd_pinmux_status_pinname, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +DM_TEST(dm_test_cmd_pinmux_status_pinname, UTF_SCAN_PDATA | UTF_SCAN_FDT); diff --git a/test/cmd/pwm.c b/test/cmd/pwm.c index cf7ee0e0e65..494f31f4dae 100644 --- a/test/cmd/pwm.c +++ b/test/cmd/pwm.c @@ -72,4 +72,4 @@ static int dm_test_pwm_cmd(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_pwm_cmd, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC); +DM_TEST(dm_test_pwm_cmd, UTF_SCAN_PDATA | UTF_SCAN_FDT | UTF_CONSOLE_REC); diff --git a/test/cmd/rw.c b/test/cmd/rw.c index edd762e4d58..3dcf4228ee6 100644 --- a/test/cmd/rw.c +++ b/test/cmd/rw.c @@ -100,4 +100,4 @@ static int dm_test_read_write(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_read_write, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC); +DM_TEST(dm_test_read_write, UTF_SCAN_FDT | UTF_CONSOLE_REC); diff --git a/test/cmd/seama.c b/test/cmd/seama.c index b60f6550b13..235135118cf 100644 --- a/test/cmd/seama.c +++ b/test/cmd/seama.c @@ -26,7 +26,7 @@ static int seama_test_noargs(struct unit_test_state *uts) ut_assert_console_end(); return 0; } -SEAMA_TEST(seama_test_noargs, UT_TESTF_CONSOLE_REC); +SEAMA_TEST(seama_test_noargs, UTF_CONSOLE_REC); static int seama_test_addr(struct unit_test_state *uts) { @@ -42,7 +42,7 @@ static int seama_test_addr(struct unit_test_state *uts) ut_assert_console_end(); return 0; } -SEAMA_TEST(seama_test_addr, UT_TESTF_CONSOLE_REC); +SEAMA_TEST(seama_test_addr, UTF_CONSOLE_REC); static int seama_test_index(struct unit_test_state *uts) { @@ -58,7 +58,7 @@ static int seama_test_index(struct unit_test_state *uts) ut_assert_console_end(); return 0; } -SEAMA_TEST(seama_test_index, UT_TESTF_CONSOLE_REC); +SEAMA_TEST(seama_test_index, UTF_CONSOLE_REC); int do_ut_seama(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { diff --git a/test/cmd/setexpr.c b/test/cmd/setexpr.c index 4c6cc3cf09e..f024a335763 100644 --- a/test/cmd/setexpr.c +++ b/test/cmd/setexpr.c @@ -63,7 +63,7 @@ static int setexpr_test_int(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_int, UT_TESTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_int, UTF_CONSOLE_REC); /* Test 'setexpr' command with + operator */ static int setexpr_test_plus(struct unit_test_state *uts) @@ -105,7 +105,7 @@ static int setexpr_test_plus(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_plus, UT_TESTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_plus, UTF_CONSOLE_REC); /* Test 'setexpr' command with other operators */ static int setexpr_test_oper(struct unit_test_state *uts) @@ -148,7 +148,7 @@ static int setexpr_test_oper(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_oper, UT_TESTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_oper, UTF_CONSOLE_REC); /* Test 'setexpr' command with regex */ static int setexpr_test_regex(struct unit_test_state *uts) @@ -192,7 +192,7 @@ static int setexpr_test_regex(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_regex, UT_TESTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_regex, UTF_CONSOLE_REC); /* Test 'setexpr' command with regex replacement that expands the string */ static int setexpr_test_regex_inc(struct unit_test_state *uts) @@ -209,7 +209,7 @@ static int setexpr_test_regex_inc(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_regex_inc, UT_TESTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_regex_inc, UTF_CONSOLE_REC); /* Test setexpr_regex_sub() directly to check buffer usage */ static int setexpr_test_sub(struct unit_test_state *uts) @@ -249,7 +249,7 @@ static int setexpr_test_sub(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_sub, UT_TESTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_sub, UTF_CONSOLE_REC); /* Test setexpr_regex_sub() with back references */ static int setexpr_test_backref(struct unit_test_state *uts) @@ -292,7 +292,7 @@ static int setexpr_test_backref(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_backref, UT_TESTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_backref, UTF_CONSOLE_REC); /* Test 'setexpr' command with setting strings */ static int setexpr_test_str(struct unit_test_state *uts) @@ -327,7 +327,7 @@ static int setexpr_test_str(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_str, UT_TESTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_str, UTF_CONSOLE_REC); /* Test 'setexpr' command with concatenating strings */ static int setexpr_test_str_oper(struct unit_test_state *uts) @@ -376,7 +376,7 @@ static int setexpr_test_str_oper(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_str_oper, UT_TESTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_str_oper, UTF_CONSOLE_REC); /* Test 'setexpr' command with a string that is too long */ static int setexpr_test_str_long(struct unit_test_state *uts) @@ -396,7 +396,7 @@ static int setexpr_test_str_long(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_str_long, UT_TESTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_str_long, UTF_CONSOLE_REC); #ifdef CONFIG_CMD_SETEXPR_FMT /* Test 'setexpr' command with simply setting integers */ @@ -479,7 +479,7 @@ static int setexpr_test_fmt(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_fmt, UT_TESTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_fmt, UTF_CONSOLE_REC); #endif int do_ut_setexpr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/test/cmd/temperature.c b/test/cmd/temperature.c index 364972626b1..fc0c95f3d81 100644 --- a/test/cmd/temperature.c +++ b/test/cmd/temperature.c @@ -35,4 +35,4 @@ static int dm_test_cmd_temperature(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_cmd_temperature, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC); +DM_TEST(dm_test_cmd_temperature, UTF_SCAN_FDT | UTF_CONSOLE_REC); -- cgit v1.2.3 From b073d48e8dd7d178ebd237089be730d15c72ddfc Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 22 Aug 2024 07:57:49 -0600 Subject: test: Drop the blank line before test macros Most tests don't have this. It helps to keep the test declaration clearly associated with the function it relates to, rather than the next one in the file. Remove the extra blank line and mention this in the docs. Signed-off-by: Simon Glass --- test/cmd/armffa.c | 1 - test/cmd/bdinfo.c | 4 ---- test/cmd/exit.c | 1 - test/cmd/mbr.c | 1 - test/cmd/pci_mps.c | 1 - test/cmd/pinmux.c | 1 - test/cmd/pwm.c | 1 - test/cmd/rw.c | 1 - test/cmd/setexpr.c | 1 - test/cmd/temperature.c | 1 - test/cmd/test_echo.c | 1 - test/cmd/wget.c | 1 - 12 files changed, 15 deletions(-) (limited to 'test/cmd') diff --git a/test/cmd/armffa.c b/test/cmd/armffa.c index f5d5a1b54a3..d7b076cfe7c 100644 --- a/test/cmd/armffa.c +++ b/test/cmd/armffa.c @@ -28,5 +28,4 @@ static int dm_test_armffa_cmd(struct unit_test_state *uts) return 0; } - DM_TEST(dm_test_armffa_cmd, UTF_SCAN_FDT | UTF_CONSOLE_REC); diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c index 973544f63f6..cb88d2ee11b 100644 --- a/test/cmd/bdinfo.c +++ b/test/cmd/bdinfo.c @@ -244,7 +244,6 @@ static int bdinfo_test_full(struct unit_test_state *uts) return 0; } - BDINFO_TEST(bdinfo_test_full, UTF_CONSOLE_REC); static int bdinfo_test_help(struct unit_test_state *uts) @@ -266,7 +265,6 @@ static int bdinfo_test_help(struct unit_test_state *uts) return 0; } - BDINFO_TEST(bdinfo_test_help, UTF_CONSOLE_REC); static int bdinfo_test_memory(struct unit_test_state *uts) @@ -282,7 +280,6 @@ static int bdinfo_test_memory(struct unit_test_state *uts) return 0; } - BDINFO_TEST(bdinfo_test_memory, UTF_CONSOLE_REC); static int bdinfo_test_eth(struct unit_test_state *uts) @@ -298,7 +295,6 @@ static int bdinfo_test_eth(struct unit_test_state *uts) return 0; } - BDINFO_TEST(bdinfo_test_eth, UTF_CONSOLE_REC); int do_ut_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/test/cmd/exit.c b/test/cmd/exit.c index d4aac0facf6..e7e454c7631 100644 --- a/test/cmd/exit.c +++ b/test/cmd/exit.c @@ -121,7 +121,6 @@ static int cmd_exit_test(struct unit_test_state *uts) return 0; } - EXIT_TEST(cmd_exit_test, UTF_CONSOLE_REC); int do_ut_exit(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/test/cmd/mbr.c b/test/cmd/mbr.c index fd601ee5f53..e4b694b728f 100644 --- a/test/cmd/mbr.c +++ b/test/cmd/mbr.c @@ -479,5 +479,4 @@ static int dm_test_cmd_mbr(struct unit_test_state *uts) { return mbr_test_run(uts); } - DM_TEST(dm_test_cmd_mbr, UTF_SCAN_FDT | UTF_CONSOLE_REC); diff --git a/test/cmd/pci_mps.c b/test/cmd/pci_mps.c index f7f77e73a30..755a0649770 100644 --- a/test/cmd/pci_mps.c +++ b/test/cmd/pci_mps.c @@ -27,7 +27,6 @@ static int test_pci_mps_safe(struct unit_test_state *uts) return 0; } - PCI_MPS_TEST(test_pci_mps_safe, UTF_CONSOLE_REC); int do_ut_pci_mps(struct cmd_tbl *cmdtp, int flag, int argc, diff --git a/test/cmd/pinmux.c b/test/cmd/pinmux.c index 23f9b9a9f3a..0b4e001fa1e 100644 --- a/test/cmd/pinmux.c +++ b/test/cmd/pinmux.c @@ -36,5 +36,4 @@ static int dm_test_cmd_pinmux_status_pinname(struct unit_test_state *uts) return 0; } - DM_TEST(dm_test_cmd_pinmux_status_pinname, UTF_SCAN_PDATA | UTF_SCAN_FDT); diff --git a/test/cmd/pwm.c b/test/cmd/pwm.c index 494f31f4dae..44f52e15cbb 100644 --- a/test/cmd/pwm.c +++ b/test/cmd/pwm.c @@ -71,5 +71,4 @@ static int dm_test_pwm_cmd(struct unit_test_state *uts) return 0; } - DM_TEST(dm_test_pwm_cmd, UTF_SCAN_PDATA | UTF_SCAN_FDT | UTF_CONSOLE_REC); diff --git a/test/cmd/rw.c b/test/cmd/rw.c index 3dcf4228ee6..eeda87b53ed 100644 --- a/test/cmd/rw.c +++ b/test/cmd/rw.c @@ -99,5 +99,4 @@ static int dm_test_read_write(struct unit_test_state *uts) return 0; } - DM_TEST(dm_test_read_write, UTF_SCAN_FDT | UTF_CONSOLE_REC); diff --git a/test/cmd/setexpr.c b/test/cmd/setexpr.c index f024a335763..a4086c9451c 100644 --- a/test/cmd/setexpr.c +++ b/test/cmd/setexpr.c @@ -478,7 +478,6 @@ static int setexpr_test_fmt(struct unit_test_state *uts) return 0; } - SETEXPR_TEST(setexpr_test_fmt, UTF_CONSOLE_REC); #endif diff --git a/test/cmd/temperature.c b/test/cmd/temperature.c index fc0c95f3d81..b86c7d44b33 100644 --- a/test/cmd/temperature.c +++ b/test/cmd/temperature.c @@ -34,5 +34,4 @@ static int dm_test_cmd_temperature(struct unit_test_state *uts) return 0; } - DM_TEST(dm_test_cmd_temperature, UTF_SCAN_FDT | UTF_CONSOLE_REC); diff --git a/test/cmd/test_echo.c b/test/cmd/test_echo.c index cde74ebeb61..ee07ab22933 100644 --- a/test/cmd/test_echo.c +++ b/test/cmd/test_echo.c @@ -56,5 +56,4 @@ static int lib_test_hush_echo(struct unit_test_state *uts) } return 0; } - LIB_TEST(lib_test_hush_echo, 0); diff --git a/test/cmd/wget.c b/test/cmd/wget.c index b0feb21dc41..1ce167c4ab4 100644 --- a/test/cmd/wget.c +++ b/test/cmd/wget.c @@ -223,5 +223,4 @@ static int net_test_wget(struct unit_test_state *uts) return 0; } - LIB_TEST(net_test_wget, 0); -- cgit v1.2.3 From 9b99762eff5eac971cd1ae561e443252afb7b985 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 22 Aug 2024 07:57:50 -0600 Subject: test: Rename UTF_CONSOLE_REC to UTF_CONSOLE The _REC suffix doesn't add much. Really what we want to know is whether the test uses the console, so rename this flag. Signed-off-by: Simon Glass Reviewed-by: Mattijs Korpershoek --- test/cmd/addrmap.c | 2 +- test/cmd/armffa.c | 2 +- test/cmd/bdinfo.c | 8 ++++---- test/cmd/exit.c | 2 +- test/cmd/fdt.c | 38 +++++++++++++++++++------------------- test/cmd/font.c | 2 +- test/cmd/history.c | 2 +- test/cmd/loadm.c | 4 ++-- test/cmd/mbr.c | 4 ++-- test/cmd/mem_search.c | 18 +++++++++--------- test/cmd/pci_mps.c | 2 +- test/cmd/pwm.c | 2 +- test/cmd/rw.c | 2 +- test/cmd/seama.c | 6 +++--- test/cmd/setexpr.c | 22 +++++++++++----------- test/cmd/temperature.c | 2 +- 16 files changed, 59 insertions(+), 59 deletions(-) (limited to 'test/cmd') diff --git a/test/cmd/addrmap.c b/test/cmd/addrmap.c index fb4ec316781..abeb467aede 100644 --- a/test/cmd/addrmap.c +++ b/test/cmd/addrmap.c @@ -24,7 +24,7 @@ static int addrmap_test_basic(struct unit_test_state *uts) return 0; } -ADDRMAP_TEST(addrmap_test_basic, UTF_CONSOLE_REC); +ADDRMAP_TEST(addrmap_test_basic, UTF_CONSOLE); int do_ut_addrmap(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { diff --git a/test/cmd/armffa.c b/test/cmd/armffa.c index d7b076cfe7c..fd578f3087f 100644 --- a/test/cmd/armffa.c +++ b/test/cmd/armffa.c @@ -28,4 +28,4 @@ static int dm_test_armffa_cmd(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_armffa_cmd, UTF_SCAN_FDT | UTF_CONSOLE_REC); +DM_TEST(dm_test_armffa_cmd, UTF_SCAN_FDT | UTF_CONSOLE); diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c index cb88d2ee11b..1d038bec29c 100644 --- a/test/cmd/bdinfo.c +++ b/test/cmd/bdinfo.c @@ -244,7 +244,7 @@ static int bdinfo_test_full(struct unit_test_state *uts) return 0; } -BDINFO_TEST(bdinfo_test_full, UTF_CONSOLE_REC); +BDINFO_TEST(bdinfo_test_full, UTF_CONSOLE); static int bdinfo_test_help(struct unit_test_state *uts) { @@ -265,7 +265,7 @@ static int bdinfo_test_help(struct unit_test_state *uts) return 0; } -BDINFO_TEST(bdinfo_test_help, UTF_CONSOLE_REC); +BDINFO_TEST(bdinfo_test_help, UTF_CONSOLE); static int bdinfo_test_memory(struct unit_test_state *uts) { @@ -280,7 +280,7 @@ static int bdinfo_test_memory(struct unit_test_state *uts) return 0; } -BDINFO_TEST(bdinfo_test_memory, UTF_CONSOLE_REC); +BDINFO_TEST(bdinfo_test_memory, UTF_CONSOLE); static int bdinfo_test_eth(struct unit_test_state *uts) { @@ -295,7 +295,7 @@ static int bdinfo_test_eth(struct unit_test_state *uts) return 0; } -BDINFO_TEST(bdinfo_test_eth, UTF_CONSOLE_REC); +BDINFO_TEST(bdinfo_test_eth, UTF_CONSOLE); int do_ut_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { diff --git a/test/cmd/exit.c b/test/cmd/exit.c index e7e454c7631..d416607d610 100644 --- a/test/cmd/exit.c +++ b/test/cmd/exit.c @@ -121,7 +121,7 @@ static int cmd_exit_test(struct unit_test_state *uts) return 0; } -EXIT_TEST(cmd_exit_test, UTF_CONSOLE_REC); +EXIT_TEST(cmd_exit_test, UTF_CONSOLE); int do_ut_exit(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { diff --git a/test/cmd/fdt.c b/test/cmd/fdt.c index 4f935d053c6..721345f0288 100644 --- a/test/cmd/fdt.c +++ b/test/cmd/fdt.c @@ -213,7 +213,7 @@ static int fdt_test_addr(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_addr, UTF_CONSOLE_REC); +FDT_TEST(fdt_test_addr, UTF_CONSOLE); /* Test 'fdt addr' resizing an fdt */ static int fdt_test_addr_resize(struct unit_test_state *uts) @@ -247,7 +247,7 @@ static int fdt_test_addr_resize(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_addr_resize, UTF_CONSOLE_REC); +FDT_TEST(fdt_test_addr_resize, UTF_CONSOLE); static int fdt_test_move(struct unit_test_state *uts) { @@ -281,7 +281,7 @@ static int fdt_test_move(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_move, UTF_CONSOLE_REC); +FDT_TEST(fdt_test_move, UTF_CONSOLE); static int fdt_test_resize(struct unit_test_state *uts) { @@ -305,7 +305,7 @@ static int fdt_test_resize(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_resize, UTF_CONSOLE_REC); +FDT_TEST(fdt_test_resize, UTF_CONSOLE); static int fdt_test_print_list_common(struct unit_test_state *uts, const char *opc, const char *node) @@ -442,13 +442,13 @@ static int fdt_test_print(struct unit_test_state *uts) { return fdt_test_print_list(uts, true); } -FDT_TEST(fdt_test_print, UTF_CONSOLE_REC); +FDT_TEST(fdt_test_print, UTF_CONSOLE); static int fdt_test_list(struct unit_test_state *uts) { return fdt_test_print_list(uts, false); } -FDT_TEST(fdt_test_list, UTF_CONSOLE_REC); +FDT_TEST(fdt_test_list, UTF_CONSOLE); /* Test 'fdt get value' reading an fdt */ static int fdt_test_get_value_string(struct unit_test_state *uts, @@ -554,7 +554,7 @@ static int fdt_test_get_value(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_get_value, UTF_CONSOLE_REC); +FDT_TEST(fdt_test_get_value, UTF_CONSOLE); static int fdt_test_get_name(struct unit_test_state *uts) { @@ -633,7 +633,7 @@ static int fdt_test_get_name(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_get_name, UTF_CONSOLE_REC); +FDT_TEST(fdt_test_get_name, UTF_CONSOLE); static int fdt_test_get_addr_common(struct unit_test_state *uts, char *fdt, const char *path, const char *prop) @@ -700,7 +700,7 @@ static int fdt_test_get_addr(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_get_addr, UTF_CONSOLE_REC); +FDT_TEST(fdt_test_get_addr, UTF_CONSOLE); static int fdt_test_get_size_common(struct unit_test_state *uts, const char *path, const char *prop, @@ -787,7 +787,7 @@ static int fdt_test_get_size(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_get_size, UTF_CONSOLE_REC); +FDT_TEST(fdt_test_get_size, UTF_CONSOLE); static int fdt_test_set_single(struct unit_test_state *uts, const char *path, const char *prop, @@ -929,7 +929,7 @@ static int fdt_test_set(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_set, UTF_CONSOLE_REC); +FDT_TEST(fdt_test_set, UTF_CONSOLE); static int fdt_test_mknode(struct unit_test_state *uts) { @@ -997,7 +997,7 @@ static int fdt_test_mknode(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_mknode, UTF_CONSOLE_REC); +FDT_TEST(fdt_test_mknode, UTF_CONSOLE); static int fdt_test_rm(struct unit_test_state *uts) { @@ -1081,7 +1081,7 @@ static int fdt_test_rm(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_rm, UTF_CONSOLE_REC); +FDT_TEST(fdt_test_rm, UTF_CONSOLE); static int fdt_test_bootcpu(struct unit_test_state *uts) { @@ -1114,7 +1114,7 @@ static int fdt_test_bootcpu(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_bootcpu, UTF_CONSOLE_REC); +FDT_TEST(fdt_test_bootcpu, UTF_CONSOLE); static int fdt_test_header_get(struct unit_test_state *uts, const char *field, const unsigned long val) @@ -1173,7 +1173,7 @@ static int fdt_test_header(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_header, UTF_CONSOLE_REC); +FDT_TEST(fdt_test_header, UTF_CONSOLE); static int fdt_test_memory_cells(struct unit_test_state *uts, const unsigned int cells) @@ -1256,7 +1256,7 @@ static int fdt_test_memory(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_memory, UTF_CONSOLE_REC); +FDT_TEST(fdt_test_memory, UTF_CONSOLE); static int fdt_test_rsvmem(struct unit_test_state *uts) { @@ -1319,7 +1319,7 @@ static int fdt_test_rsvmem(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_rsvmem, UTF_CONSOLE_REC); +FDT_TEST(fdt_test_rsvmem, UTF_CONSOLE); static int fdt_test_chosen(struct unit_test_state *uts) { @@ -1375,7 +1375,7 @@ static int fdt_test_chosen(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_chosen, UTF_CONSOLE_REC); +FDT_TEST(fdt_test_chosen, UTF_CONSOLE); static int fdt_test_apply(struct unit_test_state *uts) { @@ -1527,7 +1527,7 @@ static int fdt_test_apply(struct unit_test_state *uts) return 0; } -FDT_TEST(fdt_test_apply, UTF_CONSOLE_REC); +FDT_TEST(fdt_test_apply, UTF_CONSOLE); int do_ut_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { diff --git a/test/cmd/font.c b/test/cmd/font.c index 3ea262bb703..08600dfe2eb 100644 --- a/test/cmd/font.c +++ b/test/cmd/font.c @@ -69,7 +69,7 @@ static int font_test_base(struct unit_test_state *uts) return 0; } -FONT_TEST(font_test_base, UTF_SCAN_PDATA | UTF_SCAN_FDT | UTF_CONSOLE_REC | +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[]) diff --git a/test/cmd/history.c b/test/cmd/history.c index 9fec4a811f4..6d9d2288483 100644 --- a/test/cmd/history.c +++ b/test/cmd/history.c @@ -45,4 +45,4 @@ static int lib_test_history(struct unit_test_state *uts) return 0; } -LIB_TEST(lib_test_history, UTF_CONSOLE_REC); +LIB_TEST(lib_test_history, UTF_CONSOLE); diff --git a/test/cmd/loadm.c b/test/cmd/loadm.c index 0b6390ebc53..29ae8339183 100644 --- a/test/cmd/loadm.c +++ b/test/cmd/loadm.c @@ -41,7 +41,7 @@ static int loadm_test_params(struct unit_test_state *uts) return 0; } -LOADM_TEST(loadm_test_params, UTF_CONSOLE_REC); +LOADM_TEST(loadm_test_params, UTF_CONSOLE); static int loadm_test_load (struct unit_test_state *uts) { @@ -59,7 +59,7 @@ static int loadm_test_load (struct unit_test_state *uts) return 0; } -LOADM_TEST(loadm_test_load, UTF_CONSOLE_REC); +LOADM_TEST(loadm_test_load, UTF_CONSOLE); int do_ut_loadm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { diff --git a/test/cmd/mbr.c b/test/cmd/mbr.c index e4b694b728f..0c3698afb0b 100644 --- a/test/cmd/mbr.c +++ b/test/cmd/mbr.c @@ -465,7 +465,7 @@ static int mbr_test_run(struct unit_test_state *uts) } /* Declare mbr test */ -UNIT_TEST(mbr_test_run, UTF_CONSOLE_REC, mbr_test); +UNIT_TEST(mbr_test_run, UTF_CONSOLE, mbr_test); int do_ut_mbr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { @@ -479,4 +479,4 @@ static int dm_test_cmd_mbr(struct unit_test_state *uts) { return mbr_test_run(uts); } -DM_TEST(dm_test_cmd_mbr, UTF_SCAN_FDT | UTF_CONSOLE_REC); +DM_TEST(dm_test_cmd_mbr, UTF_SCAN_FDT | UTF_CONSOLE); diff --git a/test/cmd/mem_search.c b/test/cmd/mem_search.c index 9ad0c18152f..1387baea032 100644 --- a/test/cmd/mem_search.c +++ b/test/cmd/mem_search.c @@ -43,7 +43,7 @@ static int mem_test_ms_b(struct unit_test_state *uts) return 0; } -MEM_TEST(mem_test_ms_b, UTF_CONSOLE_REC); +MEM_TEST(mem_test_ms_b, UTF_CONSOLE); /* Test 'ms' command with 16-bit values */ static int mem_test_ms_w(struct unit_test_state *uts) @@ -68,7 +68,7 @@ static int mem_test_ms_w(struct unit_test_state *uts) return 0; } -MEM_TEST(mem_test_ms_w, UTF_CONSOLE_REC); +MEM_TEST(mem_test_ms_w, UTF_CONSOLE); /* Test 'ms' command with 32-bit values */ static int mem_test_ms_l(struct unit_test_state *uts) @@ -102,7 +102,7 @@ static int mem_test_ms_l(struct unit_test_state *uts) return 0; } -MEM_TEST(mem_test_ms_l, UTF_CONSOLE_REC); +MEM_TEST(mem_test_ms_l, UTF_CONSOLE); /* Test 'ms' command with continuation */ static int mem_test_ms_cont(struct unit_test_state *uts) @@ -152,7 +152,7 @@ static int mem_test_ms_cont(struct unit_test_state *uts) return 0; } -MEM_TEST(mem_test_ms_cont, UTF_CONSOLE_REC); +MEM_TEST(mem_test_ms_cont, UTF_CONSOLE); /* Test that an 'ms' command with continuation stops at the end of the range */ static int mem_test_ms_cont_end(struct unit_test_state *uts) @@ -196,7 +196,7 @@ static int mem_test_ms_cont_end(struct unit_test_state *uts) return 0; } -MEM_TEST(mem_test_ms_cont_end, UTF_CONSOLE_REC); +MEM_TEST(mem_test_ms_cont_end, UTF_CONSOLE); /* Test 'ms' command with multiple values */ static int mem_test_ms_mult(struct unit_test_state *uts) @@ -225,7 +225,7 @@ static int mem_test_ms_mult(struct unit_test_state *uts) return 0; } -MEM_TEST(mem_test_ms_mult, UTF_CONSOLE_REC); +MEM_TEST(mem_test_ms_mult, UTF_CONSOLE); /* Test 'ms' command with string */ static int mem_test_ms_s(struct unit_test_state *uts) @@ -268,7 +268,7 @@ static int mem_test_ms_s(struct unit_test_state *uts) return 0; } -MEM_TEST(mem_test_ms_s, UTF_CONSOLE_REC); +MEM_TEST(mem_test_ms_s, UTF_CONSOLE); /* Test 'ms' command with limit */ static int mem_test_ms_limit(struct unit_test_state *uts) @@ -297,7 +297,7 @@ static int mem_test_ms_limit(struct unit_test_state *uts) return 0; } -MEM_TEST(mem_test_ms_limit, UTF_CONSOLE_REC); +MEM_TEST(mem_test_ms_limit, UTF_CONSOLE); /* Test 'ms' command in quiet mode */ static int mem_test_ms_quiet(struct unit_test_state *uts) @@ -321,4 +321,4 @@ static int mem_test_ms_quiet(struct unit_test_state *uts) return 0; } -MEM_TEST(mem_test_ms_quiet, UTF_CONSOLE_REC); +MEM_TEST(mem_test_ms_quiet, UTF_CONSOLE); diff --git a/test/cmd/pci_mps.c b/test/cmd/pci_mps.c index 755a0649770..a265105600c 100644 --- a/test/cmd/pci_mps.c +++ b/test/cmd/pci_mps.c @@ -27,7 +27,7 @@ static int test_pci_mps_safe(struct unit_test_state *uts) return 0; } -PCI_MPS_TEST(test_pci_mps_safe, UTF_CONSOLE_REC); +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[]) diff --git a/test/cmd/pwm.c b/test/cmd/pwm.c index 44f52e15cbb..f8de03fd6d1 100644 --- a/test/cmd/pwm.c +++ b/test/cmd/pwm.c @@ -71,4 +71,4 @@ static int dm_test_pwm_cmd(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_pwm_cmd, UTF_SCAN_PDATA | UTF_SCAN_FDT | UTF_CONSOLE_REC); +DM_TEST(dm_test_pwm_cmd, UTF_SCAN_PDATA | UTF_SCAN_FDT | UTF_CONSOLE); diff --git a/test/cmd/rw.c b/test/cmd/rw.c index eeda87b53ed..1086dcd2914 100644 --- a/test/cmd/rw.c +++ b/test/cmd/rw.c @@ -99,4 +99,4 @@ static int dm_test_read_write(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_read_write, UTF_SCAN_FDT | UTF_CONSOLE_REC); +DM_TEST(dm_test_read_write, UTF_SCAN_FDT | UTF_CONSOLE); diff --git a/test/cmd/seama.c b/test/cmd/seama.c index 235135118cf..802563e4f71 100644 --- a/test/cmd/seama.c +++ b/test/cmd/seama.c @@ -26,7 +26,7 @@ static int seama_test_noargs(struct unit_test_state *uts) ut_assert_console_end(); return 0; } -SEAMA_TEST(seama_test_noargs, UTF_CONSOLE_REC); +SEAMA_TEST(seama_test_noargs, UTF_CONSOLE); static int seama_test_addr(struct unit_test_state *uts) { @@ -42,7 +42,7 @@ static int seama_test_addr(struct unit_test_state *uts) ut_assert_console_end(); return 0; } -SEAMA_TEST(seama_test_addr, UTF_CONSOLE_REC); +SEAMA_TEST(seama_test_addr, UTF_CONSOLE); static int seama_test_index(struct unit_test_state *uts) { @@ -58,7 +58,7 @@ static int seama_test_index(struct unit_test_state *uts) ut_assert_console_end(); return 0; } -SEAMA_TEST(seama_test_index, UTF_CONSOLE_REC); +SEAMA_TEST(seama_test_index, UTF_CONSOLE); int do_ut_seama(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { diff --git a/test/cmd/setexpr.c b/test/cmd/setexpr.c index a4086c9451c..dcd0e3726e4 100644 --- a/test/cmd/setexpr.c +++ b/test/cmd/setexpr.c @@ -63,7 +63,7 @@ static int setexpr_test_int(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_int, UTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_int, UTF_CONSOLE); /* Test 'setexpr' command with + operator */ static int setexpr_test_plus(struct unit_test_state *uts) @@ -105,7 +105,7 @@ static int setexpr_test_plus(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_plus, UTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_plus, UTF_CONSOLE); /* Test 'setexpr' command with other operators */ static int setexpr_test_oper(struct unit_test_state *uts) @@ -148,7 +148,7 @@ static int setexpr_test_oper(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_oper, UTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_oper, UTF_CONSOLE); /* Test 'setexpr' command with regex */ static int setexpr_test_regex(struct unit_test_state *uts) @@ -192,7 +192,7 @@ static int setexpr_test_regex(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_regex, UTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_regex, UTF_CONSOLE); /* Test 'setexpr' command with regex replacement that expands the string */ static int setexpr_test_regex_inc(struct unit_test_state *uts) @@ -209,7 +209,7 @@ static int setexpr_test_regex_inc(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_regex_inc, UTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_regex_inc, UTF_CONSOLE); /* Test setexpr_regex_sub() directly to check buffer usage */ static int setexpr_test_sub(struct unit_test_state *uts) @@ -249,7 +249,7 @@ static int setexpr_test_sub(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_sub, UTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_sub, UTF_CONSOLE); /* Test setexpr_regex_sub() with back references */ static int setexpr_test_backref(struct unit_test_state *uts) @@ -292,7 +292,7 @@ static int setexpr_test_backref(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_backref, UTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_backref, UTF_CONSOLE); /* Test 'setexpr' command with setting strings */ static int setexpr_test_str(struct unit_test_state *uts) @@ -327,7 +327,7 @@ static int setexpr_test_str(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_str, UTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_str, UTF_CONSOLE); /* Test 'setexpr' command with concatenating strings */ static int setexpr_test_str_oper(struct unit_test_state *uts) @@ -376,7 +376,7 @@ static int setexpr_test_str_oper(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_str_oper, UTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_str_oper, UTF_CONSOLE); /* Test 'setexpr' command with a string that is too long */ static int setexpr_test_str_long(struct unit_test_state *uts) @@ -396,7 +396,7 @@ static int setexpr_test_str_long(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_str_long, UTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_str_long, UTF_CONSOLE); #ifdef CONFIG_CMD_SETEXPR_FMT /* Test 'setexpr' command with simply setting integers */ @@ -478,7 +478,7 @@ static int setexpr_test_fmt(struct unit_test_state *uts) return 0; } -SETEXPR_TEST(setexpr_test_fmt, UTF_CONSOLE_REC); +SETEXPR_TEST(setexpr_test_fmt, UTF_CONSOLE); #endif int do_ut_setexpr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/test/cmd/temperature.c b/test/cmd/temperature.c index b86c7d44b33..193fa6324ea 100644 --- a/test/cmd/temperature.c +++ b/test/cmd/temperature.c @@ -34,4 +34,4 @@ static int dm_test_cmd_temperature(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_cmd_temperature, UTF_SCAN_FDT | UTF_CONSOLE_REC); +DM_TEST(dm_test_cmd_temperature, UTF_SCAN_FDT | UTF_CONSOLE); -- cgit v1.2.3 From b8133039fb75650b8baf25a96bfbdcab31147fec Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 22 Aug 2024 07:57:55 -0600 Subject: test: fdt: Check internal-function return values Some functions are using asserts but the result of the functions themselves is not checked. This means that if a test fails, the result is not noticed until later, which can be confusing to debug. Add the missing asserts. Signed-off-by: Simon Glass --- test/cmd/fdt.c | 153 +++++++++++++++++++++++++++++++++------------------------ 1 file changed, 90 insertions(+), 63 deletions(-) (limited to 'test/cmd') diff --git a/test/cmd/fdt.c b/test/cmd/fdt.c index 721345f0288..35d9e84c3d1 100644 --- a/test/cmd/fdt.c +++ b/test/cmd/fdt.c @@ -459,11 +459,10 @@ static int fdt_test_get_value_string(struct unit_test_state *uts, ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt get value var %s %s %s", node, prop, idx ? : "")); - if (strres) { + if (strres) ut_asserteq_str(strres, env_get("var")); - } else { + else ut_asserteq(intres, env_get_hex("var", 0x1234)); - } ut_assertok(ut_check_console_end(uts)); return 0; @@ -473,16 +472,20 @@ static int fdt_test_get_value_common(struct unit_test_state *uts, const char *node) { /* Test getting default element of $node node clock-names property */ - fdt_test_get_value_string(uts, node, "clock-names", NULL, "fixed", 0); + ut_assertok(fdt_test_get_value_string(uts, node, "clock-names", NULL, + "fixed", 0)); /* Test getting 0th element of $node node clock-names property */ - fdt_test_get_value_string(uts, node, "clock-names", "0", "fixed", 0); + ut_assertok(fdt_test_get_value_string(uts, node, "clock-names", "0", + "fixed", 0)); /* Test getting 1st element of $node node clock-names property */ - fdt_test_get_value_string(uts, node, "clock-names", "1", "i2c", 0); + ut_assertok(fdt_test_get_value_string(uts, node, "clock-names", "1", + "i2c", 0)); /* Test getting 2nd element of $node node clock-names property */ - fdt_test_get_value_string(uts, node, "clock-names", "2", "spi", 0); + ut_assertok(fdt_test_get_value_string(uts, node, "clock-names", "2", + "spi", 0)); /* * Test getting default element of $node node regs property. @@ -491,13 +494,16 @@ static int fdt_test_get_value_common(struct unit_test_state *uts, * but only if the array is shorter than 40 characters. Anything * longer is an error. This is a special case for handling hashes. */ - fdt_test_get_value_string(uts, node, "regs", NULL, "3412000000100000", 0); + ut_assertok(fdt_test_get_value_string(uts, node, "regs", NULL, + "3412000000100000", 0)); /* Test getting 0th element of $node node regs property */ - fdt_test_get_value_string(uts, node, "regs", "0", NULL, 0x1234); + ut_assertok(fdt_test_get_value_string(uts, node, "regs", "0", NULL, + 0x1234)); /* Test getting 1st element of $node node regs property */ - fdt_test_get_value_string(uts, node, "regs", "1", NULL, 0x1000); + ut_assertok(fdt_test_get_value_string(uts, node, "regs", "1", NULL, + 0x1000)); /* Test missing 10th element of $node node clock-names property */ ut_assertok(console_record_reset_enable()); @@ -522,17 +528,13 @@ static int fdt_test_get_value(struct unit_test_state *uts) { char fdt[4096]; ulong addr; - int ret; ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt))); addr = map_to_sysmem(fdt); set_working_fdt_addr(addr); - ret = fdt_test_get_value_common(uts, "/test-node@1234"); - if (!ret) - ret = fdt_test_get_value_common(uts, "testnodealias"); - if (ret) - return ret; + ut_assertok(fdt_test_get_value_common(uts, "/test-node@1234")); + ut_assertok(fdt_test_get_value_common(uts, "testnodealias")); /* Test getting default element of /nonexistent node */ ut_assertok(console_record_reset_enable()); @@ -668,23 +670,31 @@ static int fdt_test_get_addr(struct unit_test_state *uts) set_working_fdt_addr(addr); /* Test getting address of root node / string property "compatible" */ - fdt_test_get_addr_common(uts, fdt, "/", "compatible"); + ut_assertok(fdt_test_get_addr_common(uts, fdt, "/", "compatible")); /* Test getting address of node /test-node@1234 stringlist property "clock-names" */ - fdt_test_get_addr_common(uts, fdt, "/test-node@1234", "clock-names"); - fdt_test_get_addr_common(uts, fdt, "testnodealias", "clock-names"); + ut_assertok(fdt_test_get_addr_common(uts, fdt, "/test-node@1234", + "clock-names")); + ut_assertok(fdt_test_get_addr_common(uts, fdt, "testnodealias", + "clock-names")); /* Test getting address of node /test-node@1234 u32 property "clock-frequency" */ - fdt_test_get_addr_common(uts, fdt, "/test-node@1234", "clock-frequency"); - fdt_test_get_addr_common(uts, fdt, "testnodealias", "clock-frequency"); + ut_assertok(fdt_test_get_addr_common(uts, fdt, "/test-node@1234", + "clock-frequency")); + ut_assertok(fdt_test_get_addr_common(uts, fdt, "testnodealias", + "clock-frequency")); /* Test getting address of node /test-node@1234 empty property "u-boot,empty-property" */ - fdt_test_get_addr_common(uts, fdt, "/test-node@1234", "u-boot,empty-property"); - fdt_test_get_addr_common(uts, fdt, "testnodealias", "u-boot,empty-property"); + ut_assertok(fdt_test_get_addr_common(uts, fdt, "/test-node@1234", + "u-boot,empty-property")); + ut_assertok(fdt_test_get_addr_common(uts, fdt, "testnodealias", + "u-boot,empty-property")); /* Test getting address of node /test-node@1234 array property "regs" */ - fdt_test_get_addr_common(uts, fdt, "/test-node@1234", "regs"); - fdt_test_get_addr_common(uts, fdt, "testnodealias", "regs"); + ut_assertok(fdt_test_get_addr_common(uts, fdt, "/test-node@1234", + "regs")); + ut_assertok(fdt_test_get_addr_common(uts, fdt, "testnodealias", + "regs")); /* Test getting address of node /test-node@1234/subnode non-existent property "noprop" */ ut_assertok(console_record_reset_enable()); @@ -728,30 +738,38 @@ static int fdt_test_get_size(struct unit_test_state *uts) set_working_fdt_addr(addr); /* Test getting size of root node / string property "compatible" */ - fdt_test_get_size_common(uts, "/", "compatible", 16); + ut_assertok(fdt_test_get_size_common(uts, "/", "compatible", 16)); /* Test getting size of node /test-node@1234 stringlist property "clock-names" */ - fdt_test_get_size_common(uts, "/test-node@1234", "clock-names", 26); - fdt_test_get_size_common(uts, "testnodealias", "clock-names", 26); + ut_assertok(fdt_test_get_size_common(uts, "/test-node@1234", + "clock-names", 26)); + ut_assertok(fdt_test_get_size_common(uts, "testnodealias", + "clock-names", 26)); /* Test getting size of node /test-node@1234 u32 property "clock-frequency" */ - fdt_test_get_size_common(uts, "/test-node@1234", "clock-frequency", 4); - fdt_test_get_size_common(uts, "testnodealias", "clock-frequency", 4); + ut_assertok(fdt_test_get_size_common(uts, "/test-node@1234", + "clock-frequency", 4)); + ut_assertok(fdt_test_get_size_common(uts, "testnodealias", + "clock-frequency", 4)); /* Test getting size of node /test-node@1234 empty property "u-boot,empty-property" */ - fdt_test_get_size_common(uts, "/test-node@1234", "u-boot,empty-property", 0); - fdt_test_get_size_common(uts, "testnodealias", "u-boot,empty-property", 0); + ut_assertok(fdt_test_get_size_common(uts, "/test-node@1234", + "u-boot,empty-property", 0)); + ut_assertok(fdt_test_get_size_common(uts, "testnodealias", + "u-boot,empty-property", 0)); /* Test getting size of node /test-node@1234 array property "regs" */ - fdt_test_get_size_common(uts, "/test-node@1234", "regs", 8); - fdt_test_get_size_common(uts, "testnodealias", "regs", 8); + ut_assertok(fdt_test_get_size_common(uts, "/test-node@1234", "regs", + 8)); + ut_assertok(fdt_test_get_size_common(uts, "testnodealias", "regs", 8)); /* Test getting node count of node / */ - fdt_test_get_size_common(uts, "/", NULL, 2); + ut_assertok(fdt_test_get_size_common(uts, "/", NULL, 2)); /* Test getting node count of node /test-node@1234/subnode */ - fdt_test_get_size_common(uts, "/test-node@1234/subnode", NULL, 0); - fdt_test_get_size_common(uts, "subnodealias", NULL, 0); + ut_assertok(fdt_test_get_size_common(uts, "/test-node@1234/subnode", + NULL, 0)); + ut_assertok(fdt_test_get_size_common(uts, "subnodealias", NULL, 0)); /* Test getting size of node /test-node@1234/subnode non-existent property "noprop" */ ut_assertok(console_record_reset_enable()); @@ -873,14 +891,14 @@ static int fdt_test_set_multi(struct unit_test_state *uts, static int fdt_test_set_node(struct unit_test_state *uts, const char *path, const char *prop) { - fdt_test_set_single(uts, path, prop, "new", 0, false); - fdt_test_set_single(uts, path, prop, "rewrite", 0, false); - fdt_test_set_single(uts, path, prop, NULL, 42, true); - fdt_test_set_single(uts, path, prop, NULL, 0, false); - fdt_test_set_multi(uts, path, prop, NULL, NULL, 42, 1701); - fdt_test_set_multi(uts, path, prop, NULL, NULL, 74656, 9); - fdt_test_set_multi(uts, path, prop, "42", "1701", 0, 0); - fdt_test_set_multi(uts, path, prop, "74656", "9", 0, 0); + ut_assertok(fdt_test_set_single(uts, path, prop, "new", 0, false)); + ut_assertok(fdt_test_set_single(uts, path, prop, "rewrite", 0, false)); + ut_assertok(fdt_test_set_single(uts, path, prop, NULL, 42, true)); + ut_assertok(fdt_test_set_single(uts, path, prop, NULL, 0, false)); + ut_assertok(fdt_test_set_multi(uts, path, prop, NULL, NULL, 42, 1701)); + ut_assertok(fdt_test_set_multi(uts, path, prop, NULL, NULL, 74656, 9)); + ut_assertok(fdt_test_set_multi(uts, path, prop, "42", "1701", 0, 0)); + ut_assertok(fdt_test_set_multi(uts, path, prop, "74656", "9", 0, 0)); return 0; } @@ -896,18 +914,20 @@ static int fdt_test_set(struct unit_test_state *uts) set_working_fdt_addr(addr); /* Test setting of root node / existing property "compatible" */ - fdt_test_set_node(uts, "/", "compatible"); + ut_assertok(fdt_test_set_node(uts, "/", "compatible")); /* Test setting of root node / new property "newproperty" */ - fdt_test_set_node(uts, "/", "newproperty"); + ut_assertok(fdt_test_set_node(uts, "/", "newproperty")); /* Test setting of subnode existing property "compatible" */ - fdt_test_set_node(uts, "/test-node@1234/subnode", "compatible"); - fdt_test_set_node(uts, "subnodealias", "compatible"); + ut_assertok(fdt_test_set_node(uts, "/test-node@1234/subnode", + "compatible")); + ut_assertok(fdt_test_set_node(uts, "subnodealias", "compatible")); /* Test setting of subnode new property "newproperty" */ - fdt_test_set_node(uts, "/test-node@1234/subnode", "newproperty"); - fdt_test_set_node(uts, "subnodealias", "newproperty"); + ut_assertok(fdt_test_set_node(uts, "/test-node@1234/subnode", + "newproperty")); + ut_assertok(fdt_test_set_node(uts, "subnodealias", "newproperty")); /* Test setting property of non-existent node */ ut_assertok(console_record_reset_enable()); @@ -1160,16 +1180,23 @@ static int fdt_test_header(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Test header get */ - fdt_test_header_get(uts, "magic", fdt_magic(fdt)); - fdt_test_header_get(uts, "totalsize", fdt_totalsize(fdt)); - fdt_test_header_get(uts, "off_dt_struct", fdt_off_dt_struct(fdt)); - fdt_test_header_get(uts, "off_dt_strings", fdt_off_dt_strings(fdt)); - fdt_test_header_get(uts, "off_mem_rsvmap", fdt_off_mem_rsvmap(fdt)); - fdt_test_header_get(uts, "version", fdt_version(fdt)); - fdt_test_header_get(uts, "last_comp_version", fdt_last_comp_version(fdt)); - fdt_test_header_get(uts, "boot_cpuid_phys", fdt_boot_cpuid_phys(fdt)); - fdt_test_header_get(uts, "size_dt_strings", fdt_size_dt_strings(fdt)); - fdt_test_header_get(uts, "size_dt_struct", fdt_size_dt_struct(fdt)); + ut_assertok(fdt_test_header_get(uts, "magic", fdt_magic(fdt))); + ut_assertok(fdt_test_header_get(uts, "totalsize", fdt_totalsize(fdt))); + ut_assertok(fdt_test_header_get(uts, "off_dt_struct", + fdt_off_dt_struct(fdt))); + ut_assertok(fdt_test_header_get(uts, "off_dt_strings", + fdt_off_dt_strings(fdt))); + ut_assertok(fdt_test_header_get(uts, "off_mem_rsvmap", + fdt_off_mem_rsvmap(fdt))); + ut_assertok(fdt_test_header_get(uts, "version", fdt_version(fdt))); + ut_assertok(fdt_test_header_get(uts, "last_comp_version", + fdt_last_comp_version(fdt))); + ut_assertok(fdt_test_header_get(uts, "boot_cpuid_phys", + fdt_boot_cpuid_phys(fdt))); + ut_assertok(fdt_test_header_get(uts, "size_dt_strings", + fdt_size_dt_strings(fdt))); + ut_assertok(fdt_test_header_get(uts, "size_dt_struct", + fdt_size_dt_struct(fdt))); return 0; } @@ -1244,8 +1271,8 @@ static int fdt_test_memory(struct unit_test_state *uts) * so far unsupported and fails because of simple_stroull() being * 64bit tops in the 'fdt memory' command implementation. */ - fdt_test_memory_cells(uts, 1); - fdt_test_memory_cells(uts, 2); + ut_assertok(fdt_test_memory_cells(uts, 1)); + ut_assertok(fdt_test_memory_cells(uts, 2)); /* * The 'fdt memory' command is limited to /memory node, it does -- cgit v1.2.3 From 2b60f8c8b132e3d3fe4af74931055fa045ec81c9 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 22 Aug 2024 07:57:56 -0600 Subject: test: fdt: Move common code into the setup functions Quite a lot of tests have the same two lines of code at the start. Move this into the two setup functions to reduce redundancy. Add a line to check the output from set_working_fdt_addr() since this is always emitted. Signed-off-by: Simon Glass --- test/cmd/fdt.c | 92 +++++++++++++++++++++++++--------------------------------- 1 file changed, 39 insertions(+), 53 deletions(-) (limited to 'test/cmd') diff --git a/test/cmd/fdt.c b/test/cmd/fdt.c index 35d9e84c3d1..d7b96bc5725 100644 --- a/test/cmd/fdt.c +++ b/test/cmd/fdt.c @@ -28,35 +28,49 @@ DECLARE_GLOBAL_DATA_PTR; /** * make_test_fdt() - Create an FDT with just a root node * - * The size is set to the minimum needed + * The size is set to the minimum needed. This also sets the working FDT and + * checks that the expected output is received from doing so. * * @uts: Test state * @fdt: Place to write FDT * @size: Maximum size of space for fdt + * @addrp: Returns address of the devicetree */ -static int make_test_fdt(struct unit_test_state *uts, void *fdt, int size) +static int make_test_fdt(struct unit_test_state *uts, void *fdt, int size, + ulong *addrp) { + ulong addr; + ut_assertok(fdt_create(fdt, size)); ut_assertok(fdt_finish_reservemap(fdt)); ut_assert(fdt_begin_node(fdt, "") >= 0); ut_assertok(fdt_end_node(fdt)); ut_assertok(fdt_finish(fdt)); + addr = map_to_sysmem(fdt); + set_working_fdt_addr(addr); + ut_assert_nextline("Working FDT set to %lx", addr); + *addrp = addr; + return 0; } /** * make_fuller_fdt() - Create an FDT with root node and properties * - * The size is set to the minimum needed + * The size is set to the minimum needed. This also sets the working FDT and + * checks that the expected output is received from doing so. * * @uts: Test state * @fdt: Place to write FDT * @size: Maximum size of space for fdt + * @addrp: Returns address of the devicetree */ -static int make_fuller_fdt(struct unit_test_state *uts, void *fdt, int size) +static int make_fuller_fdt(struct unit_test_state *uts, void *fdt, int size, + ulong *addrp) { fdt32_t regs[2] = { cpu_to_fdt32(0x1234), cpu_to_fdt32(0x1000) }; + ulong addr; /* * Assemble the following DT for test purposes: @@ -138,6 +152,11 @@ static int make_fuller_fdt(struct unit_test_state *uts, void *fdt, int size) ut_assertok(fdt_end_node(fdt)); ut_assertok(fdt_finish(fdt)); + addr = map_to_sysmem(fdt); + set_working_fdt_addr(addr); + ut_assert_nextline("Working FDT set to %lx", addr); + *addrp = addr; + return 0; } @@ -169,10 +188,7 @@ static int fdt_test_addr(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Set up a working FDT and try again */ - ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt))); - addr = map_to_sysmem(fdt); - set_working_fdt_addr(addr); - ut_assert_nextline("Working FDT set to %lx", addr); + ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt), &addr)); ut_assertok(run_command("fdt addr", 0)); ut_assert_nextline("Working fdt: %08lx", (ulong)map_to_sysmem(fdt)); ut_assertok(ut_check_console_end(uts)); @@ -222,9 +238,7 @@ static int fdt_test_addr_resize(struct unit_test_state *uts) const int newsize = sizeof(fdt) / 2; ulong addr; - ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt))); - addr = map_to_sysmem(fdt); - set_working_fdt_addr(addr); + ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt), &addr)); /* Test setting and resizing the working FDT to a larger size */ ut_assertok(console_record_reset_enable()); @@ -258,10 +272,8 @@ static int fdt_test_move(struct unit_test_state *uts) void *buf; /* Original source DT */ - ut_assertok(make_test_fdt(uts, fdt, size)); + ut_assertok(make_test_fdt(uts, fdt, size, &addr)); ts = fdt_totalsize(fdt); - addr = map_to_sysmem(fdt); - set_working_fdt_addr(addr); /* Moved target DT location */ buf = map_sysmem(newaddr, size); @@ -291,11 +303,9 @@ static int fdt_test_resize(struct unit_test_state *uts) ulong addr; /* Original source DT */ - ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt))); + ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt), &addr)); fdt_shrink_to_minimum(fdt, 0); /* Resize with 0 extra bytes */ ts = fdt_totalsize(fdt); - addr = map_to_sysmem(fdt); - set_working_fdt_addr(addr); /* Test resizing the working FDT and verify the new space was added */ ut_assertok(console_record_reset_enable()); @@ -393,9 +403,7 @@ static int fdt_test_print_list(struct unit_test_state *uts, bool print) int ret; /* Original source DT */ - ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt))); - addr = map_to_sysmem(fdt); - set_working_fdt_addr(addr); + ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt), &addr)); /* Test printing/listing the working FDT -- node / */ ut_assertok(console_record_reset_enable()); @@ -529,9 +537,7 @@ static int fdt_test_get_value(struct unit_test_state *uts) char fdt[4096]; ulong addr; - ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt))); - addr = map_to_sysmem(fdt); - set_working_fdt_addr(addr); + ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt), &addr)); ut_assertok(fdt_test_get_value_common(uts, "/test-node@1234")); ut_assertok(fdt_test_get_value_common(uts, "testnodealias")); @@ -563,9 +569,7 @@ static int fdt_test_get_name(struct unit_test_state *uts) char fdt[4096]; ulong addr; - ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt))); - addr = map_to_sysmem(fdt); - set_working_fdt_addr(addr); + ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt), &addr)); /* Test getting name of node 0 in /, which is /aliases node */ ut_assertok(console_record_reset_enable()); @@ -665,9 +669,7 @@ static int fdt_test_get_addr(struct unit_test_state *uts) char fdt[4096]; ulong addr; - ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt))); - addr = map_to_sysmem(fdt); - set_working_fdt_addr(addr); + ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt), &addr)); /* Test getting address of root node / string property "compatible" */ ut_assertok(fdt_test_get_addr_common(uts, fdt, "/", "compatible")); @@ -733,9 +735,7 @@ static int fdt_test_get_size(struct unit_test_state *uts) char fdt[4096]; ulong addr; - ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt))); - addr = map_to_sysmem(fdt); - set_working_fdt_addr(addr); + ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt), &addr)); /* Test getting size of root node / string property "compatible" */ ut_assertok(fdt_test_get_size_common(uts, "/", "compatible", 16)); @@ -908,10 +908,8 @@ static int fdt_test_set(struct unit_test_state *uts) char fdt[8192]; ulong addr; - ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt))); + ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt), &addr)); fdt_shrink_to_minimum(fdt, 4096); /* Resize with 4096 extra bytes */ - addr = map_to_sysmem(fdt); - set_working_fdt_addr(addr); /* Test setting of root node / existing property "compatible" */ ut_assertok(fdt_test_set_node(uts, "/", "compatible")); @@ -956,10 +954,8 @@ static int fdt_test_mknode(struct unit_test_state *uts) char fdt[8192]; ulong addr; - ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt))); + ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt), &addr)); fdt_shrink_to_minimum(fdt, 4096); /* Resize with 4096 extra bytes */ - addr = map_to_sysmem(fdt); - set_working_fdt_addr(addr); /* Test creation of new node in / */ ut_assertok(console_record_reset_enable()); @@ -1024,9 +1020,7 @@ static int fdt_test_rm(struct unit_test_state *uts) char fdt[4096]; ulong addr; - ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt))); - addr = map_to_sysmem(fdt); - set_working_fdt_addr(addr); + ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt), &addr)); /* Test removal of property in root node / */ ut_assertok(console_record_reset_enable()); @@ -1109,9 +1103,7 @@ static int fdt_test_bootcpu(struct unit_test_state *uts) ulong addr; int i; - ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt))); - addr = map_to_sysmem(fdt); - set_working_fdt_addr(addr); + ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt), &addr)); /* Test getting default bootcpu entry */ ut_assertok(console_record_reset_enable()); @@ -1158,9 +1150,7 @@ static int fdt_test_header(struct unit_test_state *uts) char fdt[256]; ulong addr; - ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt))); - addr = map_to_sysmem(fdt); - set_working_fdt_addr(addr); + ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt), &addr)); /* Test header print */ ut_assertok(console_record_reset_enable()); @@ -1290,12 +1280,10 @@ static int fdt_test_rsvmem(struct unit_test_state *uts) char fdt[8192]; ulong addr; - ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt))); + ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt), &addr)); fdt_shrink_to_minimum(fdt, 4096); /* Resize with 4096 extra bytes */ fdt_add_mem_rsv(fdt, 0x42, 0x1701); fdt_add_mem_rsv(fdt, 0x74656, 0x9); - addr = map_to_sysmem(fdt); - set_working_fdt_addr(addr); /* Test default reserved memory node presence */ ut_assertok(console_record_reset_enable()); @@ -1354,10 +1342,8 @@ static int fdt_test_chosen(struct unit_test_state *uts) char fdt[8192]; ulong addr; - ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt))); + ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt), &addr)); fdt_shrink_to_minimum(fdt, 4096); /* Resize with 4096 extra bytes */ - addr = map_to_sysmem(fdt); - set_working_fdt_addr(addr); /* Test default chosen node presence, fail as there is no /chosen node */ ut_assertok(console_record_reset_enable()); -- cgit v1.2.3 From 0e77c2b6117c1a8497676b33de85766c3f3a904c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 22 Aug 2024 07:57:57 -0600 Subject: test: cmd: Use UTF_CONSOLE in tests Set this flag rather than doing things manually in the test. Signed-off-by: Simon Glass --- test/cmd/pinmux.c | 3 ++- test/cmd/wget.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'test/cmd') diff --git a/test/cmd/pinmux.c b/test/cmd/pinmux.c index 0b4e001fa1e..7ee92690756 100644 --- a/test/cmd/pinmux.c +++ b/test/cmd/pinmux.c @@ -36,4 +36,5 @@ static int dm_test_cmd_pinmux_status_pinname(struct unit_test_state *uts) return 0; } -DM_TEST(dm_test_cmd_pinmux_status_pinname, UTF_SCAN_PDATA | UTF_SCAN_FDT); +DM_TEST(dm_test_cmd_pinmux_status_pinname, UTF_SCAN_PDATA | UTF_SCAN_FDT | + UTF_CONSOLE); diff --git a/test/cmd/wget.c b/test/cmd/wget.c index 1ce167c4ab4..a91aa24722c 100644 --- a/test/cmd/wget.c +++ b/test/cmd/wget.c @@ -223,4 +223,4 @@ static int net_test_wget(struct unit_test_state *uts) return 0; } -LIB_TEST(net_test_wget, 0); +LIB_TEST(net_test_wget, UTF_CONSOLE); -- cgit v1.2.3 From 0af38d12d98070bc09001e200b15c7e0d6a80388 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 22 Aug 2024 07:57:58 -0600 Subject: test: cmd: Drop unnecessary console_record_reset_enable() It is seldom necessary to call this function. Drop its use in the command tests. Add a few extra checks to the wget test so that resetting is not needed. Signed-off-by: Simon Glass --- test/cmd/addrmap.c | 1 - test/cmd/bdinfo.c | 4 --- test/cmd/exit.c | 12 -------- test/cmd/fdt.c | 83 ++------------------------------------------------ test/cmd/font.c | 1 - test/cmd/loadm.c | 2 -- test/cmd/mbr.c | 7 +---- test/cmd/mem_search.c | 13 -------- test/cmd/pinmux.c | 3 -- test/cmd/pwm.c | 4 --- test/cmd/rw.c | 2 -- test/cmd/seama.c | 3 -- test/cmd/setexpr.c | 1 - test/cmd/temperature.c | 2 -- test/cmd/test_echo.c | 5 +-- test/cmd/test_pause.c | 5 +-- test/cmd/wget.c | 4 ++- 17 files changed, 8 insertions(+), 144 deletions(-) (limited to 'test/cmd') diff --git a/test/cmd/addrmap.c b/test/cmd/addrmap.c index abeb467aede..b34be895f5d 100644 --- a/test/cmd/addrmap.c +++ b/test/cmd/addrmap.c @@ -15,7 +15,6 @@ /* Test 'addrmap' command output */ static int addrmap_test_basic(struct unit_test_state *uts) { - ut_assertok(console_record_reset_enable()); ut_assertok(run_command("addrmap", 0)); ut_assert_nextline(" vaddr paddr size"); ut_assert_nextline("================ ================ ================"); diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c index 1d038bec29c..810174fe8d1 100644 --- a/test/cmd/bdinfo.c +++ b/test/cmd/bdinfo.c @@ -235,7 +235,6 @@ static int bdinfo_test_all(struct unit_test_state *uts) static int bdinfo_test_full(struct unit_test_state *uts) { /* Test BDINFO full print */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("bdinfo")); ut_assertok(bdinfo_test_all(uts)); ut_assertok(run_commandf("bdinfo -a")); @@ -249,7 +248,6 @@ BDINFO_TEST(bdinfo_test_full, UTF_CONSOLE); static int bdinfo_test_help(struct unit_test_state *uts) { /* Test BDINFO unknown option help text print */ - ut_assertok(console_record_reset_enable()); if (!CONFIG_IS_ENABLED(GETOPT)) { ut_asserteq(0, run_commandf("bdinfo -h")); ut_assertok(bdinfo_test_all(uts)); @@ -270,7 +268,6 @@ BDINFO_TEST(bdinfo_test_help, UTF_CONSOLE); static int bdinfo_test_memory(struct unit_test_state *uts) { /* Test BDINFO memory layout only print */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("bdinfo -m")); if (!CONFIG_IS_ENABLED(GETOPT)) ut_assertok(bdinfo_test_all(uts)); @@ -285,7 +282,6 @@ BDINFO_TEST(bdinfo_test_memory, UTF_CONSOLE); static int bdinfo_test_eth(struct unit_test_state *uts) { /* Test BDINFO ethernet settings only print */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("bdinfo -e")); if (!CONFIG_IS_ENABLED(GETOPT)) ut_assertok(bdinfo_test_all(uts)); diff --git a/test/cmd/exit.c b/test/cmd/exit.c index d416607d610..093f51b4dfc 100644 --- a/test/cmd/exit.c +++ b/test/cmd/exit.c @@ -33,13 +33,11 @@ static int cmd_exit_test(struct unit_test_state *uts) * - return value can be printed outside of 'run' command */ for (i = -3; i <= 3; i++) { - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("setenv foo 'echo bar ; exit %d ; echo baz' ; run foo ; echo $?", i)); ut_assert_nextline("bar"); ut_assert_nextline("%d", i > 0 ? i : 0); ut_assertok(ut_check_console_end(uts)); - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("setenv foo 'echo bar ; exit %d ; echo baz' ; run foo && echo quux ; echo $?", i)); ut_assert_nextline("bar"); if (i <= 0) @@ -47,7 +45,6 @@ static int cmd_exit_test(struct unit_test_state *uts) ut_assert_nextline("%d", i > 0 ? i : 0); ut_assertok(ut_check_console_end(uts)); - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("setenv foo 'echo bar ; exit %d ; echo baz' ; run foo || echo quux ; echo $?", i)); ut_assert_nextline("bar"); if (i > 0) @@ -58,20 +55,17 @@ static int cmd_exit_test(struct unit_test_state *uts) } /* Validate that 'exit' behaves the same way as 'exit 0' */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("setenv foo 'echo bar ; exit ; echo baz' ; run foo ; echo $?")); ut_assert_nextline("bar"); ut_assert_nextline("0"); ut_assertok(ut_check_console_end(uts)); - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("setenv foo 'echo bar ; exit ; echo baz' ; run foo && echo quux ; echo $?")); ut_assert_nextline("bar"); ut_assert_nextline("quux"); ut_assert_nextline("0"); ut_assertok(ut_check_console_end(uts)); - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("setenv foo 'echo bar ; exit ; echo baz' ; run foo || echo quux ; echo $?")); ut_assert_nextline("bar"); /* Either 'exit' returns 0, or 'echo quux' returns 0 */ @@ -79,39 +73,33 @@ static int cmd_exit_test(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Validate that return value still propagates from 'run' command */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("setenv foo 'echo bar ; true' ; run foo ; echo $?")); ut_assert_nextline("bar"); ut_assert_nextline("0"); ut_assertok(ut_check_console_end(uts)); - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("setenv foo 'echo bar ; true' ; run foo && echo quux ; echo $?")); ut_assert_nextline("bar"); ut_assert_nextline("quux"); ut_assert_nextline("0"); ut_assertok(ut_check_console_end(uts)); - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("setenv foo 'echo bar ; true' ; run foo || echo quux ; echo $?")); ut_assert_nextline("bar"); /* The 'true' returns 0 */ ut_assert_nextline("0"); ut_assertok(ut_check_console_end(uts)); - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("setenv foo 'echo bar ; false' ; run foo ; echo $?")); ut_assert_nextline("bar"); ut_assert_nextline("1"); ut_assertok(ut_check_console_end(uts)); - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("setenv foo 'echo bar ; false' ; run foo && echo quux ; echo $?")); ut_assert_nextline("bar"); ut_assert_nextline("1"); ut_assertok(ut_check_console_end(uts)); - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("setenv foo 'echo bar ; false' ; run foo || echo quux ; echo $?")); ut_assert_nextline("bar"); ut_assert_nextline("quux"); diff --git a/test/cmd/fdt.c b/test/cmd/fdt.c index d7b96bc5725..ac0d6f06150 100644 --- a/test/cmd/fdt.c +++ b/test/cmd/fdt.c @@ -168,7 +168,6 @@ static int fdt_test_addr(struct unit_test_state *uts) ulong addr; int ret; - ut_assertok(console_record_reset_enable()); ut_assertok(run_command("fdt addr -c", 0)); ut_assert_nextline("Control fdt: %08lx", (ulong)map_to_sysmem(gd->fdt_blob)); @@ -241,7 +240,6 @@ static int fdt_test_addr_resize(struct unit_test_state *uts) ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt), &addr)); /* Test setting and resizing the working FDT to a larger size */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt addr %08lx %x", addr, newsize)); ut_assert_nextline("Working FDT set to %lx", addr); ut_assertok(ut_check_console_end(uts)); @@ -280,13 +278,11 @@ static int fdt_test_move(struct unit_test_state *uts) memset(buf, 0, size); /* Test moving the working FDT to a new location */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt move %08lx %08lx %x", addr, newaddr, ts)); ut_assert_nextline("Working FDT set to %lx", newaddr); ut_assertok(ut_check_console_end(uts)); /* Compare the source and destination DTs */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("cmp.b %08lx %08lx %x", addr, newaddr, ts)); ut_assert_nextline("Total of %d byte(s) were the same", ts); ut_assertok(ut_check_console_end(uts)); @@ -308,7 +304,6 @@ static int fdt_test_resize(struct unit_test_state *uts) ts = fdt_totalsize(fdt); /* Test resizing the working FDT and verify the new space was added */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt resize %x", newsize)); ut_asserteq(ts + newsize, fdt_totalsize(fdt)); ut_assertok(ut_check_console_end(uts)); @@ -324,7 +319,6 @@ static int fdt_test_print_list_common(struct unit_test_state *uts, * Test printing/listing the working FDT * subnode $node/subnode */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt %s %s/subnode", opc, node)); ut_assert_nextline("subnode {"); ut_assert_nextline("\t#address-cells = <0x00000000>;"); @@ -337,7 +331,6 @@ static int fdt_test_print_list_common(struct unit_test_state *uts, * Test printing/listing the working FDT * path / string property model */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt %s / model", opc)); ut_assert_nextline("model = \"U-Boot FDT test\""); ut_assertok(ut_check_console_end(uts)); @@ -346,7 +339,6 @@ static int fdt_test_print_list_common(struct unit_test_state *uts, * Test printing/listing the working FDT * path $node string property compatible */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt %s %s compatible", opc, node)); ut_assert_nextline("compatible = \"u-boot,fdt-test-device1\""); ut_assertok(ut_check_console_end(uts)); @@ -355,7 +347,6 @@ static int fdt_test_print_list_common(struct unit_test_state *uts, * Test printing/listing the working FDT * path $node stringlist property clock-names */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt %s %s clock-names", opc, node)); ut_assert_nextline("clock-names = \"fixed\", \"i2c\", \"spi\", \"uart2\", \"uart1\""); ut_assertok(ut_check_console_end(uts)); @@ -364,7 +355,6 @@ static int fdt_test_print_list_common(struct unit_test_state *uts, * Test printing/listing the working FDT * path $node u32 property clock-frequency */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt %s %s clock-frequency", opc, node)); ut_assert_nextline("clock-frequency = <0x00fde800>"); ut_assertok(ut_check_console_end(uts)); @@ -373,7 +363,6 @@ static int fdt_test_print_list_common(struct unit_test_state *uts, * Test printing/listing the working FDT * path $node empty property u-boot,empty-property */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt %s %s u-boot,empty-property", opc, node)); /* * This is the only 'fdt print' / 'fdt list' incantation which @@ -387,7 +376,6 @@ static int fdt_test_print_list_common(struct unit_test_state *uts, * Test printing/listing the working FDT * path $node prop-encoded array property regs */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt %s %s regs", opc, node)); ut_assert_nextline("regs = <0x00001234 0x00001000>"); ut_assertok(ut_check_console_end(uts)); @@ -406,7 +394,6 @@ static int fdt_test_print_list(struct unit_test_state *uts, bool print) ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt), &addr)); /* Test printing/listing the working FDT -- node / */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt %s", opc)); ut_assert_nextline("/ {"); ut_assert_nextline("\t#address-cells = <0x00000001>;"); @@ -464,7 +451,6 @@ static int fdt_test_get_value_string(struct unit_test_state *uts, const char *idx, const char *strres, const int intres) { - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt get value var %s %s %s", node, prop, idx ? : "")); if (strres) @@ -514,17 +500,14 @@ static int fdt_test_get_value_common(struct unit_test_state *uts, 0x1000)); /* Test missing 10th element of $node node clock-names property */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_commandf("fdt get value ften %s clock-names 10", node)); ut_assertok(ut_check_console_end(uts)); /* Test missing 10th element of $node node regs property */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_commandf("fdt get value ften %s regs 10", node)); ut_assertok(ut_check_console_end(uts)); /* Test getting default element of $node node nonexistent property */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_commandf("fdt get value fnone %s nonexistent", node)); ut_assert_nextline("libfdt fdt_getprop(): FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); @@ -543,19 +526,16 @@ static int fdt_test_get_value(struct unit_test_state *uts) ut_assertok(fdt_test_get_value_common(uts, "testnodealias")); /* Test getting default element of /nonexistent node */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_command("fdt get value fnode /nonexistent nonexistent", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); /* Test getting default element of bad alias */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_command("fdt get value vbadalias badalias nonexistent", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); /* Test getting default element of nonexistent alias */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_command("fdt get value vnoalias noalias nonexistent", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_BADPATH"); ut_assertok(ut_check_console_end(uts)); @@ -572,31 +552,26 @@ static int fdt_test_get_name(struct unit_test_state *uts) ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt), &addr)); /* Test getting name of node 0 in /, which is /aliases node */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_command("fdt get name nzero / 0", 0)); ut_asserteq_str("aliases", env_get("nzero")); ut_assertok(ut_check_console_end(uts)); /* Test getting name of node 1 in /, which is /test-node@1234 node */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_command("fdt get name none / 1", 0)); ut_asserteq_str("test-node@1234", env_get("none")); ut_assertok(ut_check_console_end(uts)); /* Test getting name of node -1 in /, which is /aliases node, same as 0 */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_command("fdt get name nmone / -1", 0)); ut_asserteq_str("aliases", env_get("nmone")); ut_assertok(ut_check_console_end(uts)); /* Test getting name of node 2 in /, which does not exist */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_command("fdt get name ntwo / 2", 1)); ut_assert_nextline("libfdt node not found"); ut_assertok(ut_check_console_end(uts)); /* Test getting name of node 0 in /test-node@1234, which is /subnode node */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_command("fdt get name snzero /test-node@1234 0", 0)); ut_asserteq_str("subnode", env_get("snzero")); ut_assertok(run_command("fdt get name asnzero testnodealias 0", 0)); @@ -604,7 +579,6 @@ static int fdt_test_get_name(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Test getting name of node 1 in /test-node@1234, which does not exist */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_command("fdt get name snone /test-node@1234 1", 1)); ut_assert_nextline("libfdt node not found"); ut_asserteq(1, run_command("fdt get name asnone testnodealias 1", 1)); @@ -612,7 +586,6 @@ static int fdt_test_get_name(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Test getting name of node -1 in /test-node@1234, which is /subnode node, same as 0 */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_command("fdt get name snmone /test-node@1234 -1", 0)); ut_asserteq_str("subnode", env_get("snmone")); ut_assertok(run_command("fdt get name asnmone testnodealias -1", 0)); @@ -620,19 +593,16 @@ static int fdt_test_get_name(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Test getting name of nonexistent node */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_command("fdt get name nonode /nonexistent 0", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); /* Test getting name of bad alias */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_command("fdt get name vbadalias badalias 0", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); /* Test getting name of nonexistent alias */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_command("fdt get name vnoalias noalias 0", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_BADPATH"); ut_assertok(ut_check_console_end(uts)); @@ -655,7 +625,6 @@ static int fdt_test_get_addr_common(struct unit_test_state *uts, char *fdt, ut_assertnonnull(prop_ptr); offset = (char *)prop_ptr - fdt; - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt get addr pstr %s %s", path, prop)); ut_asserteq((ulong)map_sysmem(env_get_hex("fdtaddr", 0x1234), 0), (ulong)(map_sysmem(env_get_hex("pstr", 0x1234), 0) - offset)); @@ -699,13 +668,11 @@ static int fdt_test_get_addr(struct unit_test_state *uts) "regs")); /* Test getting address of node /test-node@1234/subnode non-existent property "noprop" */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_command("fdt get addr pnoprop /test-node@1234/subnode noprop", 1)); ut_assert_nextline("libfdt fdt_getprop(): FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); /* Test getting address of non-existent node /test-node@1234/nonode@1 property "noprop" */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_command("fdt get addr pnonode /test-node@1234/nonode@1 noprop", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); @@ -718,7 +685,6 @@ static int fdt_test_get_size_common(struct unit_test_state *uts, const char *path, const char *prop, const unsigned int val) { - ut_assertok(console_record_reset_enable()); if (prop) { ut_assertok(run_commandf("fdt get size sstr %s %s", path, prop)); } else { @@ -772,7 +738,6 @@ static int fdt_test_get_size(struct unit_test_state *uts) ut_assertok(fdt_test_get_size_common(uts, "subnodealias", NULL, 0)); /* Test getting size of node /test-node@1234/subnode non-existent property "noprop" */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_command("fdt get size pnoprop /test-node@1234/subnode noprop", 1)); ut_assert_nextline("libfdt fdt_getprop(): FDT_ERR_NOTFOUND"); ut_asserteq(1, run_command("fdt get size pnoprop subnodealias noprop", 1)); @@ -780,25 +745,21 @@ static int fdt_test_get_size(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Test getting size of non-existent node /test-node@1234/nonode@1 property "noprop" */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_command("fdt get size pnonode /test-node@1234/nonode@1 noprop", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); /* Test getting node count of non-existent node /test-node@1234/nonode@1 */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_command("fdt get size pnonode /test-node@1234/nonode@1", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); /* Test getting node count of bad alias badalias */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_command("fdt get size pnonode badalias noprop", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); /* Test getting node count of non-existent alias noalias */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_command("fdt get size pnonode noalias", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_BADPATH"); ut_assertok(ut_check_console_end(uts)); @@ -817,7 +778,6 @@ static int fdt_test_set_single(struct unit_test_state *uts, * => fdt set /path property integer * => fdt set /path property */ - ut_assertok(console_record_reset_enable()); if (sval) ut_assertok(run_commandf("fdt set %s %s %s", path, prop, sval)); else if (integer) @@ -855,7 +815,6 @@ static int fdt_test_set_multi(struct unit_test_state *uts, * new array is correctly sized and read past the new array length * triggers failure. */ - ut_assertok(console_record_reset_enable()); if (sval1 && sval2) { ut_assertok(run_commandf("fdt set %s %s %s %s end", path, prop, sval1, sval2)); ut_assertok(run_commandf("fdt set %s %s %s %s", path, prop, sval1, sval2)); @@ -928,19 +887,16 @@ static int fdt_test_set(struct unit_test_state *uts) ut_assertok(fdt_test_set_node(uts, "subnodealias", "newproperty")); /* Test setting property of non-existent node */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_command("fdt set /no-node noprop", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); /* Test setting property of non-existent alias */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_command("fdt set noalias noprop", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_BADPATH"); ut_assertok(ut_check_console_end(uts)); /* Test setting property of bad alias */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_command("fdt set badalias noprop", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); @@ -958,7 +914,6 @@ static int fdt_test_mknode(struct unit_test_state *uts) fdt_shrink_to_minimum(fdt, 4096); /* Resize with 4096 extra bytes */ /* Test creation of new node in / */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt mknode / newnode")); ut_assertok(run_commandf("fdt list /newnode")); ut_assert_nextline("newnode {"); @@ -966,7 +921,6 @@ static int fdt_test_mknode(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Test creation of new node in /test-node@1234 */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt mknode /test-node@1234 newsubnode")); ut_assertok(run_commandf("fdt list /test-node@1234/newsubnode")); ut_assert_nextline("newsubnode {"); @@ -974,7 +928,6 @@ static int fdt_test_mknode(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Test creation of new node in /test-node@1234 by alias */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt mknode testnodealias newersubnode")); ut_assertok(run_commandf("fdt list testnodealias/newersubnode")); ut_assert_nextline("newersubnode {"); @@ -982,31 +935,26 @@ static int fdt_test_mknode(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Test creation of new node in /test-node@1234 over existing node */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_commandf("fdt mknode testnodealias newsubnode")); ut_assert_nextline("libfdt fdt_add_subnode(): FDT_ERR_EXISTS"); ut_assertok(ut_check_console_end(uts)); /* Test creation of new node in /test-node@1234 by alias over existing node */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_commandf("fdt mknode testnodealias newersubnode")); ut_assert_nextline("libfdt fdt_add_subnode(): FDT_ERR_EXISTS"); ut_assertok(ut_check_console_end(uts)); /* Test creation of new node in non-existent node */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_commandf("fdt mknode /no-node newnosubnode")); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); /* Test creation of new node in non-existent alias */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_commandf("fdt mknode noalias newfailsubnode")); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_BADPATH"); ut_assertok(ut_check_console_end(uts)); /* Test creation of new node in bad alias */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_commandf("fdt mknode badalias newbadsubnode")); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); @@ -1023,7 +971,6 @@ static int fdt_test_rm(struct unit_test_state *uts) ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt), &addr)); /* Test removal of property in root node / */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt print / compatible")); ut_assert_nextline("compatible = \"u-boot,fdt-test\""); ut_assertok(run_commandf("fdt rm / compatible")); @@ -1032,7 +979,6 @@ static int fdt_test_rm(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Test removal of property clock-names in subnode /test-node@1234 */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt print /test-node@1234 clock-names")); ut_assert_nextline("clock-names = \"fixed\", \"i2c\", \"spi\", \"uart2\", \"uart1\""); ut_assertok(run_commandf("fdt rm /test-node@1234 clock-names")); @@ -1041,7 +987,6 @@ static int fdt_test_rm(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Test removal of property u-boot,empty-property in subnode /test-node@1234 by alias */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt print testnodealias u-boot,empty-property")); ut_assert_nextline("testnodealias u-boot,empty-property"); ut_assertok(run_commandf("fdt rm testnodealias u-boot,empty-property")); @@ -1050,45 +995,38 @@ static int fdt_test_rm(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Test removal of non-existent property noprop in subnode /test-node@1234 */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_commandf("fdt rm /test-node@1234 noprop")); ut_assert_nextline("libfdt fdt_delprop(): FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); /* Test removal of non-existent node /no-node@5678 */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_commandf("fdt rm /no-node@5678")); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); /* Test removal of subnode /test-node@1234/subnode by alias */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt rm subnodealias")); ut_asserteq(1, run_commandf("fdt print /test-node@1234/subnode")); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); /* Test removal of node by non-existent alias */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_commandf("fdt rm noalias")); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_BADPATH"); ut_assertok(ut_check_console_end(uts)); /* Test removal of node by bad alias */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_commandf("fdt rm noalias")); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_BADPATH"); ut_assertok(ut_check_console_end(uts)); /* Test removal of node /test-node@1234 */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt rm /test-node@1234")); ut_asserteq(1, run_commandf("fdt print /test-node@1234")); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); /* Test removal of node / */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt rm /")); ut_asserteq(1, run_commandf("fdt print /")); ut_assertok(ut_check_console_end(uts)); @@ -1106,19 +1044,16 @@ static int fdt_test_bootcpu(struct unit_test_state *uts) ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt), &addr)); /* Test getting default bootcpu entry */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt header get bootcpu boot_cpuid_phys")); ut_asserteq(0, env_get_ulong("bootcpu", 10, 0x1234)); ut_assertok(ut_check_console_end(uts)); /* Test setting and getting new bootcpu entry, twice, to test overwrite */ for (i = 42; i <= 43; i++) { - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt bootcpu %d", i)); ut_assertok(ut_check_console_end(uts)); /* Test getting new bootcpu entry */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt header get bootcpu boot_cpuid_phys")); ut_asserteq(i, env_get_ulong("bootcpu", 10, 0x1234)); ut_assertok(ut_check_console_end(uts)); @@ -1132,13 +1067,11 @@ static int fdt_test_header_get(struct unit_test_state *uts, const char *field, const unsigned long val) { /* Test getting valid header entry */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt header get fvar %s", field)); ut_asserteq(val, env_get_hex("fvar", 0x1234)); ut_assertok(ut_check_console_end(uts)); /* Test getting malformed header entry */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_commandf("fdt header get fvar typo%stypo", field)); ut_assertok(ut_check_console_end(uts)); @@ -1153,7 +1086,6 @@ static int fdt_test_header(struct unit_test_state *uts) ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt), &addr)); /* Test header print */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt header")); ut_assert_nextline("magic:\t\t\t0x%x", fdt_magic(fdt)); ut_assert_nextline("totalsize:\t\t0x%x (%d)", fdt_totalsize(fdt), fdt_totalsize(fdt)); @@ -1234,9 +1166,9 @@ static int fdt_test_memory_cells(struct unit_test_state *uts, fdt_shrink_to_minimum(fdt, 4096); /* Resize with 4096 extra bytes */ addr = map_to_sysmem(fdt); set_working_fdt_addr(addr); + ut_assert_nextline("Working FDT set to %lx", addr); /* Test updating the memory node */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt memory 0x%s 0x%s", seta, sets)); ut_assertok(run_commandf("fdt print /memory")); ut_assert_nextline("memory {"); @@ -1286,7 +1218,6 @@ static int fdt_test_rsvmem(struct unit_test_state *uts) fdt_add_mem_rsv(fdt, 0x74656, 0x9); /* Test default reserved memory node presence */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt rsvmem print")); ut_assert_nextline("index\t\t start\t\t size"); ut_assert_nextline("------------------------------------------------"); @@ -1295,7 +1226,6 @@ static int fdt_test_rsvmem(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Test add new reserved memory node */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt rsvmem add 0x1234 0x5678")); ut_assertok(run_commandf("fdt rsvmem print")); ut_assert_nextline("index\t\t start\t\t size"); @@ -1306,7 +1236,6 @@ static int fdt_test_rsvmem(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Test delete reserved memory node */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt rsvmem delete 0")); ut_assertok(run_commandf("fdt rsvmem print")); ut_assert_nextline("index\t\t start\t\t size"); @@ -1316,7 +1245,6 @@ static int fdt_test_rsvmem(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Test re-add new reserved memory node */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt rsvmem add 0x42 0x1701")); ut_assertok(run_commandf("fdt rsvmem print")); ut_assert_nextline("index\t\t start\t\t size"); @@ -1327,7 +1255,6 @@ static int fdt_test_rsvmem(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Test delete nonexistent reserved memory node */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_commandf("fdt rsvmem delete 10")); ut_assert_nextline("libfdt fdt_del_mem_rsv(): FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); @@ -1346,13 +1273,11 @@ static int fdt_test_chosen(struct unit_test_state *uts) fdt_shrink_to_minimum(fdt, 4096); /* Resize with 4096 extra bytes */ /* Test default chosen node presence, fail as there is no /chosen node */ - ut_assertok(console_record_reset_enable()); ut_asserteq(1, run_commandf("fdt print /chosen")); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); ut_assertok(ut_check_console_end(uts)); /* Test add new chosen node without initrd */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt chosen")); ut_assertok(run_commandf("fdt print /chosen")); ut_assert_nextline("chosen {"); @@ -1367,7 +1292,6 @@ static int fdt_test_chosen(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Test add new chosen node with initrd */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt chosen 0x1234 0x5678")); ut_assertok(run_commandf("fdt print /chosen")); ut_assert_nextline("chosen {"); @@ -1406,6 +1330,7 @@ static int fdt_test_apply(struct unit_test_state *uts) fdt_shrink_to_minimum(fdt, 4096); /* Resize with 4096 extra bytes */ addr = map_to_sysmem(fdt); set_working_fdt_addr(addr); + ut_assert_nextline("Working FDT set to %lx", addr); /* Create DTO which adds single property to root node / */ ut_assertok(fdt_create(fdto, sizeof(fdto))); @@ -1421,7 +1346,6 @@ static int fdt_test_apply(struct unit_test_state *uts) addro = map_to_sysmem(fdto); /* Test default DT print */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt print /")); ut_assert_nextline("/ {"); ut_assert_nextline("\t__symbols__ {"); @@ -1430,7 +1354,6 @@ static int fdt_test_apply(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Test simple DTO application */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt apply 0x%08lx", addro)); ut_assertok(run_commandf("fdt print /")); ut_assert_nextline("/ {"); @@ -1475,7 +1398,6 @@ static int fdt_test_apply(struct unit_test_state *uts) addro = map_to_sysmem(fdto); /* Test complex DTO application */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt apply 0x%08lx", addro)); ut_assertok(run_commandf("fdt print /")); ut_assert_nextline("/ {"); @@ -1519,7 +1441,6 @@ static int fdt_test_apply(struct unit_test_state *uts) addro = map_to_sysmem(fdto); /* Test complex DTO application */ - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("fdt apply 0x%08lx", addro)); ut_assertok(run_commandf("fdt print /")); ut_assert_nextline("/ {"); diff --git a/test/cmd/font.c b/test/cmd/font.c index 08600dfe2eb..6f4e54e7f3f 100644 --- a/test/cmd/font.c +++ b/test/cmd/font.c @@ -26,7 +26,6 @@ static int font_test_base(struct unit_test_state *uts) ut_assertok(uclass_first_device_err(UCLASS_VIDEO, &dev)); ut_assertok(uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev)); - ut_assertok(console_record_reset_enable()); ut_assertok(run_command("font list", 0)); ut_assert_nextline("nimbus_sans_l_regular"); if (IS_ENABLED(CONFIG_CONSOLE_TRUETYPE_CANTORAONE)) diff --git a/test/cmd/loadm.c b/test/cmd/loadm.c index 29ae8339183..dedb4f7683e 100644 --- a/test/cmd/loadm.c +++ b/test/cmd/loadm.c @@ -23,7 +23,6 @@ static int loadm_test_params(struct unit_test_state *uts) { - ut_assertok(console_record_reset_enable()); run_command("loadm", 0); ut_assert_nextline("loadm - load binary blob from source address to destination address"); @@ -51,7 +50,6 @@ static int loadm_test_load (struct unit_test_state *uts) memset(buf, '\0', BUF_SIZE); memset(buf, 0xaa, BUF_SIZE / 2); - ut_assertok(console_record_reset_enable()); run_command("loadm 0x0 0x80 0x80", 0); ut_assert_nextline("loaded bin to memory: size: 128"); diff --git a/test/cmd/mbr.c b/test/cmd/mbr.c index 0c3698afb0b..8c9d01130a3 100644 --- a/test/cmd/mbr.c +++ b/test/cmd/mbr.c @@ -261,7 +261,6 @@ static int mbr_test_run(struct unit_test_state *uts) /* Make sure mmc6 exists */ ut_asserteq(6, blk_get_device_by_str("mmc", "6", &mmc_dev_desc)); - ut_assertok(console_record_reset_enable()); ut_assertok(run_commandf("mmc dev 6")); ut_assert_nextline("switch to partitions #0, OK"); ut_assert_nextline("mmc6 is current device"); @@ -281,9 +280,9 @@ static int mbr_test_run(struct unit_test_state *uts) memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 0x%lx 0x%lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); - ut_assertok(console_record_reset_enable()); ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); ut_assertok(run_commandf("mbr write mmc 6")); + ut_assert_nextlinen("MMC read: dev # 6"); ut_assert_nextline("MBR: write success!"); ut_assertok(run_commandf("mbr verify mmc 6")); ut_assert_nextline("MBR: verify success!"); @@ -317,7 +316,6 @@ static int mbr_test_run(struct unit_test_state *uts) memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 0x%lx 0x%lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); - ut_assertok(console_record_reset_enable()); ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); ut_assertok(run_commandf("mbr write mmc 6")); ut_assert_nextline("MBR: write success!"); @@ -353,7 +351,6 @@ static int mbr_test_run(struct unit_test_state *uts) memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 0x%lx 0x%lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); - ut_assertok(console_record_reset_enable()); ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); ut_assertok(run_commandf("mbr write mmc 6")); ut_assert_nextline("MBR: write success!"); @@ -389,7 +386,6 @@ static int mbr_test_run(struct unit_test_state *uts) memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 0x%lx 0x%lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); - ut_assertok(console_record_reset_enable()); ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); ut_assertok(run_commandf("mbr write mmc 6")); ut_assert_nextline("MBR: write success!"); @@ -425,7 +421,6 @@ static int mbr_test_run(struct unit_test_state *uts) memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 0x%lx 0x%lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); - ut_assertok(console_record_reset_enable()); ut_assertf(0 == run_commandf(mbr_parts_buf), "Invalid partitions string: %s\n", mbr_parts_buf); ut_assertf(0 == run_commandf("mbr write mmc 6"), "Invalid partitions string: %s\n", mbr_parts_buf); ut_assert_nextline("MBR: write success!"); diff --git a/test/cmd/mem_search.c b/test/cmd/mem_search.c index 1387baea032..3a031eed7ed 100644 --- a/test/cmd/mem_search.c +++ b/test/cmd/mem_search.c @@ -27,7 +27,6 @@ static int mem_test_ms_b(struct unit_test_state *uts) buf[0x31] = 0x12; buf[0xff] = 0x12; buf[0x100] = 0x12; - ut_assertok(console_record_reset_enable()); run_command("ms.b 1 ff 12", 0); ut_assert_nextline("00000030: 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................"); ut_assert_nextline("--"); @@ -54,7 +53,6 @@ static int mem_test_ms_w(struct unit_test_state *uts) memset(buf, '\0', BUF_SIZE); buf[0x34 / 2] = 0x1234; buf[BUF_SIZE / 2] = 0x1234; - ut_assertok(console_record_reset_enable()); run_command("ms.w 0 80 1234", 0); ut_assert_nextline("00000030: 0000 0000 1234 0000 0000 0000 0000 0000 ....4..........."); ut_assert_nextline("1 match"); @@ -79,7 +77,6 @@ static int mem_test_ms_l(struct unit_test_state *uts) memset(buf, '\0', BUF_SIZE); buf[0x38 / 4] = 0x12345678; buf[BUF_SIZE / 4] = 0x12345678; - ut_assertok(console_record_reset_enable()); run_command("ms 0 40 12345678", 0); ut_assert_nextline("00000030: 00000000 00000000 12345678 00000000 ........xV4....."); ut_assert_nextline("1 match"); @@ -89,7 +86,6 @@ static int mem_test_ms_l(struct unit_test_state *uts) ut_asserteq(0x38, env_get_hex("memaddr", 0)); ut_asserteq(0x38 / 4, env_get_hex("mempos", 0)); - ut_assertok(console_record_reset_enable()); run_command("ms 0 80 12345679", 0); ut_assert_nextline("0 matches"); ut_assert_console_end(); @@ -116,7 +112,6 @@ static int mem_test_ms_cont(struct unit_test_state *uts) memset(buf, '\0', BUF_SIZE); for (i = 5; i < 0x33; i += 3) buf[i] = 0x34; - ut_assertok(console_record_reset_enable()); run_command("ms.b 0 100 34", 0); ut_assert_nextlinen("00000000: 00 00 00 00 00 34 00 00 34 00 00 34 00 00 34 00"); ut_assert_nextline("--"); @@ -134,7 +129,6 @@ static int mem_test_ms_cont(struct unit_test_state *uts) * run_command() ignoes the repeatable flag when using hush, so call * cmd_process() directly */ - ut_assertok(console_record_reset_enable()); cmd_process(CMD_FLAG_REPEAT, 4, args, &repeatable, NULL); ut_assert_nextlinen("00000020: 34 00 00 34 00 00 34 00 00 34 00 00 34 00 00 34"); ut_assert_nextline("--"); @@ -167,7 +161,6 @@ static int mem_test_ms_cont_end(struct unit_test_state *uts) buf[0x31] = 0x12; buf[0xff] = 0x12; buf[0x100] = 0x12; - ut_assertok(console_record_reset_enable()); run_command("ms.b 1 ff 12", 0); ut_assert_nextlinen("00000030"); ut_assert_nextlinen("--"); @@ -181,13 +174,11 @@ static int mem_test_ms_cont_end(struct unit_test_state *uts) * * This should produce no matches. */ - ut_assertok(console_record_reset_enable()); cmd_process(CMD_FLAG_REPEAT, 4, args, &repeatable, NULL); ut_assert_nextlinen("0 matches"); ut_assert_console_end(); /* One more time */ - ut_assertok(console_record_reset_enable()); cmd_process(CMD_FLAG_REPEAT, 4, args, &repeatable, NULL); ut_assert_nextlinen("0 matches"); ut_assert_console_end(); @@ -239,7 +230,6 @@ static int mem_test_ms_s(struct unit_test_state *uts) strcpy(buf + 0x1e, str); strcpy(buf + 0x63, str); strcpy(buf + 0xa1, str2); - ut_assertok(console_record_reset_enable()); run_command("ms.s 0 100 hello", 0); ut_assert_nextline("00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 68 65 ..............he"); ut_assert_nextline("00000020: 6c 6c 6f 00 00 00 00 00 00 00 00 00 00 00 00 00 llo............."); @@ -254,7 +244,6 @@ static int mem_test_ms_s(struct unit_test_state *uts) ut_asserteq(0xa1, env_get_hex("memaddr", 0)); ut_asserteq(0xa1, env_get_hex("mempos", 0)); - ut_assertok(console_record_reset_enable()); run_command("ms.s 0 100 hello there", 0); ut_assert_nextline("000000a0: 00 68 65 6c 6c 6f 74 68 65 72 65 00 00 00 00 00 .hellothere....."); ut_assert_nextline("1 match"); @@ -281,7 +270,6 @@ static int mem_test_ms_limit(struct unit_test_state *uts) buf[0x31] = 0x12; buf[0x62] = 0x12; buf[0x76] = 0x12; - ut_assertok(console_record_reset_enable()); run_command("ms.b -l2 1 ff 12", 0); ut_assert_nextline("00000030: 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................"); ut_assert_nextline("--"); @@ -310,7 +298,6 @@ static int mem_test_ms_quiet(struct unit_test_state *uts) buf[0x31] = 0x12; buf[0x62] = 0x12; buf[0x76] = 0x12; - ut_assertok(console_record_reset_enable()); run_command("ms.b -q -l2 1 ff 12", 0); ut_assert_console_end(); unmap_sysmem(buf); diff --git a/test/cmd/pinmux.c b/test/cmd/pinmux.c index 7ee92690756..be39dbc61bd 100644 --- a/test/cmd/pinmux.c +++ b/test/cmd/pinmux.c @@ -18,17 +18,14 @@ static int dm_test_cmd_pinmux_status_pinname(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_LED, 2, &dev)); /* Test that 'pinmux status ' displays the selected pin. */ - console_record_reset(); run_command("pinmux status a5", 0); ut_assert_nextlinen("a5 : gpio output ."); ut_assert_console_end(); - console_record_reset(); run_command("pinmux status P7", 0); ut_assert_nextlinen("P7 : GPIO2 bias-pull-down input-enable."); ut_assert_console_end(); - console_record_reset(); run_command("pinmux status P9", 0); ut_assert_nextlinen("single-pinctrl pinctrl-single-no-width: missing register width"); ut_assert_nextlinen("P9 not found"); diff --git a/test/cmd/pwm.c b/test/cmd/pwm.c index f8de03fd6d1..0d47e2d8abb 100644 --- a/test/cmd/pwm.c +++ b/test/cmd/pwm.c @@ -22,8 +22,6 @@ static int dm_test_pwm_cmd(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_PWM, 0, &dev)); ut_assertnonnull(dev); - ut_assertok(console_record_reset_enable()); - /* pwm */ /* cros-ec-pwm doesn't support invert */ ut_asserteq(1, run_command("pwm invert 0 0 1", 0)); @@ -49,8 +47,6 @@ static int dm_test_pwm_cmd(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_PWM, 1, &dev)); ut_assertnonnull(dev); - ut_assertok(console_record_reset_enable()); - /* pwm */ ut_assertok(run_command("pwm invert 1 0 1", 0)); ut_assert_console_end(); diff --git a/test/cmd/rw.c b/test/cmd/rw.c index 1086dcd2914..0a856c44ede 100644 --- a/test/cmd/rw.c +++ b/test/cmd/rw.c @@ -87,12 +87,10 @@ static int dm_test_read_write(struct unit_test_state *uts) ut_assertok(memcmp(wbuf, rbuf, sizeof(wbuf))); /* Read/write outside partition bounds should be rejected upfront. */ - console_record_reset_enable(); ut_asserteq(1, run_commandf("read mmc 2#data 0x%lx 3 2", ra)); ut_assert_nextlinen("read out of range"); ut_assert_console_end(); - console_record_reset_enable(); ut_asserteq(1, run_commandf("write mmc 2#log 0x%lx 9 2", wa)); ut_assert_nextlinen("write out of range"); ut_assert_console_end(); diff --git a/test/cmd/seama.c b/test/cmd/seama.c index 802563e4f71..28d6b9ab517 100644 --- a/test/cmd/seama.c +++ b/test/cmd/seama.c @@ -16,7 +16,6 @@ static int seama_test_noargs(struct unit_test_state *uts) { /* Test that 'seama' with no arguments fails gracefully */ - console_record_reset(); run_command("seama", 0); ut_assert_nextlinen("seama - Load the SEAMA image and sets envs"); ut_assert_skipline(); @@ -31,7 +30,6 @@ SEAMA_TEST(seama_test_noargs, UTF_CONSOLE); static int seama_test_addr(struct unit_test_state *uts) { /* Test that loads SEAMA image 0 to address 0x01000000 */ - console_record_reset(); run_command("seama 0x01000000", 0); ut_assert_nextlinen("Loading SEAMA image 0 from nand0"); ut_assert_nextlinen("SEMA IMAGE:"); @@ -47,7 +45,6 @@ SEAMA_TEST(seama_test_addr, UTF_CONSOLE); static int seama_test_index(struct unit_test_state *uts) { /* Test that loads SEAMA image 0 exlicitly specified */ - console_record_reset(); run_command("seama 0x01000000 0", 0); ut_assert_nextlinen("Loading SEAMA image 0 from nand0"); ut_assert_nextlinen("SEMA IMAGE:"); diff --git a/test/cmd/setexpr.c b/test/cmd/setexpr.c index dcd0e3726e4..21a3268bd81 100644 --- a/test/cmd/setexpr.c +++ b/test/cmd/setexpr.c @@ -340,7 +340,6 @@ static int setexpr_test_str_oper(struct unit_test_state *uts) strcpy(buf, "hello"); strcpy(buf + 0x10, " there"); - ut_assertok(console_record_reset_enable()); start_mem = ut_check_free(); ut_asserteq(1, run_command("setexpr.s fred *0 * *10", 0)); ut_assertok(ut_check_delta(start_mem)); diff --git a/test/cmd/temperature.c b/test/cmd/temperature.c index 193fa6324ea..309693aa1e8 100644 --- a/test/cmd/temperature.c +++ b/test/cmd/temperature.c @@ -18,8 +18,6 @@ static int dm_test_cmd_temperature(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_THERMAL, 0, &dev)); ut_assertnonnull(dev); - ut_assertok(console_record_reset_enable()); - /* Test that "temperature list" shows the sandbox device */ ut_assertok(run_command("temperature list", 0)); ut_assert_nextline("| Device | Driver | Parent"); diff --git a/test/cmd/test_echo.c b/test/cmd/test_echo.c index ee07ab22933..b829f71c591 100644 --- a/test/cmd/test_echo.c +++ b/test/cmd/test_echo.c @@ -45,10 +45,7 @@ static int lib_test_hush_echo(struct unit_test_state *uts) int i; for (i = 0; i < ARRAY_SIZE(echo_data); ++i) { - ut_silence_console(uts); - console_record_reset_enable(); ut_assertok(run_command(echo_data[i].cmd, 0)); - ut_unsilence_console(uts); console_record_readline(uts->actual_str, sizeof(uts->actual_str)); ut_asserteq_str(echo_data[i].expected, uts->actual_str); @@ -56,4 +53,4 @@ static int lib_test_hush_echo(struct unit_test_state *uts) } return 0; } -LIB_TEST(lib_test_hush_echo, 0); +LIB_TEST(lib_test_hush_echo, UTF_CONSOLE); diff --git a/test/cmd/test_pause.c b/test/cmd/test_pause.c index 3703290350b..927fe174d74 100644 --- a/test/cmd/test_pause.c +++ b/test/cmd/test_pause.c @@ -14,7 +14,6 @@ DECLARE_GLOBAL_DATA_PTR; static int lib_test_hush_pause(struct unit_test_state *uts) { /* Test default message */ - console_record_reset_enable(); /* Cook a newline when the command is expected to pause */ console_in_puts("\n"); ut_assertok(run_command("pause", 0)); @@ -23,7 +22,6 @@ static int lib_test_hush_pause(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Test provided message */ - console_record_reset_enable(); /* Cook a newline when the command is expected to pause */ console_in_puts("\n"); ut_assertok(run_command("pause 'Prompt for pause...'", 0)); @@ -32,7 +30,6 @@ static int lib_test_hush_pause(struct unit_test_state *uts) ut_assertok(ut_check_console_end(uts)); /* Test providing more than one params */ - console_record_reset_enable(); /* No newline cooked here since the command is expected to fail */ ut_asserteq(1, run_command("pause a b", 0)); console_record_readline(uts->actual_str, sizeof(uts->actual_str)); @@ -41,4 +38,4 @@ static int lib_test_hush_pause(struct unit_test_state *uts) return 0; } -LIB_TEST(lib_test_hush_pause, 0); +LIB_TEST(lib_test_hush_pause, UTF_CONSOLE); diff --git a/test/cmd/wget.c b/test/cmd/wget.c index a91aa24722c..1660d2bdcb0 100644 --- a/test/cmd/wget.c +++ b/test/cmd/wget.c @@ -213,10 +213,12 @@ static int net_test_wget(struct unit_test_state *uts) env_set("ethrotate", "no"); env_set("loadaddr", "0x20000"); ut_assertok(run_command("wget ${loadaddr} 1.1.2.2:/index.html", 0)); + ut_assert_nextline("HTTP/1.1 200 OK"); + ut_assert_nextline("Packets received 5, Transfer Successful"); + ut_assert_nextline("Bytes transferred = 32 (20 hex)"); sandbox_eth_set_tx_handler(0, NULL); - ut_assertok(console_record_reset_enable()); run_command("md5sum ${loadaddr} ${filesize}", 0); ut_assert_nextline("md5 for 00020000 ... 0002001f ==> 234af48e94b0085060249ecb5942ab57"); ut_assertok(ut_check_console_end(uts)); -- cgit v1.2.3 From e6f498e70bec1cec5db81b62d544e9cba3607504 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 22 Aug 2024 07:58:03 -0600 Subject: test: Tidy up checking for console end Use the ut_assert_console_end() function provided, rather than doing it separately. Signed-off-by: Simon Glass --- test/cmd/bdinfo.c | 8 +-- test/cmd/exit.c | 24 +++---- test/cmd/fdt.c | 178 +++++++++++++++++++++++++------------------------- test/cmd/font.c | 8 +-- test/cmd/mbr.c | 12 ++-- test/cmd/test_echo.c | 2 +- test/cmd/test_pause.c | 4 +- test/cmd/wget.c | 2 +- 8 files changed, 119 insertions(+), 119 deletions(-) (limited to 'test/cmd') diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c index 810174fe8d1..199b461be2c 100644 --- a/test/cmd/bdinfo.c +++ b/test/cmd/bdinfo.c @@ -239,7 +239,7 @@ static int bdinfo_test_full(struct unit_test_state *uts) ut_assertok(bdinfo_test_all(uts)); ut_assertok(run_commandf("bdinfo -a")); ut_assertok(bdinfo_test_all(uts)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -259,7 +259,7 @@ static int bdinfo_test_help(struct unit_test_state *uts) ut_assert_nextlinen("Usage:"); ut_assert_nextlinen("bdinfo"); } - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -273,7 +273,7 @@ static int bdinfo_test_memory(struct unit_test_state *uts) ut_assertok(bdinfo_test_all(uts)); else ut_assertok(bdinfo_check_mem(uts)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -287,7 +287,7 @@ static int bdinfo_test_eth(struct unit_test_state *uts) ut_assertok(bdinfo_test_all(uts)); else if (IS_ENABLED(CONFIG_CMD_NET)) ut_assertok(test_eth(uts)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } diff --git a/test/cmd/exit.c b/test/cmd/exit.c index 093f51b4dfc..af58a57fca7 100644 --- a/test/cmd/exit.c +++ b/test/cmd/exit.c @@ -36,14 +36,14 @@ static int cmd_exit_test(struct unit_test_state *uts) ut_assertok(run_commandf("setenv foo 'echo bar ; exit %d ; echo baz' ; run foo ; echo $?", i)); ut_assert_nextline("bar"); ut_assert_nextline("%d", i > 0 ? i : 0); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); ut_assertok(run_commandf("setenv foo 'echo bar ; exit %d ; echo baz' ; run foo && echo quux ; echo $?", i)); ut_assert_nextline("bar"); if (i <= 0) ut_assert_nextline("quux"); ut_assert_nextline("%d", i > 0 ? i : 0); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); ut_assertok(run_commandf("setenv foo 'echo bar ; exit %d ; echo baz' ; run foo || echo quux ; echo $?", i)); ut_assert_nextline("bar"); @@ -51,61 +51,61 @@ static int cmd_exit_test(struct unit_test_state *uts) ut_assert_nextline("quux"); /* Either 'exit' returns 0, or 'echo quux' returns 0 */ ut_assert_nextline("0"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); } /* Validate that 'exit' behaves the same way as 'exit 0' */ ut_assertok(run_commandf("setenv foo 'echo bar ; exit ; echo baz' ; run foo ; echo $?")); ut_assert_nextline("bar"); ut_assert_nextline("0"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); ut_assertok(run_commandf("setenv foo 'echo bar ; exit ; echo baz' ; run foo && echo quux ; echo $?")); ut_assert_nextline("bar"); ut_assert_nextline("quux"); ut_assert_nextline("0"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); ut_assertok(run_commandf("setenv foo 'echo bar ; exit ; echo baz' ; run foo || echo quux ; echo $?")); ut_assert_nextline("bar"); /* Either 'exit' returns 0, or 'echo quux' returns 0 */ ut_assert_nextline("0"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Validate that return value still propagates from 'run' command */ ut_assertok(run_commandf("setenv foo 'echo bar ; true' ; run foo ; echo $?")); ut_assert_nextline("bar"); ut_assert_nextline("0"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); ut_assertok(run_commandf("setenv foo 'echo bar ; true' ; run foo && echo quux ; echo $?")); ut_assert_nextline("bar"); ut_assert_nextline("quux"); ut_assert_nextline("0"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); ut_assertok(run_commandf("setenv foo 'echo bar ; true' ; run foo || echo quux ; echo $?")); ut_assert_nextline("bar"); /* The 'true' returns 0 */ ut_assert_nextline("0"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); ut_assertok(run_commandf("setenv foo 'echo bar ; false' ; run foo ; echo $?")); ut_assert_nextline("bar"); ut_assert_nextline("1"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); ut_assertok(run_commandf("setenv foo 'echo bar ; false' ; run foo && echo quux ; echo $?")); ut_assert_nextline("bar"); ut_assert_nextline("1"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); ut_assertok(run_commandf("setenv foo 'echo bar ; false' ; run foo || echo quux ; echo $?")); ut_assert_nextline("bar"); ut_assert_nextline("quux"); /* The 'echo quux' returns 0 */ ut_assert_nextline("0"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } diff --git a/test/cmd/fdt.c b/test/cmd/fdt.c index ac0d6f06150..e64785101cd 100644 --- a/test/cmd/fdt.c +++ b/test/cmd/fdt.c @@ -171,7 +171,7 @@ static int fdt_test_addr(struct unit_test_state *uts) ut_assertok(run_command("fdt addr -c", 0)); ut_assert_nextline("Control fdt: %08lx", (ulong)map_to_sysmem(gd->fdt_blob)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* The working fdt is not set, so this should fail */ set_working_fdt_addr(0); @@ -184,13 +184,13 @@ static int fdt_test_addr(struct unit_test_state *uts) */ if (IS_ENABLED(CONFIG_SANDBOX)) ut_assert_nextline("libfdt fdt_check_header(): FDT_ERR_BADMAGIC"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Set up a working FDT and try again */ ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt), &addr)); ut_assertok(run_command("fdt addr", 0)); ut_assert_nextline("Working fdt: %08lx", (ulong)map_to_sysmem(fdt)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Set the working FDT */ set_working_fdt_addr(0); @@ -198,7 +198,7 @@ static int fdt_test_addr(struct unit_test_state *uts) ut_assertok(run_commandf("fdt addr %08lx", addr)); ut_assert_nextline("Working FDT set to %lx", addr); ut_asserteq(addr, map_to_sysmem(working_fdt)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); set_working_fdt_addr(0); ut_assert_nextline("Working FDT set to 0"); @@ -210,13 +210,13 @@ static int fdt_test_addr(struct unit_test_state *uts) gd->fdt_blob = fdt_blob; ut_assertok(ret); ut_asserteq(addr, map_to_sysmem(new_fdt)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test setting an invalid FDT */ fdt[0] = 123; ut_asserteq(1, run_commandf("fdt addr %08lx", addr)); ut_assert_nextline("libfdt fdt_check_header(): FDT_ERR_BADMAGIC"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test detecting an invalid FDT */ fdt[0] = 123; @@ -224,7 +224,7 @@ static int fdt_test_addr(struct unit_test_state *uts) ut_assert_nextline("Working FDT set to %lx", addr); ut_asserteq(1, run_commandf("fdt addr")); ut_assert_nextline("libfdt fdt_check_header(): FDT_ERR_BADMAGIC"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -242,18 +242,18 @@ static int fdt_test_addr_resize(struct unit_test_state *uts) /* Test setting and resizing the working FDT to a larger size */ ut_assertok(run_commandf("fdt addr %08lx %x", addr, newsize)); ut_assert_nextline("Working FDT set to %lx", addr); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Try shrinking it */ ut_assertok(run_commandf("fdt addr %08lx %zx", addr, sizeof(fdt) / 4)); ut_assert_nextline("Working FDT set to %lx", addr); ut_assert_nextline("New length %d < existing length %d, ignoring", (int)sizeof(fdt) / 4, newsize); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* ...quietly */ ut_assertok(run_commandf("fdt addr -q %08lx %zx", addr, sizeof(fdt) / 4)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* We cannot easily provoke errors in fdt_open_into(), so ignore that */ @@ -280,12 +280,12 @@ static int fdt_test_move(struct unit_test_state *uts) /* Test moving the working FDT to a new location */ ut_assertok(run_commandf("fdt move %08lx %08lx %x", addr, newaddr, ts)); ut_assert_nextline("Working FDT set to %lx", newaddr); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Compare the source and destination DTs */ ut_assertok(run_commandf("cmp.b %08lx %08lx %x", addr, newaddr, ts)); ut_assert_nextline("Total of %d byte(s) were the same", ts); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -306,7 +306,7 @@ static int fdt_test_resize(struct unit_test_state *uts) /* Test resizing the working FDT and verify the new space was added */ ut_assertok(run_commandf("fdt resize %x", newsize)); ut_asserteq(ts + newsize, fdt_totalsize(fdt)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -325,7 +325,7 @@ static int fdt_test_print_list_common(struct unit_test_state *uts, ut_assert_nextline("\t#size-cells = <0x00000000>;"); ut_assert_nextline("\tcompatible = \"u-boot,fdt-subnode-test-device\";"); ut_assert_nextline("};"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* * Test printing/listing the working FDT @@ -333,7 +333,7 @@ static int fdt_test_print_list_common(struct unit_test_state *uts, */ ut_assertok(run_commandf("fdt %s / model", opc)); ut_assert_nextline("model = \"U-Boot FDT test\""); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* * Test printing/listing the working FDT @@ -341,7 +341,7 @@ static int fdt_test_print_list_common(struct unit_test_state *uts, */ ut_assertok(run_commandf("fdt %s %s compatible", opc, node)); ut_assert_nextline("compatible = \"u-boot,fdt-test-device1\""); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* * Test printing/listing the working FDT @@ -349,7 +349,7 @@ static int fdt_test_print_list_common(struct unit_test_state *uts, */ ut_assertok(run_commandf("fdt %s %s clock-names", opc, node)); ut_assert_nextline("clock-names = \"fixed\", \"i2c\", \"spi\", \"uart2\", \"uart1\""); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* * Test printing/listing the working FDT @@ -357,7 +357,7 @@ static int fdt_test_print_list_common(struct unit_test_state *uts, */ ut_assertok(run_commandf("fdt %s %s clock-frequency", opc, node)); ut_assert_nextline("clock-frequency = <0x00fde800>"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* * Test printing/listing the working FDT @@ -370,7 +370,7 @@ static int fdt_test_print_list_common(struct unit_test_state *uts, * since the beginning of the command 'fdt', keep it. */ ut_assert_nextline("%s u-boot,empty-property", node); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* * Test printing/listing the working FDT @@ -378,7 +378,7 @@ static int fdt_test_print_list_common(struct unit_test_state *uts, */ ut_assertok(run_commandf("fdt %s %s regs", opc, node)); ut_assert_nextline("regs = <0x00001234 0x00001000>"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -424,7 +424,7 @@ static int fdt_test_print_list(struct unit_test_state *uts, bool print) } ut_assert_nextline("\t};"); ut_assert_nextline("};"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); ret = fdt_test_print_list_common(uts, opc, "/test-node@1234"); if (!ret) @@ -457,7 +457,7 @@ static int fdt_test_get_value_string(struct unit_test_state *uts, ut_asserteq_str(strres, env_get("var")); else ut_asserteq(intres, env_get_hex("var", 0x1234)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -501,16 +501,16 @@ static int fdt_test_get_value_common(struct unit_test_state *uts, /* Test missing 10th element of $node node clock-names property */ ut_asserteq(1, run_commandf("fdt get value ften %s clock-names 10", node)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test missing 10th element of $node node regs property */ ut_asserteq(1, run_commandf("fdt get value ften %s regs 10", node)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test getting default element of $node node nonexistent property */ ut_asserteq(1, run_commandf("fdt get value fnone %s nonexistent", node)); ut_assert_nextline("libfdt fdt_getprop(): FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -528,17 +528,17 @@ static int fdt_test_get_value(struct unit_test_state *uts) /* Test getting default element of /nonexistent node */ ut_asserteq(1, run_command("fdt get value fnode /nonexistent nonexistent", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test getting default element of bad alias */ ut_asserteq(1, run_command("fdt get value vbadalias badalias nonexistent", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test getting default element of nonexistent alias */ ut_asserteq(1, run_command("fdt get value vnoalias noalias nonexistent", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_BADPATH"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -554,58 +554,58 @@ static int fdt_test_get_name(struct unit_test_state *uts) /* Test getting name of node 0 in /, which is /aliases node */ ut_assertok(run_command("fdt get name nzero / 0", 0)); ut_asserteq_str("aliases", env_get("nzero")); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test getting name of node 1 in /, which is /test-node@1234 node */ ut_assertok(run_command("fdt get name none / 1", 0)); ut_asserteq_str("test-node@1234", env_get("none")); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test getting name of node -1 in /, which is /aliases node, same as 0 */ ut_assertok(run_command("fdt get name nmone / -1", 0)); ut_asserteq_str("aliases", env_get("nmone")); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test getting name of node 2 in /, which does not exist */ ut_asserteq(1, run_command("fdt get name ntwo / 2", 1)); ut_assert_nextline("libfdt node not found"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test getting name of node 0 in /test-node@1234, which is /subnode node */ ut_assertok(run_command("fdt get name snzero /test-node@1234 0", 0)); ut_asserteq_str("subnode", env_get("snzero")); ut_assertok(run_command("fdt get name asnzero testnodealias 0", 0)); ut_asserteq_str("subnode", env_get("asnzero")); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test getting name of node 1 in /test-node@1234, which does not exist */ ut_asserteq(1, run_command("fdt get name snone /test-node@1234 1", 1)); ut_assert_nextline("libfdt node not found"); ut_asserteq(1, run_command("fdt get name asnone testnodealias 1", 1)); ut_assert_nextline("libfdt node not found"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test getting name of node -1 in /test-node@1234, which is /subnode node, same as 0 */ ut_assertok(run_command("fdt get name snmone /test-node@1234 -1", 0)); ut_asserteq_str("subnode", env_get("snmone")); ut_assertok(run_command("fdt get name asnmone testnodealias -1", 0)); ut_asserteq_str("subnode", env_get("asnmone")); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test getting name of nonexistent node */ ut_asserteq(1, run_command("fdt get name nonode /nonexistent 0", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test getting name of bad alias */ ut_asserteq(1, run_command("fdt get name vbadalias badalias 0", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test getting name of nonexistent alias */ ut_asserteq(1, run_command("fdt get name vnoalias noalias 0", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_BADPATH"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -628,7 +628,7 @@ static int fdt_test_get_addr_common(struct unit_test_state *uts, char *fdt, ut_assertok(run_commandf("fdt get addr pstr %s %s", path, prop)); ut_asserteq((ulong)map_sysmem(env_get_hex("fdtaddr", 0x1234), 0), (ulong)(map_sysmem(env_get_hex("pstr", 0x1234), 0) - offset)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -670,12 +670,12 @@ static int fdt_test_get_addr(struct unit_test_state *uts) /* Test getting address of node /test-node@1234/subnode non-existent property "noprop" */ ut_asserteq(1, run_command("fdt get addr pnoprop /test-node@1234/subnode noprop", 1)); ut_assert_nextline("libfdt fdt_getprop(): FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test getting address of non-existent node /test-node@1234/nonode@1 property "noprop" */ ut_asserteq(1, run_command("fdt get addr pnonode /test-node@1234/nonode@1 noprop", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -691,7 +691,7 @@ static int fdt_test_get_size_common(struct unit_test_state *uts, ut_assertok(run_commandf("fdt get size sstr %s", path)); } ut_asserteq(val, env_get_hex("sstr", 0x1234)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -742,27 +742,27 @@ static int fdt_test_get_size(struct unit_test_state *uts) ut_assert_nextline("libfdt fdt_getprop(): FDT_ERR_NOTFOUND"); ut_asserteq(1, run_command("fdt get size pnoprop subnodealias noprop", 1)); ut_assert_nextline("libfdt fdt_getprop(): FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test getting size of non-existent node /test-node@1234/nonode@1 property "noprop" */ ut_asserteq(1, run_command("fdt get size pnonode /test-node@1234/nonode@1 noprop", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test getting node count of non-existent node /test-node@1234/nonode@1 */ ut_asserteq(1, run_command("fdt get size pnonode /test-node@1234/nonode@1", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test getting node count of bad alias badalias */ ut_asserteq(1, run_command("fdt get size pnonode badalias noprop", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test getting node count of non-existent alias noalias */ ut_asserteq(1, run_command("fdt get size pnonode noalias", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_BADPATH"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -793,7 +793,7 @@ static int fdt_test_set_single(struct unit_test_state *uts, ut_asserteq(ival, env_get_hex("svar", 0x1234)); else ut_assertnull(env_get("svar")); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -842,7 +842,7 @@ static int fdt_test_set_multi(struct unit_test_state *uts, ut_asserteq(ival2, env_get_hex("svar2", 0x1234)); ut_assertnull(env_get("svarn")); } - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -889,17 +889,17 @@ static int fdt_test_set(struct unit_test_state *uts) /* Test setting property of non-existent node */ ut_asserteq(1, run_command("fdt set /no-node noprop", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test setting property of non-existent alias */ ut_asserteq(1, run_command("fdt set noalias noprop", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_BADPATH"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test setting property of bad alias */ ut_asserteq(1, run_command("fdt set badalias noprop", 1)); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -918,46 +918,46 @@ static int fdt_test_mknode(struct unit_test_state *uts) ut_assertok(run_commandf("fdt list /newnode")); ut_assert_nextline("newnode {"); ut_assert_nextline("};"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test creation of new node in /test-node@1234 */ ut_assertok(run_commandf("fdt mknode /test-node@1234 newsubnode")); ut_assertok(run_commandf("fdt list /test-node@1234/newsubnode")); ut_assert_nextline("newsubnode {"); ut_assert_nextline("};"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test creation of new node in /test-node@1234 by alias */ ut_assertok(run_commandf("fdt mknode testnodealias newersubnode")); ut_assertok(run_commandf("fdt list testnodealias/newersubnode")); ut_assert_nextline("newersubnode {"); ut_assert_nextline("};"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test creation of new node in /test-node@1234 over existing node */ ut_asserteq(1, run_commandf("fdt mknode testnodealias newsubnode")); ut_assert_nextline("libfdt fdt_add_subnode(): FDT_ERR_EXISTS"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test creation of new node in /test-node@1234 by alias over existing node */ ut_asserteq(1, run_commandf("fdt mknode testnodealias newersubnode")); ut_assert_nextline("libfdt fdt_add_subnode(): FDT_ERR_EXISTS"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test creation of new node in non-existent node */ ut_asserteq(1, run_commandf("fdt mknode /no-node newnosubnode")); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test creation of new node in non-existent alias */ ut_asserteq(1, run_commandf("fdt mknode noalias newfailsubnode")); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_BADPATH"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test creation of new node in bad alias */ ut_asserteq(1, run_commandf("fdt mknode badalias newbadsubnode")); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -976,7 +976,7 @@ static int fdt_test_rm(struct unit_test_state *uts) ut_assertok(run_commandf("fdt rm / compatible")); ut_asserteq(1, run_commandf("fdt print / compatible")); ut_assert_nextline("libfdt fdt_getprop(): FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test removal of property clock-names in subnode /test-node@1234 */ ut_assertok(run_commandf("fdt print /test-node@1234 clock-names")); @@ -984,7 +984,7 @@ static int fdt_test_rm(struct unit_test_state *uts) ut_assertok(run_commandf("fdt rm /test-node@1234 clock-names")); ut_asserteq(1, run_commandf("fdt print /test-node@1234 clock-names")); ut_assert_nextline("libfdt fdt_getprop(): FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test removal of property u-boot,empty-property in subnode /test-node@1234 by alias */ ut_assertok(run_commandf("fdt print testnodealias u-boot,empty-property")); @@ -992,44 +992,44 @@ static int fdt_test_rm(struct unit_test_state *uts) ut_assertok(run_commandf("fdt rm testnodealias u-boot,empty-property")); ut_asserteq(1, run_commandf("fdt print testnodealias u-boot,empty-property")); ut_assert_nextline("libfdt fdt_getprop(): FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test removal of non-existent property noprop in subnode /test-node@1234 */ ut_asserteq(1, run_commandf("fdt rm /test-node@1234 noprop")); ut_assert_nextline("libfdt fdt_delprop(): FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test removal of non-existent node /no-node@5678 */ ut_asserteq(1, run_commandf("fdt rm /no-node@5678")); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test removal of subnode /test-node@1234/subnode by alias */ ut_assertok(run_commandf("fdt rm subnodealias")); ut_asserteq(1, run_commandf("fdt print /test-node@1234/subnode")); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test removal of node by non-existent alias */ ut_asserteq(1, run_commandf("fdt rm noalias")); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_BADPATH"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test removal of node by bad alias */ ut_asserteq(1, run_commandf("fdt rm noalias")); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_BADPATH"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test removal of node /test-node@1234 */ ut_assertok(run_commandf("fdt rm /test-node@1234")); ut_asserteq(1, run_commandf("fdt print /test-node@1234")); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test removal of node / */ ut_assertok(run_commandf("fdt rm /")); ut_asserteq(1, run_commandf("fdt print /")); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -1046,17 +1046,17 @@ static int fdt_test_bootcpu(struct unit_test_state *uts) /* Test getting default bootcpu entry */ ut_assertok(run_commandf("fdt header get bootcpu boot_cpuid_phys")); ut_asserteq(0, env_get_ulong("bootcpu", 10, 0x1234)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test setting and getting new bootcpu entry, twice, to test overwrite */ for (i = 42; i <= 43; i++) { ut_assertok(run_commandf("fdt bootcpu %d", i)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test getting new bootcpu entry */ ut_assertok(run_commandf("fdt header get bootcpu boot_cpuid_phys")); ut_asserteq(i, env_get_ulong("bootcpu", 10, 0x1234)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); } return 0; @@ -1069,11 +1069,11 @@ static int fdt_test_header_get(struct unit_test_state *uts, /* Test getting valid header entry */ ut_assertok(run_commandf("fdt header get fvar %s", field)); ut_asserteq(val, env_get_hex("fvar", 0x1234)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test getting malformed header entry */ ut_asserteq(1, run_commandf("fdt header get fvar typo%stypo", field)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -1099,7 +1099,7 @@ static int fdt_test_header(struct unit_test_state *uts) ut_assert_nextline("size_dt_struct:\t\t0x%x", fdt_size_dt_struct(fdt)); ut_assert_nextline("number mem_rsv:\t\t0x%x", fdt_num_mem_rsv(fdt)); ut_assert_nextline_empty(); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test header get */ ut_assertok(fdt_test_header_get(uts, "magic", fdt_magic(fdt))); @@ -1175,7 +1175,7 @@ static int fdt_test_memory_cells(struct unit_test_state *uts, ut_assert_nextline("\tdevice_type = \"memory\";"); ut_assert_nextline("\treg = <%s %s>;", pada, pads); ut_assert_nextline("};"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); free(sets); free(seta); @@ -1223,7 +1223,7 @@ static int fdt_test_rsvmem(struct unit_test_state *uts) ut_assert_nextline("------------------------------------------------"); ut_assert_nextline(" %x\t%016x\t%016x", 0, 0x42, 0x1701); ut_assert_nextline(" %x\t%016x\t%016x", 1, 0x74656, 0x9); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test add new reserved memory node */ ut_assertok(run_commandf("fdt rsvmem add 0x1234 0x5678")); @@ -1233,7 +1233,7 @@ static int fdt_test_rsvmem(struct unit_test_state *uts) ut_assert_nextline(" %x\t%016x\t%016x", 0, 0x42, 0x1701); ut_assert_nextline(" %x\t%016x\t%016x", 1, 0x74656, 0x9); ut_assert_nextline(" %x\t%016x\t%016x", 2, 0x1234, 0x5678); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test delete reserved memory node */ ut_assertok(run_commandf("fdt rsvmem delete 0")); @@ -1242,7 +1242,7 @@ static int fdt_test_rsvmem(struct unit_test_state *uts) ut_assert_nextline("------------------------------------------------"); ut_assert_nextline(" %x\t%016x\t%016x", 0, 0x74656, 0x9); ut_assert_nextline(" %x\t%016x\t%016x", 1, 0x1234, 0x5678); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test re-add new reserved memory node */ ut_assertok(run_commandf("fdt rsvmem add 0x42 0x1701")); @@ -1252,12 +1252,12 @@ static int fdt_test_rsvmem(struct unit_test_state *uts) ut_assert_nextline(" %x\t%016x\t%016x", 0, 0x74656, 0x9); ut_assert_nextline(" %x\t%016x\t%016x", 1, 0x1234, 0x5678); ut_assert_nextline(" %x\t%016x\t%016x", 2, 0x42, 0x1701); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test delete nonexistent reserved memory node */ ut_asserteq(1, run_commandf("fdt rsvmem delete 10")); ut_assert_nextline("libfdt fdt_del_mem_rsv(): FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -1275,7 +1275,7 @@ static int fdt_test_chosen(struct unit_test_state *uts) /* Test default chosen node presence, fail as there is no /chosen node */ ut_asserteq(1, run_commandf("fdt print /chosen")); ut_assert_nextline("libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test add new chosen node without initrd */ ut_assertok(run_commandf("fdt chosen")); @@ -1289,7 +1289,7 @@ static int fdt_test_chosen(struct unit_test_state *uts) !IS_ENABLED(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT)) ut_assert_nextlinen("\tkaslr-seed = "); ut_assert_nextline("};"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test add new chosen node with initrd */ ut_assertok(run_commandf("fdt chosen 0x1234 0x5678")); @@ -1308,7 +1308,7 @@ static int fdt_test_chosen(struct unit_test_state *uts) !IS_ENABLED(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT)) ut_assert_nextlinen("\tkaslr-seed = "); ut_assert_nextline("};"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } @@ -1351,7 +1351,7 @@ static int fdt_test_apply(struct unit_test_state *uts) ut_assert_nextline("\t__symbols__ {"); ut_assert_nextline("\t};"); ut_assert_nextline("};"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test simple DTO application */ ut_assertok(run_commandf("fdt apply 0x%08lx", addro)); @@ -1361,7 +1361,7 @@ static int fdt_test_apply(struct unit_test_state *uts) ut_assert_nextline("\t__symbols__ {"); ut_assert_nextline("\t};"); ut_assert_nextline("};"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* * Create complex DTO which: @@ -1414,7 +1414,7 @@ static int fdt_test_apply(struct unit_test_state *uts) ut_assert_nextline("\t\tsubnodephandle = \"/subnode\";"); ut_assert_nextline("\t};"); ut_assert_nextline("};"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* * Create complex DTO which: @@ -1457,7 +1457,7 @@ static int fdt_test_apply(struct unit_test_state *uts) ut_assert_nextline("\t\tsubnodephandle = \"/subnode\";"); ut_assert_nextline("\t};"); ut_assert_nextline("};"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } diff --git a/test/cmd/font.c b/test/cmd/font.c index 6f4e54e7f3f..25d365dedd2 100644 --- a/test/cmd/font.c +++ b/test/cmd/font.c @@ -30,7 +30,7 @@ static int font_test_base(struct unit_test_state *uts) ut_assert_nextline("nimbus_sans_l_regular"); if (IS_ENABLED(CONFIG_CONSOLE_TRUETYPE_CANTORAONE)) ut_assert_nextline("cantoraone_regular"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); ut_assertok(vidconsole_get_font_size(dev, &name, &size)); ut_asserteq_str("nimbus_sans_l_regular", name); @@ -48,19 +48,19 @@ static int font_test_base(struct unit_test_state *uts) if (max_metrics < 2) { ut_asserteq(1, ret); ut_assert_nextline("Failed (error -7)"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } ut_assertok(ret); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); ut_assertok(vidconsole_get_font_size(dev, &name, &size)); ut_asserteq_str("cantoraone_regular", name); ut_asserteq(40, size); ut_assertok(run_command("font size 30", 0)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); ut_assertok(vidconsole_get_font_size(dev, &name, &size)); ut_asserteq_str("cantoraone_regular", name); diff --git a/test/cmd/mbr.c b/test/cmd/mbr.c index 8c9d01130a3..e1a9cdffb04 100644 --- a/test/cmd/mbr.c +++ b/test/cmd/mbr.c @@ -264,7 +264,7 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assertok(run_commandf("mmc dev 6")); ut_assert_nextline("switch to partitions #0, OK"); ut_assert_nextline("mmc6 is current device"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Make sure mmc6 is 12+ MiB in size */ ut_assertok(run_commandf("mmc read 0x%lx 0x%lx 1", ra, (ulong)0xBFFE00 / 0x200)); @@ -289,7 +289,7 @@ static int mbr_test_run(struct unit_test_state *uts) memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 0x%lx 0x%lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* 000001b0 00 00 00 00 00 00 00 00 78 56 34 12 00 00 80 05 |........xV4.....| 000001c0 05 01 0e 25 24 01 00 40 00 00 00 08 00 00 00 00 |...%$..@........| @@ -324,7 +324,7 @@ static int mbr_test_run(struct unit_test_state *uts) memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 0x%lx 0x%lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* 000001b0 00 00 00 00 00 00 00 00 78 56 34 12 00 00 80 05 |........xV4.....| 000001c0 05 01 0e 25 24 01 00 40 00 00 00 08 00 00 00 25 |...%$..@.......%| @@ -359,7 +359,7 @@ static int mbr_test_run(struct unit_test_state *uts) memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 0x%lx 0x%lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* 000001b0 00 00 00 00 00 00 00 00 78 56 34 12 00 00 80 05 |........xV4.....| 000001c0 05 01 0e 25 24 01 00 40 00 00 00 08 00 00 00 25 |...%$..@.......%| @@ -394,7 +394,7 @@ static int mbr_test_run(struct unit_test_state *uts) memset(rbuf, 0, sizeof(rbuf)); ut_assertok(run_commandf("read mmc 6:0 0x%lx 0x%lx 1", ra, ebr_blk)); ut_assertok(memcmp(ebr_wbuf, rbuf, 512)); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* 000001b0 00 00 00 00 00 00 00 00 78 56 34 12 00 00 80 05 |........xV4.....| 000001c0 05 01 0e 25 24 01 00 40 00 00 00 08 00 00 00 25 |...%$..@.......%| @@ -426,7 +426,7 @@ static int mbr_test_run(struct unit_test_state *uts) ut_assert_nextline("MBR: write success!"); ut_assertok(run_commandf("mbr verify mmc 6")); ut_assert_nextline("MBR: verify success!"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* 000001b0 00 00 00 00 00 00 00 00 78 56 34 12 00 00 80 05 |........xV4.....| 000001c0 05 01 0e 25 24 01 00 40 00 00 00 08 00 00 00 25 |...%$..@.......%| diff --git a/test/cmd/test_echo.c b/test/cmd/test_echo.c index b829f71c591..8b306cc907f 100644 --- a/test/cmd/test_echo.c +++ b/test/cmd/test_echo.c @@ -49,7 +49,7 @@ static int lib_test_hush_echo(struct unit_test_state *uts) console_record_readline(uts->actual_str, sizeof(uts->actual_str)); ut_asserteq_str(echo_data[i].expected, uts->actual_str); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); } return 0; } diff --git a/test/cmd/test_pause.c b/test/cmd/test_pause.c index 927fe174d74..174c31a3852 100644 --- a/test/cmd/test_pause.c +++ b/test/cmd/test_pause.c @@ -19,7 +19,7 @@ static int lib_test_hush_pause(struct unit_test_state *uts) ut_assertok(run_command("pause", 0)); console_record_readline(uts->actual_str, sizeof(uts->actual_str)); ut_asserteq_str("Press any key to continue...", uts->actual_str); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test provided message */ /* Cook a newline when the command is expected to pause */ @@ -27,7 +27,7 @@ static int lib_test_hush_pause(struct unit_test_state *uts) ut_assertok(run_command("pause 'Prompt for pause...'", 0)); console_record_readline(uts->actual_str, sizeof(uts->actual_str)); ut_asserteq_str("Prompt for pause...", uts->actual_str); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); /* Test providing more than one params */ /* No newline cooked here since the command is expected to fail */ diff --git a/test/cmd/wget.c b/test/cmd/wget.c index 1660d2bdcb0..fe26fee54c9 100644 --- a/test/cmd/wget.c +++ b/test/cmd/wget.c @@ -221,7 +221,7 @@ static int net_test_wget(struct unit_test_state *uts) run_command("md5sum ${loadaddr} ${filesize}", 0); ut_assert_nextline("md5 for 00020000 ... 0002001f ==> 234af48e94b0085060249ecb5942ab57"); - ut_assertok(ut_check_console_end(uts)); + ut_assert_console_end(); return 0; } -- cgit v1.2.3