ci: migrate system test apps to pytest
This commit is contained in:
@@ -1,81 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import ttfw_idf
|
||||
from tiny_test_fw import Utility
|
||||
|
||||
MEM_TEST_S2 = [
|
||||
['IRAM0_SRAM', 'WRX'],
|
||||
['IRAM0_RTCFAST', 'WRX'],
|
||||
['DRAM0_SRAM', 'WR'],
|
||||
['DRAM0_RTCFAST', 'WR'],
|
||||
['PERI1_RTCSLOW', 'WR'],
|
||||
['PERI2_RTCSLOW_0', 'WRX'],
|
||||
['PERI2_RTCSLOW_1', 'WRX']
|
||||
]
|
||||
|
||||
MEM_TEST_C3 = [
|
||||
['IRAM0_SRAM', 'WRX'],
|
||||
['DRAM0_SRAM', 'WR'],
|
||||
['IRAM0_RTCFAST', 'WRX']
|
||||
]
|
||||
|
||||
MEM_TEST_S3_MULTI = [
|
||||
# instruction execute test temporarily disabled
|
||||
# ['IRAM0_SRAM (core 0)', 'WRX'],
|
||||
['IRAM0_SRAM (core 0)', 'WR'],
|
||||
['DRAM0_SRAM (core 0)', 'WR'],
|
||||
# instruction execute test temporarily disabled
|
||||
# ['IRAM0_SRAM (core 1)', 'WRX'],
|
||||
['IRAM0_SRAM (core 1)', 'WR'],
|
||||
['DRAM0_SRAM (core 1)', 'WR']
|
||||
# temporarily disabled unless IDF-5208 gets merged
|
||||
# ['IRAM0_RTCFAST', 'WR'],
|
||||
]
|
||||
|
||||
MEM_TEST_S3_UNI = [
|
||||
['IRAM0_SRAM (core 0)', 'WRX'],
|
||||
['DRAM0_SRAM (core 0)', 'WR']
|
||||
# temporarily disabled unless IDF-5208 gets merged
|
||||
# ['IRAM0_RTCFAST', 'WR'],
|
||||
]
|
||||
|
||||
|
||||
@ttfw_idf.idf_custom_test(env_tag='Example_GENERIC', target=['esp32c3', 'esp32s2', 'esp32s3'], group='test-apps')
|
||||
def test_memprot(env, extra_data):
|
||||
|
||||
dut = env.get_dut('memprot', 'tools/test_apps/system/memprot')
|
||||
dut.start_app()
|
||||
|
||||
mem_test_cfg = []
|
||||
current_target = dut.app.get_sdkconfig()['CONFIG_IDF_TARGET'].replace('"','').lower()
|
||||
|
||||
try:
|
||||
unicore = dut.app.get_sdkconfig()['CONFIG_FREERTOS_UNICORE']
|
||||
except KeyError:
|
||||
unicore = 'n'
|
||||
|
||||
if current_target == 'esp32c3':
|
||||
mem_test_cfg = MEM_TEST_C3
|
||||
elif current_target == 'esp32s2':
|
||||
mem_test_cfg = MEM_TEST_S2
|
||||
elif current_target == 'esp32s3':
|
||||
mem_test_cfg = MEM_TEST_S3_UNI if unicore == 'y' else MEM_TEST_S3_MULTI
|
||||
|
||||
Utility.console_log('Test cfg: ' + current_target)
|
||||
|
||||
for i in mem_test_cfg:
|
||||
if 'R' in i[1]:
|
||||
dut.expect(i[0] + ' read low: OK')
|
||||
dut.expect(i[0] + ' read high: OK')
|
||||
if 'W' in i[1]:
|
||||
dut.expect(i[0] + ' write low: OK')
|
||||
dut.expect(i[0] + ' write high: OK')
|
||||
if 'X' in i[1]:
|
||||
dut.expect(i[0] + ' exec low: OK')
|
||||
dut.expect(i[0] + ' exec high: OK')
|
||||
|
||||
Utility.console_log('Memprot test done')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_memprot()
|
||||
@@ -0,0 +1,71 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import logging
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
|
||||
MEM_TEST_UNICORE = {
|
||||
'esp32s2': [
|
||||
['IRAM0_SRAM', 'WRX'],
|
||||
['IRAM0_RTCFAST', 'WRX'],
|
||||
['DRAM0_SRAM', 'WR'],
|
||||
['DRAM0_RTCFAST', 'WR'],
|
||||
['PERI1_RTCSLOW', 'WR'],
|
||||
['PERI2_RTCSLOW_0', 'WRX'],
|
||||
['PERI2_RTCSLOW_1', 'WRX']
|
||||
],
|
||||
'esp32c3': [
|
||||
['IRAM0_SRAM', 'WRX'],
|
||||
['DRAM0_SRAM', 'WR'],
|
||||
['IRAM0_RTCFAST', 'WRX']
|
||||
],
|
||||
'esp32s3': [
|
||||
['IRAM0_SRAM (core 0)', 'WRX'],
|
||||
['DRAM0_SRAM (core 0)', 'WR']
|
||||
# temporarily disabled unless IDF-5208 gets merged
|
||||
# ['IRAM0_RTCFAST', 'WR'],
|
||||
],
|
||||
}
|
||||
|
||||
MEM_TEST_MULTICORE = {
|
||||
'esp32s3': [
|
||||
# instruction execute test temporarily disabled
|
||||
# ['IRAM0_SRAM (core 0)', 'WRX'],
|
||||
['IRAM0_SRAM (core 0)', 'WR'],
|
||||
['DRAM0_SRAM (core 0)', 'WR'],
|
||||
# instruction execute test temporarily disabled
|
||||
# ['IRAM0_SRAM (core 1)', 'WRX'],
|
||||
['IRAM0_SRAM (core 1)', 'WR'],
|
||||
['DRAM0_SRAM (core 1)', 'WR']
|
||||
# temporarily disabled unless IDF-5208 gets merged
|
||||
# ['IRAM0_RTCFAST', 'WR'],
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.generic
|
||||
def test_sys_memprot(dut: Dut) -> None:
|
||||
|
||||
current_target = dut.target
|
||||
|
||||
unicore = dut.app.sdkconfig.get('FREERTOS_UNICORE')
|
||||
|
||||
mem_test_cfg = MEM_TEST_UNICORE if unicore else MEM_TEST_MULTICORE
|
||||
|
||||
logging.info(f'Test cfg: {current_target}')
|
||||
|
||||
for i in mem_test_cfg[current_target]:
|
||||
if 'R' in i[1]:
|
||||
dut.expect_exact(i[0] + ' read low: OK')
|
||||
dut.expect_exact(i[0] + ' read high: OK')
|
||||
if 'W' in i[1]:
|
||||
dut.expect_exact(i[0] + ' write low: OK')
|
||||
dut.expect_exact(i[0] + ' write high: OK')
|
||||
if 'X' in i[1]:
|
||||
dut.expect_exact(i[0] + ' exec low: OK')
|
||||
dut.expect_exact(i[0] + ' exec high: OK')
|
||||
Reference in New Issue
Block a user