example_test.py 980 B

123456789101112131415161718192021222324252627282930313233343536
  1. from __future__ import print_function
  2. import os
  3. import subprocess
  4. import sys
  5. import ttfw_idf
  6. @ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3'])
  7. def test_examples_parttool(env, extra_data):
  8. dut = env.get_dut('parttool', 'examples/storage/parttool')
  9. dut.start_app(False)
  10. # Verify factory firmware
  11. dut.expect('Partitions Tool Example')
  12. dut.expect('Example end')
  13. # Close connection to DUT
  14. dut.receive_thread.exit()
  15. dut.port_inst.close()
  16. # Run the example python script
  17. script_path = os.path.join(os.getenv('IDF_PATH'), 'examples', 'storage', 'parttool', 'parttool_example.py')
  18. binary_path = ''
  19. for flash_file in dut.app.flash_files:
  20. if 'parttool.bin' in flash_file[1]:
  21. binary_path = flash_file[1]
  22. break
  23. subprocess.check_call([sys.executable, script_path, '--binary', binary_path, '--port', dut.port])
  24. if __name__ == '__main__':
  25. test_examples_parttool()