From 052f380262e825370ce06f70bc93092a10727708 Mon Sep 17 00:00:00 2001 From: Laukik Hase Date: Thu, 25 Sep 2025 11:04:16 +0530 Subject: [PATCH] ci(esp_tee): Re-enable the TEE test-apps for ESP32-C5 --- .../esp_tee/test_apps/tee_cli_app/pytest_tee_cli.py | 3 +-- .../tee_test_fw/main/test_esp_tee_flash_prot.c | 2 ++ .../esp_tee/test_apps/tee_test_fw/pytest_esp_tee_ut.py | 10 +++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/components/esp_tee/test_apps/tee_cli_app/pytest_tee_cli.py b/components/esp_tee/test_apps/tee_cli_app/pytest_tee_cli.py index c288bd904c..c06816cfeb 100644 --- a/components/esp_tee/test_apps/tee_cli_app/pytest_tee_cli.py +++ b/components/esp_tee/test_apps/tee_cli_app/pytest_tee_cli.py @@ -21,8 +21,7 @@ from ecdsa.util import sigdecode_der from pytest_embedded import Dut from pytest_embedded_idf.utils import idf_parametrize -# TODO: Enable for ESP32-C5 once support is stable -SUPPORTED_TARGETS = ['esp32c6', 'esp32h2'] +SUPPORTED_TARGETS = ['esp32c6', 'esp32c5'] TEST_MSG = 'hello world' diff --git a/components/esp_tee/test_apps/tee_test_fw/main/test_esp_tee_flash_prot.c b/components/esp_tee/test_apps/tee_test_fw/main/test_esp_tee_flash_prot.c index 9a7e68afc4..037dd682ad 100644 --- a/components/esp_tee/test_apps/tee_test_fw/main/test_esp_tee_flash_prot.c +++ b/components/esp_tee/test_apps/tee_test_fw/main/test_esp_tee_flash_prot.c @@ -44,6 +44,7 @@ __attribute__((unused)) static const uint32_t mmu_op_fail_seq[8] = {[0 ... 7] = #define CHECK_MMU_OP_FAIL(ptr_) \ do { \ TEST_ASSERT_EQUAL_HEX8_ARRAY(mmu_op_fail_seq, (ptr_), 0x20); \ + printf("Failed MMU operation, rebooting!\n"); \ esp_restart(); \ } while (0) #endif @@ -256,6 +257,7 @@ TEST_CASE("Test REE-TEE isolation: MMU-spillover", "[exception]") spi_flash_mmap_handle_t handle; const size_t len = 0x100000; // 1MB TEST_ESP_OK(spi_flash_mmap(0x00, len, SPI_FLASH_MMAP_DATA, &ptr, &handle)); + CHECK_MMU_OP_FAIL(ptr); ESP_LOG_BUFFER_HEXDUMP(TAG, ptr, 32, ESP_LOG_INFO); TEST_FAIL_MESSAGE("Exception should have been generated!"); } diff --git a/components/esp_tee/test_apps/tee_test_fw/pytest_esp_tee_ut.py b/components/esp_tee/test_apps/tee_test_fw/pytest_esp_tee_ut.py index ea3b222e61..379b626b5b 100644 --- a/components/esp_tee/test_apps/tee_test_fw/pytest_esp_tee_ut.py +++ b/components/esp_tee/test_apps/tee_test_fw/pytest_esp_tee_ut.py @@ -9,8 +9,7 @@ from pytest_embedded_idf.utils import idf_parametrize # ---------------- Pytest build parameters ---------------- -# TODO: Enable for ESP32-C5 once support is stable -SUPPORTED_TARGETS = ['esp32c6', 'esp32h2'] +SUPPORTED_TARGETS = ['esp32c6', 'esp32h2', 'esp32c5'] CONFIG_DEFAULT = [ # 'config, target, markers', @@ -167,7 +166,12 @@ def test_esp_tee_isolation_checks(dut: IdfDut) -> None: continue dut.expect_exact('Press ENTER to see the list of tests') dut.write(f'"Test REE-TEE isolation: {test}"') - actual_exc = dut.expect(r'Core ([01]) panic\'ed \(([^)]+)\)', timeout=30).group(2).decode() + # NOTE: For ESP32-C5, the MMU-spillover test fails gracefully without raising panic + if dut.target == 'esp32c5' and test == 'MMU-spillover': + dut.expect_exact('Failed MMU operation, rebooting!') + continue + else: + actual_exc = dut.expect(r'Core ([01]) panic\'ed \(([^)]+)\)', timeout=30).group(2).decode() if actual_exc != expected_exc: raise RuntimeError('Incorrect exception received!') dut.expect('Origin: U-mode')