example_test.py 979 B

1234567891011121314151617181920212223242526272829303132333435
  1. from __future__ import print_function
  2. import os
  3. import sys
  4. import subprocess
  5. import ttfw_idf
  6. @ttfw_idf.idf_example_test(env_tag='Example_GENERIC')
  7. def test_examples_parttool(env, extra_data):
  8. dut = env.get_dut('parttool', 'examples/storage/parttool', dut_class=ttfw_idf.ESP32DUT)
  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()