Files
esp-idf/examples/system/ota/otatool/example_test.py
T

36 lines
909 B
Python
Raw Normal View History

2018-11-16 05:02:34 +08:00
from __future__ import print_function
2018-11-16 05:02:34 +08:00
import os
import subprocess
import sys
2018-11-16 05:02:34 +08:00
import ttfw_idf
@ttfw_idf.idf_example_test(env_tag='Example_WIFI')
2018-11-16 05:02:34 +08:00
def test_otatool_example(env, extra_data):
dut = env.get_dut('otatool', 'examples/system/ota/otatool', dut_class=ttfw_idf.ESP32DUT)
2018-11-16 05:02:34 +08:00
# Verify factory firmware
dut.start_app()
dut.expect('OTA Tool Example')
dut.expect('Example end')
2018-11-16 05:02:34 +08:00
# Close connection to DUT
dut.receive_thread.exit()
dut.port_inst.close()
script_path = os.path.join(os.getenv('IDF_PATH'), 'examples', 'system', 'ota', 'otatool', 'otatool_example.py')
binary_path = ''
2018-11-16 05:02:34 +08:00
for flash_file in dut.app.flash_files:
if 'otatool.bin' in flash_file[1]:
binary_path = flash_file[1]
2018-11-16 05:02:34 +08:00
break
subprocess.check_call([sys.executable, script_path, '--binary', binary_path])
2018-11-16 05:02:34 +08:00
if __name__ == '__main__':
test_otatool_example()