Merge branch 'bugfix/linux_host_test_v5.4' into 'release/v5.4'

fix(linux): fix mixed linux host test issues found after CI docker image upgrade (v5.4)

See merge request espressif/esp-idf!38232
This commit is contained in:
Marius Vikhammer
2025-04-30 13:02:25 +08:00
4 changed files with 11 additions and 11 deletions

View File

@ -307,7 +307,6 @@ test_pytest_qemu:
--qemu-extra-args \"-global driver=timer.$IDF_TARGET.timg,property=wdt_disable,value=true\" --qemu-extra-args \"-global driver=timer.$IDF_TARGET.timg,property=wdt_disable,value=true\"
test_pytest_linux: test_pytest_linux:
allow_failure: true # IDFCI-2784 [v5.5, v5.4] test_pytest_linux fails on ubuntu 24.04
extends: extends:
- .host_test_template - .host_test_template
- .before_script:build - .before_script:build

View File

@ -29,7 +29,7 @@ TEST(esp_app_format, esp_app_get_elf_sha256_test)
int res; int res;
size_t len; size_t len;
char ref_sha256[sha256_hex_len + 1]; char ref_sha256[sha256_hex_len + 2];
const esp_app_desc_t* desc = esp_app_get_description(); const esp_app_desc_t* desc = esp_app_get_description();
for (int i = 0; i < sizeof(ref_sha256) / 2; ++i) { for (int i = 0; i < sizeof(ref_sha256) / 2; ++i) {
snprintf(ref_sha256 + 2 * i, 3, "%02x", desc->app_elf_sha256[i]); snprintf(ref_sha256 + 2 * i, 3, "%02x", desc->app_elf_sha256[i]);

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -50,7 +50,7 @@ TEST_CASE("Alloc APIs", "[heap]")
TEST_CASE("Size APIs", "[heap]") TEST_CASE("Size APIs", "[heap]")
{ {
/* These functions doesnt provide any useful information on linux /* These functions doesn't provide any useful information on linux
These "tests" are simply included to check that all the functions in the header These "tests" are simply included to check that all the functions in the header
are actually mocked are actually mocked
*/ */
@ -71,21 +71,22 @@ TEST_CASE("Size APIs", "[heap]")
TEST_ASSERT_TRUE(heap_caps_get_allocated_size(&info) == 0); TEST_ASSERT_TRUE(heap_caps_get_allocated_size(&info) == 0);
} }
#define TEST_ALIGNMENT 0x1F #define TEST_ALIGNMENT 0x20
TEST_CASE("Aligned alloc APIs", "[heap]") TEST_CASE("Aligned alloc APIs", "[heap]")
{ {
uint8_t * p = heap_caps_aligned_alloc(TEST_ALIGNMENT, MALLOC_LEN, MALLOC_CAP_DEFAULT); const int aligned_len = MALLOC_LEN - (MALLOC_LEN % TEST_ALIGNMENT);
uint8_t * p = heap_caps_aligned_alloc(TEST_ALIGNMENT, aligned_len, MALLOC_CAP_DEFAULT);
TEST_ASSERT_NOT_NULL(p); TEST_ASSERT_NOT_NULL(p);
TEST_ASSERT_TRUE(((intptr_t)p & (0x1F -1)) == 0); TEST_ASSERT_TRUE(((intptr_t)p & (0x1F -1)) == 0);
memset(p, TEST_VAL, MALLOC_LEN); memset(p, TEST_VAL, aligned_len);
TEST_ASSERT_EACH_EQUAL_HEX8(TEST_VAL, p, MALLOC_LEN); TEST_ASSERT_EACH_EQUAL_HEX8(TEST_VAL, p, aligned_len);
heap_caps_free(p); heap_caps_free(p);
p = heap_caps_aligned_calloc(TEST_ALIGNMENT, MALLOC_LEN, sizeof(uint8_t), MALLOC_CAP_DEFAULT); p = heap_caps_aligned_calloc(TEST_ALIGNMENT, aligned_len, sizeof(uint8_t), MALLOC_CAP_DEFAULT);
TEST_ASSERT_NOT_NULL(p); TEST_ASSERT_NOT_NULL(p);
TEST_ASSERT_TRUE(((intptr_t)p & (0x1F -1)) == 0); TEST_ASSERT_TRUE(((intptr_t)p & (0x1F -1)) == 0);
TEST_ASSERT_EACH_EQUAL_HEX8(0, p, MALLOC_LEN); TEST_ASSERT_EACH_EQUAL_HEX8(0, p, aligned_len);
heap_caps_free(p); heap_caps_free(p);
} }

View File

@ -95,7 +95,7 @@ private:
int print_to_buffer(const char *format, va_list args) int print_to_buffer(const char *format, va_list args)
{ {
// Added support for multi-line log, for example ESP_LOG_BUFFER... // Added support for multi-line log, for example ESP_LOG_BUFFER...
int ret = vsnprintf(&print_buffer[buffer_idx], BUFFER_SIZE, format, args); int ret = vsnprintf(&print_buffer[buffer_idx], BUFFER_SIZE - buffer_idx, format, args);
buffer_idx += ret; buffer_idx += ret;
return ret; return ret;
} }