From dd84cd7f10ffeec9c747753df8e89e085da06dd6 Mon Sep 17 00:00:00 2001 From: "harshal.patil" Date: Mon, 29 Jun 2026 12:26:04 +0530 Subject: [PATCH] fix(panic): handle absent IROM/DROM alignment gap in spiram-xip memprot tests The spiram-xip IROM/DROM alignment tests assumed the XIP region always leaves an alignment gap before the next MMU page: they executed into the gap and expected an instruction access fault followed by a register dump. When the section ends exactly on an MMU page boundary there is no gap - the device prints " alignment gap not added into heap" and returns, the framework restarts cleanly (esp_restart_noos, no panic), and the test timed out waiting for a register dump. --- .../system/panic/panic_base/pytest_panic.py | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/tools/test_apps/system/panic/panic_base/pytest_panic.py b/tools/test_apps/system/panic/panic_base/pytest_panic.py index 55510798e34..13ffe68c0ae 100644 --- a/tools/test_apps/system/panic/panic_base/pytest_panic.py +++ b/tools/test_apps/system/panic/panic_base/pytest_panic.py @@ -1117,16 +1117,13 @@ def test_non_cache_drom_reg_execute_violation(dut: PanicTestDut, test_func_name: def spiram_xip_irom_alignment_reg_execute_violation(dut: PanicTestDut, test_func_name: str) -> None: dut.run_test_func(test_func_name) - try: - dut.expect_gme('Instruction access fault') - except Exception: - dut.expect_exact('SPIRAM (IROM): IROM alignment gap not added into heap') - dut.expect_reg_dump(0) + match = dut.expect(r'(IROM alignment gap not added into heap|Instruction access fault)') + if match.group(1) == b'Instruction access fault': + dut.expect_reg_dump(0) dut.expect_cpu_reset() @pytest.mark.generic -@pytest.mark.temp_skip_ci(targets=['esp32c5'], reason='TODO IDF-14835') @idf_parametrize('config, target', CONFIGS_MEMPROT_SPIRAM_XIP_IROM_ALIGNMENT_HEAP, indirect=['config', 'target']) def test_spiram_xip_irom_alignment_reg_execute_violation(dut: PanicTestDut, test_func_name: str) -> None: spiram_xip_irom_alignment_reg_execute_violation(dut, test_func_name) @@ -1143,19 +1140,14 @@ def test_non_cache_spiram_xip_irom_alignment_reg_execute_violation(dut: PanicTes def spiram_xip_drom_alignment_reg_execute_violation(dut: PanicTestDut, test_func_name: str) -> None: dut.run_test_func(test_func_name) - try: - if dut.target == 'esp32s3': - dut.expect_gme('InstructionFetchError') - else: - dut.expect_gme('Instruction access fault') - except Exception: - dut.expect_exact('SPIRAM (DROM): DROM alignment gap not added into heap') - dut.expect_reg_dump(0) + fault_reason = 'InstructionFetchError' if dut.target == 'esp32s3' else 'Instruction access fault' + match = dut.expect(rf'(DROM alignment gap not added into heap|{fault_reason})') + if match.group(1) != b'DROM alignment gap not added into heap': + dut.expect_reg_dump(0) dut.expect_cpu_reset() @pytest.mark.generic -@pytest.mark.temp_skip_ci(targets=['esp32c5'], reason='TODO IDF-14835') @idf_parametrize('config, target', CONFIGS_MEMPROT_SPIRAM_XIP_DROM_ALIGNMENT_HEAP, indirect=['config', 'target']) def test_spiram_xip_drom_alignment_reg_execute_violation(dut: PanicTestDut, test_func_name: str) -> None: spiram_xip_drom_alignment_reg_execute_violation(dut, test_func_name)