mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-19 11:24:42 +00:00
test: remove available memory check in setexpr_test_str_oper()
env_set() frees the previous value after allocating the new value. As the free() may merge memory chunks the available memory is not expected to stay constant. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
parent
b071642636
commit
d4265cdcd5
1 changed files with 0 additions and 24 deletions
|
@ -319,7 +319,6 @@ SETEXPR_TEST(setexpr_test_str, UTF_CONSOLE);
|
||||||
/* Test 'setexpr' command with concatenating strings */
|
/* Test 'setexpr' command with concatenating strings */
|
||||||
static int setexpr_test_str_oper(struct unit_test_state *uts)
|
static int setexpr_test_str_oper(struct unit_test_state *uts)
|
||||||
{
|
{
|
||||||
ulong start_mem;
|
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
buf = map_sysmem(0, BUF_SIZE);
|
buf = map_sysmem(0, BUF_SIZE);
|
||||||
|
@ -327,37 +326,14 @@ static int setexpr_test_str_oper(struct unit_test_state *uts)
|
||||||
strcpy(buf, "hello");
|
strcpy(buf, "hello");
|
||||||
strcpy(buf + 0x10, " there");
|
strcpy(buf + 0x10, " there");
|
||||||
|
|
||||||
start_mem = ut_check_free();
|
|
||||||
ut_asserteq(1, run_command("setexpr.s fred *0 * *10", 0));
|
ut_asserteq(1, run_command("setexpr.s fred *0 * *10", 0));
|
||||||
ut_assertok(ut_check_delta(start_mem));
|
|
||||||
ut_assert_nextline("invalid op");
|
ut_assert_nextline("invalid op");
|
||||||
ut_assert_console_end();
|
ut_assert_console_end();
|
||||||
|
|
||||||
/*
|
|
||||||
* Set 'fred' to the same length as we expect to get below, to avoid a
|
|
||||||
* new allocation in 'setexpr'. That way we can check for memory leaks.
|
|
||||||
*/
|
|
||||||
ut_assertok(env_set("fred", "12345012345"));
|
ut_assertok(env_set("fred", "12345012345"));
|
||||||
start_mem = ut_check_free();
|
|
||||||
ut_assertok(run_command("setexpr.s fred *0 + *10", 0));
|
ut_assertok(run_command("setexpr.s fred *0 + *10", 0));
|
||||||
ut_asserteq_str("hello there", env_get("fred"));
|
ut_asserteq_str("hello there", env_get("fred"));
|
||||||
|
|
||||||
/*
|
|
||||||
* 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);
|
unmap_sysmem(buf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue