mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 20:41:14 +00:00
feat(linux): esp_app_format now works on Linux
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
|
||||
|
||||
components/esp_app_format/test_apps:
|
||||
enable:
|
||||
- if: IDF_TARGET in ["esp32", "esp32s2", "esp32c3", "linux"]
|
||||
reason: covers all major arch types, xtensa vs riscv, single vs dual-core
|
@@ -1,2 +1,2 @@
|
||||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
||||
| Supported Targets | ESP32 | ESP32-C3 | ESP32-S2 | Linux |
|
||||
| ----------------- | ----- | -------- | -------- | ----- |
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include "esp_app_desc.h"
|
||||
#include "unity.h"
|
||||
#include "unity_fixture.h"
|
||||
#include "inttypes_ext.h"
|
||||
|
||||
TEST_GROUP(esp_app_format);
|
||||
|
||||
@@ -40,7 +41,7 @@ TEST(esp_app_format, esp_app_get_elf_sha256_test)
|
||||
memset(dst, fill, sizeof(dst));
|
||||
len = sizeof(dst);
|
||||
res = esp_app_get_elf_sha256(dst, len);
|
||||
printf("%d: %s (%d)\n", len, dst, res);
|
||||
printf("%" PRIuSIZE ": %s (%d)\n", len, dst, res);
|
||||
TEST_ASSERT_EQUAL(sha256_hex_len + 1, res);
|
||||
TEST_ASSERT_EQUAL(0, memcmp(dst, ref_sha256, res - 1));
|
||||
TEST_ASSERT_EQUAL_HEX(0, dst[sha256_hex_len]);
|
||||
@@ -49,7 +50,7 @@ TEST(esp_app_format, esp_app_get_elf_sha256_test)
|
||||
memset(dst, fill, sizeof(dst));
|
||||
len = 9;
|
||||
res = esp_app_get_elf_sha256(dst, len);
|
||||
printf("%d: %s (%d)\n", len, dst, res);
|
||||
printf("%" PRIuSIZE ": %s (%d)\n", len, dst, res);
|
||||
TEST_ASSERT_EQUAL(9, res);
|
||||
TEST_ASSERT_EQUAL(0, memcmp(dst, ref_sha256, res - 1));
|
||||
TEST_ASSERT_EQUAL_HEX(0, dst[8]);
|
||||
@@ -59,7 +60,7 @@ TEST(esp_app_format, esp_app_get_elf_sha256_test)
|
||||
strncpy(ref_sha256, esp_app_get_elf_sha256_str(), sizeof(ref_sha256));
|
||||
len = strlen(ref_sha256);
|
||||
TEST_ASSERT_EQUAL(CONFIG_APP_RETRIEVE_LEN_ELF_SHA, len);
|
||||
printf("\n_Ref: %s (len=%d with null)\n", ref_sha256, len);
|
||||
printf("\n_Ref: %s (len=%" PRIuSIZE " with null)\n", ref_sha256, len);
|
||||
|
||||
TEST_ASSERT_EQUAL(0, esp_app_get_elf_sha256(dst, 0));
|
||||
TEST_ASSERT_EQUAL(0, esp_app_get_elf_sha256(dst, 1));
|
||||
@@ -69,7 +70,7 @@ TEST(esp_app_format, esp_app_get_elf_sha256_test)
|
||||
memset(dst, 0xCC, sizeof(dst));
|
||||
TEST_ASSERT_EQUAL(req_len, esp_app_get_elf_sha256(dst, req_len));
|
||||
len = strlen(dst) + 1; // + 1 for the null terminator
|
||||
printf("_%02d_: %-15s (len=%d with null)\n", req_len, dst, len);
|
||||
printf("_%02" PRIuSIZE "_: %-15s (len=%" PRIuSIZE " with null)\n", req_len, dst, len);
|
||||
TEST_ASSERT_EQUAL(req_len, len);
|
||||
TEST_ASSERT_EQUAL_STRING_LEN(ref_sha256, dst, len - 1); // -1 without null terminator
|
||||
}
|
||||
@@ -78,7 +79,7 @@ TEST(esp_app_format, esp_app_get_elf_sha256_test)
|
||||
size_t max_len = CONFIG_APP_RETRIEVE_LEN_ELF_SHA + 1; // + 1 for the null terminator
|
||||
TEST_ASSERT_EQUAL(max_len, esp_app_get_elf_sha256(dst, 99));
|
||||
len = strlen(dst) + 1; // + 1 for the null terminator
|
||||
printf("_99_: %-15s (len=%d with null)\n", dst, len);
|
||||
printf("_99_: %-15s (len=%" PRIuSIZE " with null)\n", dst, len);
|
||||
TEST_ASSERT_EQUAL(max_len, len);
|
||||
TEST_ASSERT_EQUAL_STRING_LEN(ref_sha256, dst, len - 1); // -1 without null terminator
|
||||
}
|
||||
|
@@ -1,11 +1,18 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.generic
|
||||
def test_esp_app_format(dut: Dut) -> None:
|
||||
dut.expect_unity_test_output()
|
||||
|
||||
|
||||
@pytest.mark.linux
|
||||
@pytest.mark.host_test
|
||||
def test_esp_app_format_linux(dut: Dut) -> None:
|
||||
dut.expect_unity_test_output()
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# General options for additional checks
|
||||
CONFIG_HEAP_POISONING_COMPREHENSIVE=y
|
||||
CONFIG_COMPILER_WARN_WRITE_STRINGS=y
|
||||
CONFIG_BOOTLOADER_LOG_LEVEL_WARN=y
|
||||
#CONFIG_BOOTLOADER_LOG_LEVEL_WARN=y TODO IDF-9967
|
||||
CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y
|
||||
CONFIG_COMPILER_STACK_CHECK_MODE_STRONG=y
|
||||
CONFIG_COMPILER_STACK_CHECK=y
|
||||
|
Reference in New Issue
Block a user