app_test.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/usr/bin/env python
  2. import ttfw_idf
  3. from tiny_test_fw import Utility
  4. MEM_TEST_S2 = [
  5. ['IRAM0_SRAM', 'WRX'],
  6. ['IRAM0_RTCFAST', 'WRX'],
  7. ['DRAM0_SRAM', 'WR'],
  8. ['DRAM0_RTCFAST', 'WR'],
  9. ['PERI1_RTCSLOW', 'WR'],
  10. ['PERI2_RTCSLOW_0', 'WRX'],
  11. ['PERI2_RTCSLOW_1', 'WRX']
  12. ]
  13. MEM_TEST_C3 = [
  14. ['IRAM0_SRAM', 'WRX'],
  15. ['DRAM0_SRAM', 'WR']
  16. ]
  17. @ttfw_idf.idf_custom_test(env_tag='Example_GENERIC', target=['esp32c3', 'esp32s2'], group='test-apps')
  18. def test_memprot(env, extra_data):
  19. dut = env.get_dut('memprot', 'tools/test_apps/system/memprot')
  20. dut.start_app()
  21. mem_test_cfg = []
  22. current_target = dut.app.get_sdkconfig()['CONFIG_IDF_TARGET'].replace('"','').lower()
  23. if current_target == 'esp32c3':
  24. mem_test_cfg = MEM_TEST_C3
  25. elif current_target == 'esp32s2':
  26. mem_test_cfg = MEM_TEST_S2
  27. Utility.console_log('Test cfg: ' + current_target)
  28. for i in mem_test_cfg:
  29. if 'R' in i[1]:
  30. dut.expect(i[0] + ' read low: OK')
  31. dut.expect(i[0] + ' read high: OK')
  32. if 'W' in i[1]:
  33. dut.expect(i[0] + ' write low: OK')
  34. dut.expect(i[0] + ' write high: OK')
  35. if 'X' in i[1]:
  36. dut.expect(i[0] + ' exec low: OK')
  37. dut.expect(i[0] + ' exec high: OK')
  38. Utility.console_log('Memprot test done')
  39. if __name__ == '__main__':
  40. test_memprot()