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/setexpr.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'test/cmd/setexpr.c') 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[]) -- 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/setexpr.c | 1 - 1 file changed, 1 deletion(-) (limited to 'test/cmd/setexpr.c') 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 -- 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/setexpr.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'test/cmd/setexpr.c') 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[]) -- 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/setexpr.c | 1 - 1 file changed, 1 deletion(-) (limited to 'test/cmd/setexpr.c') 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)); -- cgit v1.2.3