mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 19:54:32 +02:00
heap/test_leak: changed requested memory on leak checks to match the threshold
This commit is contained in:
@@ -18,18 +18,18 @@ static char* check_calloc(int size)
|
|||||||
|
|
||||||
TEST_CASE("Check for leaks (no leak)", "[heap]")
|
TEST_CASE("Check for leaks (no leak)", "[heap]")
|
||||||
{
|
{
|
||||||
char *arr = check_calloc(7000);
|
char *arr = check_calloc(1000);
|
||||||
free(arr);
|
free(arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Check for leaks (leak)", "[heap][ignore]")
|
TEST_CASE("Check for leaks (leak)", "[heap][ignore]")
|
||||||
{
|
{
|
||||||
check_calloc(7000);
|
check_calloc(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Not check for leaks", "[heap][leaks]")
|
TEST_CASE("Not check for leaks", "[heap][leaks]")
|
||||||
{
|
{
|
||||||
check_calloc(7000);
|
check_calloc(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Set a leak level = 7016", "[heap][leaks=7016]")
|
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)
|
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);
|
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)
|
static void test_fn2(void)
|
||||||
{
|
{
|
||||||
check_calloc(7000);
|
check_calloc(1000);
|
||||||
esp_restart();
|
esp_restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_fn3(void)
|
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 <stdlib.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
||||||
TEST_CASE_ESP32("Capabilities allocator test", "[heap]")
|
TEST_CASE("Capabilities allocator test", "[heap]")
|
||||||
{
|
{
|
||||||
char *m1, *m2[10];
|
char *m1, *m2[10];
|
||||||
int x;
|
int x;
|
||||||
|
@@ -22,7 +22,7 @@ TEST_CASE("realloc shrink buffer in place", "[heap]")
|
|||||||
|
|
||||||
#endif
|
#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";
|
const char *test = "I am some test content to put in the heap";
|
||||||
char buf[64];
|
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)
|
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) {
|
if (before_free <= after_free) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user