mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
heap/test_leak: changed requested memory on leak checks to match the threshold
This commit is contained in:
parent
c0d12988d3
commit
cf95ea40d4
@ -18,18 +18,18 @@ static char* check_calloc(int size)
|
||||
|
||||
TEST_CASE("Check for leaks (no leak)", "[heap]")
|
||||
{
|
||||
char *arr = check_calloc(7000);
|
||||
char *arr = check_calloc(1000);
|
||||
free(arr);
|
||||
}
|
||||
|
||||
TEST_CASE("Check for leaks (leak)", "[heap][ignore]")
|
||||
{
|
||||
check_calloc(7000);
|
||||
check_calloc(1000);
|
||||
}
|
||||
|
||||
TEST_CASE("Not check for leaks", "[heap][leaks]")
|
||||
{
|
||||
check_calloc(7000);
|
||||
check_calloc(1000);
|
||||
}
|
||||
|
||||
TEST_CASE("Set a leak level = 7016", "[heap][leaks=7016]")
|
||||
@ -39,7 +39,7 @@ TEST_CASE("Set a leak level = 7016", "[heap][leaks=7016]")
|
||||
|
||||
static void test_fn(void)
|
||||
{
|
||||
check_calloc(7000);
|
||||
check_calloc(1000);
|
||||
}
|
||||
|
||||
TEST_CASE_MULTIPLE_STAGES("Not check for leaks in MULTIPLE_STAGES mode", "[heap][leaks]", test_fn, test_fn, test_fn);
|
||||
@ -48,13 +48,13 @@ TEST_CASE_MULTIPLE_STAGES("Check for leaks in MULTIPLE_STAGES mode (leak)", "[he
|
||||
|
||||
static void test_fn2(void)
|
||||
{
|
||||
check_calloc(7000);
|
||||
check_calloc(1000);
|
||||
esp_restart();
|
||||
}
|
||||
|
||||
static void test_fn3(void)
|
||||
{
|
||||
check_calloc(7000);
|
||||
check_calloc(1000);
|
||||
}
|
||||
|
||||
TEST_CASE_MULTIPLE_STAGES_ESP32("Check for leaks in MULTIPLE_STAGES mode (manual reset)", "[heap][leaks][reset=SW_CPU_RESET, SW_CPU_RESET]", test_fn2, test_fn2, test_fn3);
|
||||
TEST_CASE_MULTIPLE_STAGES("Check for leaks in MULTIPLE_STAGES mode (manual reset)", "[heap][leaks][reset=SW_CPU_RESET, SW_CPU_RESET]", test_fn2, test_fn2, test_fn3);
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
TEST_CASE_ESP32("Capabilities allocator test", "[heap]")
|
||||
TEST_CASE("Capabilities allocator test", "[heap]")
|
||||
{
|
||||
char *m1, *m2[10];
|
||||
int x;
|
||||
|
@ -22,7 +22,7 @@ TEST_CASE("realloc shrink buffer in place", "[heap]")
|
||||
|
||||
#endif
|
||||
|
||||
TEST_CASE_ESP32("realloc move data to a new heap type", "[heap]")
|
||||
TEST_CASE("realloc move data to a new heap type", "[heap]")
|
||||
{
|
||||
const char *test = "I am some test content to put in the heap";
|
||||
char buf[64];
|
||||
|
@ -87,6 +87,10 @@ void setUp(void)
|
||||
|
||||
static void check_leak(size_t before_free, size_t after_free, const char *type)
|
||||
{
|
||||
printf("MALLOC_CAP_%s leak: Leak threshold is: %u \n",
|
||||
type,
|
||||
critical_leak_threshold);
|
||||
|
||||
if (before_free <= after_free) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user