Skip to content

Commit

Permalink
Merge branch 'ci/test_verify_image' into 'master'
Browse files Browse the repository at this point in the history
fix(bootloader_support): Fix memory leak for unit tests

Closes IDFCI-1754 and IDFCI-1755

See merge request espressif/esp-idf!24870
  • Loading branch information
KonstantinKondrashov committed Aug 9, 2023
2 parents 99ce8e6 + 95626b9 commit a12c063
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "unity.h"
#include "unity_test_runner.h"
#include "esp_heap_caps.h"
#include "esp_ota_ops.h"


// Some resources are lazy allocated, e.g. newlib locks, GDMA channel lazy installed by crypto driver
Expand All @@ -25,12 +26,12 @@ static void check_leak(size_t before_free, size_t after_free, const char *type)

void setUp(void)
{
// load the partition table before measuring the initial free heap size.
TEST_ASSERT_NOT_EQUAL(NULL, esp_ota_get_running_partition());
before_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
before_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT);
}



void tearDown(void)
{
size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ TEST_CASE("Verify unit test app image", "[bootloader_support][qemu-ignore-c3]")
.offset = running->address,
.size = running->size,
};
TEST_ASSERT_GREATER_THAN(0, running->address);
TEST_ASSERT_GREATER_THAN(0, running->size);

TEST_ASSERT_EQUAL_HEX(ESP_OK, esp_image_verify(ESP_IMAGE_VERIFY, &running_pos, &data));
TEST_ASSERT_NOT_EQUAL(0, data.image_len);
Expand Down

0 comments on commit a12c063

Please sign in to comment.