1from __future__ import print_function 2 3import os 4import subprocess 5import sys 6 7import ttfw_idf 8 9 10@ttfw_idf.idf_example_test(env_tag='Example_WIFI') 11def test_otatool_example(env, extra_data): 12 dut = env.get_dut('otatool', 'examples/system/ota/otatool', dut_class=ttfw_idf.ESP32DUT) 13 14 # Verify factory firmware 15 dut.start_app() 16 dut.expect('OTA Tool Example') 17 dut.expect('Example end') 18 19 # Close connection to DUT 20 dut.receive_thread.exit() 21 dut.port_inst.close() 22 23 script_path = os.path.join(os.getenv('IDF_PATH'), 'examples', 'system', 'ota', 'otatool', 'otatool_example.py') 24 binary_path = '' 25 26 for flash_file in dut.app.flash_files: 27 if 'otatool.bin' in flash_file[1]: 28 binary_path = flash_file[1] 29 break 30 31 subprocess.check_call([sys.executable, script_path, '--binary', binary_path]) 32 33 34if __name__ == '__main__': 35 test_otatool_example() 36