app_test.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. ['IRAM0_RTCFAST', 'WRX'],
  17. ]
  18. @ttfw_idf.idf_custom_test(env_tag='Example_GENERIC', target=['esp32c3', 'esp32s2'], group='test-apps')
  19. def test_memprot(env, extra_data):
  20. dut = env.get_dut('memprot', 'tools/test_apps/system/memprot')
  21. dut.start_app()
  22. mem_test_cfg = []
  23. current_target = dut.app.get_sdkconfig()['CONFIG_IDF_TARGET'].replace('"','').lower()
  24. if current_target == 'esp32c3':
  25. mem_test_cfg = MEM_TEST_C3
  26. elif current_target == 'esp32s2':
  27. mem_test_cfg = MEM_TEST_S2
  28. Utility.console_log('Test cfg: ' + current_target)
  29. for i in mem_test_cfg:
  30. if 'R' in i[1]:
  31. dut.expect(i[0] + ' read low: OK')
  32. dut.expect(i[0] + ' read high: OK')
  33. if 'W' in i[1]:
  34. dut.expect(i[0] + ' write low: OK')
  35. dut.expect(i[0] + ' write high: OK')
  36. if 'X' in i[1]:
  37. dut.expect(i[0] + ' exec low: OK')
  38. dut.expect(i[0] + ' exec high: OK')
  39. Utility.console_log('Memprot test done')
  40. if __name__ == '__main__':
  41. test_memprot()