example_test.py 909 B

1234567891011121314151617181920212223242526272829303132333435
  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_WIFI')
  7. def test_otatool_example(env, extra_data):
  8. dut = env.get_dut('otatool', 'examples/system/ota/otatool', dut_class=ttfw_idf.ESP32DUT)
  9. # Verify factory firmware
  10. dut.start_app()
  11. dut.expect('OTA Tool Example')
  12. dut.expect('Example end')
  13. # Close connection to DUT
  14. dut.receive_thread.exit()
  15. dut.port_inst.close()
  16. script_path = os.path.join(os.getenv('IDF_PATH'), 'examples', 'system', 'ota', 'otatool', 'otatool_example.py')
  17. binary_path = ''
  18. for flash_file in dut.app.flash_files:
  19. if 'otatool.bin' in flash_file[1]:
  20. binary_path = flash_file[1]
  21. break
  22. subprocess.check_call([sys.executable, script_path, '--binary', binary_path])
  23. if __name__ == '__main__':
  24. test_otatool_example()