mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'ci/enable_memprot_tests_for_esp32c5' into 'master'
Some checks are pending
docker / docker (push) Waiting to run
Some checks are pending
docker / docker (push) Waiting to run
Enable memory protection tests for ESP32-C5 Closes IDF-10099 See merge request espressif/esp-idf!32766
This commit is contained in:
commit
cdee290a5d
@ -622,11 +622,12 @@ def test_panic_delay(dut: PanicTestDut) -> None:
|
|||||||
#########################
|
#########################
|
||||||
|
|
||||||
# Memprot-related tests are supported only on targets with PMS/PMA peripheral;
|
# Memprot-related tests are supported only on targets with PMS/PMA peripheral;
|
||||||
# currently ESP32-S2, ESP32-C3, ESP32-C2, ESP32-H2 and ESP32-C6 are supported
|
# currently ESP32-S2, ESP32-C3, ESP32-C2, ESP32-H2, ESP32-C6, ESP32-P4 and ESP32-C5 are supported
|
||||||
CONFIGS_MEMPROT_IDRAM = [
|
CONFIGS_MEMPROT_IDRAM = [
|
||||||
pytest.param('memprot_esp32s2', marks=[pytest.mark.esp32s2]),
|
pytest.param('memprot_esp32s2', marks=[pytest.mark.esp32s2]),
|
||||||
pytest.param('memprot_esp32c3', marks=[pytest.mark.esp32c3]),
|
pytest.param('memprot_esp32c3', marks=[pytest.mark.esp32c3]),
|
||||||
pytest.param('memprot_esp32c2', marks=[pytest.mark.esp32c2]),
|
pytest.param('memprot_esp32c2', marks=[pytest.mark.esp32c2]),
|
||||||
|
pytest.param('memprot_esp32c5', marks=[pytest.mark.esp32c5]),
|
||||||
pytest.param('memprot_esp32c6', marks=[pytest.mark.esp32c6]),
|
pytest.param('memprot_esp32c6', marks=[pytest.mark.esp32c6]),
|
||||||
pytest.param('memprot_esp32h2', marks=[pytest.mark.esp32h2]),
|
pytest.param('memprot_esp32h2', marks=[pytest.mark.esp32h2]),
|
||||||
pytest.param('memprot_esp32p4', marks=[pytest.mark.esp32p4])
|
pytest.param('memprot_esp32p4', marks=[pytest.mark.esp32p4])
|
||||||
@ -639,6 +640,7 @@ CONFIGS_MEMPROT_DCACHE = [
|
|||||||
CONFIGS_MEMPROT_RTC_FAST_MEM = [
|
CONFIGS_MEMPROT_RTC_FAST_MEM = [
|
||||||
pytest.param('memprot_esp32s2', marks=[pytest.mark.esp32s2]),
|
pytest.param('memprot_esp32s2', marks=[pytest.mark.esp32s2]),
|
||||||
pytest.param('memprot_esp32c3', marks=[pytest.mark.esp32c3]),
|
pytest.param('memprot_esp32c3', marks=[pytest.mark.esp32c3]),
|
||||||
|
pytest.param('memprot_esp32c5', marks=[pytest.mark.esp32c5]),
|
||||||
pytest.param('memprot_esp32c6', marks=[pytest.mark.esp32c6]),
|
pytest.param('memprot_esp32c6', marks=[pytest.mark.esp32c6]),
|
||||||
pytest.param('memprot_esp32h2', marks=[pytest.mark.esp32h2]),
|
pytest.param('memprot_esp32h2', marks=[pytest.mark.esp32h2]),
|
||||||
pytest.param('memprot_esp32p4', marks=[pytest.mark.esp32p4])
|
pytest.param('memprot_esp32p4', marks=[pytest.mark.esp32p4])
|
||||||
@ -649,12 +651,14 @@ CONFIGS_MEMPROT_RTC_SLOW_MEM = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
CONFIGS_MEMPROT_FLASH_IDROM = [
|
CONFIGS_MEMPROT_FLASH_IDROM = [
|
||||||
|
pytest.param('memprot_esp32c5', marks=[pytest.mark.esp32c5]),
|
||||||
pytest.param('memprot_esp32c6', marks=[pytest.mark.esp32c6]),
|
pytest.param('memprot_esp32c6', marks=[pytest.mark.esp32c6]),
|
||||||
pytest.param('memprot_esp32h2', marks=[pytest.mark.esp32h2]),
|
pytest.param('memprot_esp32h2', marks=[pytest.mark.esp32h2]),
|
||||||
pytest.param('memprot_esp32p4', marks=[pytest.mark.esp32p4])
|
pytest.param('memprot_esp32p4', marks=[pytest.mark.esp32p4])
|
||||||
]
|
]
|
||||||
|
|
||||||
CONFIGS_MEMPROT_INVALID_REGION_PROTECTION_USING_PMA = [
|
CONFIGS_MEMPROT_INVALID_REGION_PROTECTION_USING_PMA = [
|
||||||
|
pytest.param('memprot_esp32c5', marks=[pytest.mark.esp32c5]),
|
||||||
pytest.param('memprot_esp32c6', marks=[pytest.mark.esp32c6]),
|
pytest.param('memprot_esp32c6', marks=[pytest.mark.esp32c6]),
|
||||||
pytest.param('memprot_esp32h2', marks=[pytest.mark.esp32h2]),
|
pytest.param('memprot_esp32h2', marks=[pytest.mark.esp32h2]),
|
||||||
pytest.param('memprot_esp32p4', marks=[pytest.mark.esp32p4])
|
pytest.param('memprot_esp32p4', marks=[pytest.mark.esp32p4])
|
||||||
@ -694,7 +698,7 @@ def test_iram_reg1_write_violation(dut: PanicTestDut, test_func_name: str) -> No
|
|||||||
dut.expect_backtrace()
|
dut.expect_backtrace()
|
||||||
elif dut.target == 'esp32c3':
|
elif dut.target == 'esp32c3':
|
||||||
dut.expect_exact(r'Test error: Test function has returned')
|
dut.expect_exact(r'Test error: Test function has returned')
|
||||||
elif dut.target in ['esp32c2', 'esp32c6', 'esp32h2', 'esp32p4']:
|
elif dut.target in ['esp32c2', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4']:
|
||||||
dut.expect_gme('Store access fault')
|
dut.expect_gme('Store access fault')
|
||||||
dut.expect_reg_dump(0)
|
dut.expect_reg_dump(0)
|
||||||
dut.expect_stack_dump()
|
dut.expect_stack_dump()
|
||||||
@ -719,7 +723,7 @@ def test_iram_reg2_write_violation(dut: PanicTestDut, test_func_name: str) -> No
|
|||||||
dut.expect(r' operation type: (\S+)')
|
dut.expect(r' operation type: (\S+)')
|
||||||
dut.expect_reg_dump(0)
|
dut.expect_reg_dump(0)
|
||||||
dut.expect_stack_dump()
|
dut.expect_stack_dump()
|
||||||
elif dut.target in ['esp32c2', 'esp32c6', 'esp32h2', 'esp32p4']:
|
elif dut.target in ['esp32c2', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4']:
|
||||||
dut.expect_gme('Store access fault')
|
dut.expect_gme('Store access fault')
|
||||||
dut.expect_reg_dump(0)
|
dut.expect_reg_dump(0)
|
||||||
dut.expect_stack_dump()
|
dut.expect_stack_dump()
|
||||||
@ -744,7 +748,7 @@ def test_iram_reg3_write_violation(dut: PanicTestDut, test_func_name: str) -> No
|
|||||||
dut.expect(r' operation type: (\S+)')
|
dut.expect(r' operation type: (\S+)')
|
||||||
dut.expect_reg_dump(0)
|
dut.expect_reg_dump(0)
|
||||||
dut.expect_stack_dump()
|
dut.expect_stack_dump()
|
||||||
elif dut.target in ['esp32c2', 'esp32c6', 'esp32h2', 'esp32p4']:
|
elif dut.target in ['esp32c2', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4']:
|
||||||
dut.expect_gme('Store access fault')
|
dut.expect_gme('Store access fault')
|
||||||
dut.expect_reg_dump(0)
|
dut.expect_reg_dump(0)
|
||||||
dut.expect_stack_dump()
|
dut.expect_stack_dump()
|
||||||
@ -791,7 +795,7 @@ def test_dram_reg1_execute_violation(dut: PanicTestDut, test_func_name: str) ->
|
|||||||
dut.expect(r'Unknown operation at address [0-9xa-f]+ not permitted \((\S+)\)')
|
dut.expect(r'Unknown operation at address [0-9xa-f]+ not permitted \((\S+)\)')
|
||||||
dut.expect_reg_dump(0)
|
dut.expect_reg_dump(0)
|
||||||
dut.expect_corrupted_backtrace()
|
dut.expect_corrupted_backtrace()
|
||||||
elif dut.target in ['esp32c3', 'esp32c2', 'esp32c6', 'esp32h2', 'esp32p4']:
|
elif dut.target in ['esp32c3', 'esp32c2', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4']:
|
||||||
dut.expect_gme('Instruction access fault')
|
dut.expect_gme('Instruction access fault')
|
||||||
dut.expect_reg_dump(0)
|
dut.expect_reg_dump(0)
|
||||||
dut.expect_stack_dump()
|
dut.expect_stack_dump()
|
||||||
@ -810,7 +814,7 @@ def test_dram_reg2_execute_violation(dut: PanicTestDut, test_func_name: str) ->
|
|||||||
dut.expect_gme('InstructionFetchError')
|
dut.expect_gme('InstructionFetchError')
|
||||||
dut.expect_reg_dump(0)
|
dut.expect_reg_dump(0)
|
||||||
dut.expect_corrupted_backtrace()
|
dut.expect_corrupted_backtrace()
|
||||||
elif dut.target in ['esp32c3', 'esp32c2', 'esp32c6', 'esp32h2', 'esp32p4']:
|
elif dut.target in ['esp32c3', 'esp32c2', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4']:
|
||||||
dut.expect_gme('Instruction access fault')
|
dut.expect_gme('Instruction access fault')
|
||||||
dut.expect_reg_dump(0)
|
dut.expect_reg_dump(0)
|
||||||
dut.expect_stack_dump()
|
dut.expect_stack_dump()
|
||||||
@ -828,7 +832,7 @@ def test_rtc_fast_reg1_execute_violation(dut: PanicTestDut, test_func_name: str)
|
|||||||
|
|
||||||
@pytest.mark.parametrize('config', CONFIGS_MEMPROT_RTC_FAST_MEM, indirect=True)
|
@pytest.mark.parametrize('config', CONFIGS_MEMPROT_RTC_FAST_MEM, indirect=True)
|
||||||
@pytest.mark.generic
|
@pytest.mark.generic
|
||||||
@pytest.mark.skipif('config.getvalue("target") in ["esp32c6", "esp32h2", "esp32p4"]', reason='Not a violation condition, no PMS peripheral case')
|
@pytest.mark.skipif('config.getvalue("target") in ["esp32c5", "esp32c6", "esp32h2", "esp32p4"]', reason='Not a violation condition, no PMS peripheral case')
|
||||||
def test_rtc_fast_reg2_execute_violation(dut: PanicTestDut, test_func_name: str) -> None:
|
def test_rtc_fast_reg2_execute_violation(dut: PanicTestDut, test_func_name: str) -> None:
|
||||||
dut.run_test_func(test_func_name)
|
dut.run_test_func(test_func_name)
|
||||||
dut.expect_gme('Memory protection fault')
|
dut.expect_gme('Memory protection fault')
|
||||||
@ -866,7 +870,7 @@ def test_rtc_fast_reg3_execute_violation(dut: PanicTestDut, test_func_name: str)
|
|||||||
dut.expect(r' operation type: (\S+)')
|
dut.expect(r' operation type: (\S+)')
|
||||||
dut.expect_reg_dump(0)
|
dut.expect_reg_dump(0)
|
||||||
dut.expect_stack_dump()
|
dut.expect_stack_dump()
|
||||||
elif dut.target in ['esp32c6', 'esp32h2', 'esp32p4']:
|
elif dut.target in ['esp32c5', 'esp32c6', 'esp32h2', 'esp32p4']:
|
||||||
dut.expect_gme('Instruction access fault')
|
dut.expect_gme('Instruction access fault')
|
||||||
dut.expect_reg_dump(0)
|
dut.expect_reg_dump(0)
|
||||||
dut.expect_stack_dump()
|
dut.expect_stack_dump()
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
# Restricting to ESP32C5
|
||||||
|
CONFIG_IDF_TARGET="esp32c5"
|
||||||
|
|
||||||
|
# Enabling memory protection
|
||||||
|
CONFIG_ESP_SYSTEM_PMP_IDRAM_SPLIT=y
|
||||||
|
|
||||||
|
# Enable memprot test
|
||||||
|
CONFIG_TEST_MEMPROT=y
|
Loading…
Reference in New Issue
Block a user