summaryrefslogtreecommitdiff
path: root/test/cmd/setexpr.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-03-12 15:57:20 -0500
committerTom Rini <trini@konsulko.com>2021-03-12 15:57:20 -0500
commitc57ec2c2bab00c02a457ca70624c1333c60c2ec0 (patch)
tree8b8b53585fd9bc655f32eba141f3c2d25d21d882 /test/cmd/setexpr.c
parent668866aa24a87244e64be42f296959297ddc5014 (diff)
parentfc3283314539d6c3fb577359f6cb364c19c13726 (diff)
Merge branch '2021-03-12-test-improvements' into next
- Assorted improvements to the pytest framework
Diffstat (limited to 'test/cmd/setexpr.c')
-rw-r--r--test/cmd/setexpr.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/test/cmd/setexpr.c b/test/cmd/setexpr.c
index fd6d869c0ed..27113c083c5 100644
--- a/test/cmd/setexpr.c
+++ b/test/cmd/setexpr.c
@@ -306,8 +306,8 @@ static int setexpr_test_str(struct unit_test_state *uts)
ut_asserteq(1, run_command("setexpr.s fred 0", 0));
ut_assertok(ut_check_delta(start_mem));
- start_mem = ut_check_free();
ut_assertok(env_set("fred", "12345"));
+ start_mem = ut_check_free();
ut_assertok(run_command("setexpr.s fred *0", 0));
ut_asserteq_str("hello", env_get("fred"));
ut_assertok(ut_check_delta(start_mem));
@@ -345,7 +345,22 @@ static int setexpr_test_str_oper(struct unit_test_state *uts)
start_mem = ut_check_free();
ut_assertok(run_command("setexpr.s fred *0 + *10", 0));
ut_asserteq_str("hello there", env_get("fred"));
- ut_assertok(ut_check_delta(start_mem));
+
+ /*
+ * This check does not work with sandbox_flattree, apparently due to
+ * memory allocations in env_set().
+ *
+ * The truetype console produces lots of memory allocations even though
+ * the LCD display is not visible. But even without these, it does not
+ * work.
+ *
+ * A better test would be for dlmalloc to record the allocs and frees
+ * for a particular caller, but that is not supported.
+ *
+ * For now, drop this test.
+ *
+ * ut_assertok(ut_check_delta(start_mem));
+ */
unmap_sysmem(buf);
@@ -375,10 +390,9 @@ SETEXPR_TEST(setexpr_test_str_long, UT_TESTF_CONSOLE_REC);
int do_ut_setexpr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
- struct unit_test *tests = ll_entry_start(struct unit_test,
- setexpr_test);
- const int n_ents = ll_entry_count(struct unit_test, setexpr_test);
+ struct unit_test *tests = UNIT_TEST_SUITE_START(setexpr_test);
+ const int n_ents = UNIT_TEST_SUITE_COUNT(setexpr_test);
- return cmd_ut_category("cmd_setexpr", "cmd_mem_", tests, n_ents, argc,
- argv);
+ return cmd_ut_category("cmd_setexpr", "setexpr_test_", tests, n_ents,
+ argc, argv);
}