[PATCH 2/3] test: env: check that non-mentioned variables to "env default" are preserved

Rasmus Villemoes ravi at prevas.dk
Wed Oct 30 22:34:03 CET 2024


Instead of testing the same expected behaviour for both
non_default_varX, test that when var1 is not in the default env but is
mentioned in the "env default" cmdline, it is removed, while var2 is
untouched.

Signed-off-by: Rasmus Villemoes <ravi at prevas.dk>
---
 test/env/cmd_ut_env.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/test/env/cmd_ut_env.c b/test/env/cmd_ut_env.c
index 4af05764fb8..e1dd1a14cb0 100644
--- a/test/env/cmd_ut_env.c
+++ b/test/env/cmd_ut_env.c
@@ -14,22 +14,21 @@ static int env_test_env_cmd(struct unit_test_state *uts)
 	ut_assertok(run_command("setenv non_default_var1 1", 0));
 	ut_assert_console_end();
 
-	ut_assertok(run_command("setenv non_default_var2 1", 0));
+	ut_assertok(run_command("setenv non_default_var2 2", 0));
 	ut_assert_console_end();
 
 	ut_assertok(run_command("env print non_default_var1", 0));
 	ut_assert_nextline("non_default_var1=1");
 	ut_assert_console_end();
 
-	ut_assertok(run_command("env default non_default_var1 non_default_var2", 0));
+	ut_assertok(run_command("env default non_default_var1", 0));
 	ut_assert_nextline("WARNING: 'non_default_var1' not in imported env, deleting it!");
-	ut_assert_nextline("WARNING: 'non_default_var2' not in imported env, deleting it!");
 	ut_assert_console_end();
 
 	ut_asserteq(1, run_command("env exists non_default_var1", 0));
 	ut_assert_console_end();
 
-	ut_asserteq(1, run_command("env exists non_default_var2", 0));
+	ut_asserteq(0, run_command("env exists non_default_var2", 0));
 	ut_assert_console_end();
 
 	return 0;
-- 
2.47.0



More information about the U-Boot mailing list