example_test.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. from __future__ import print_function
  2. import os
  3. import sys
  4. import subprocess
  5. test_fw_path = os.getenv('TEST_FW_PATH')
  6. if test_fw_path and test_fw_path not in sys.path:
  7. sys.path.insert(0, test_fw_path)
  8. import TinyFW
  9. import IDF
  10. @IDF.idf_example_test(env_tag='Example_WIFI')
  11. def test_examples_parttool(env, extra_data):
  12. dut = env.get_dut('parttool', 'examples/storage/parttool')
  13. dut.start_app(False)
  14. # Verify factory firmware
  15. dut.expect("Partitions Tool Example")
  16. dut.expect("Example end")
  17. # Close connection to DUT
  18. dut.receive_thread.exit()
  19. dut.port_inst.close()
  20. # Run the example python script
  21. script_path = os.path.join(os.getenv("IDF_PATH"), "examples", "storage", "parttool", "parttool_example.py")
  22. binary_path = ""
  23. for config in dut.download_config:
  24. if "parttool.bin" in config:
  25. binary_path = config
  26. break
  27. subprocess.check_call([sys.executable, script_path, "--binary", binary_path])
  28. if __name__ == '__main__':
  29. test_examples_parttool()