Files
esp-idf/examples/storage/parttool/example_test.py
T

37 lines
980 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
2018-11-16 05:02:34 +08:00
2021-03-12 14:05:17 +08:00
@ttfw_idf.idf_example_test(env_tag='Example_GENERIC', target=['esp32', 'esp32c3'])
2018-11-16 05:02:34 +08:00
def test_examples_parttool(env, extra_data):
2021-03-12 14:05:17 +08:00
dut = env.get_dut('parttool', 'examples/storage/parttool')
2018-11-16 05:02:34 +08:00
dut.start_app(False)
# Verify factory firmware
dut.expect('Partitions 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()
# Run the example python script
script_path = os.path.join(os.getenv('IDF_PATH'), 'examples', 'storage', 'parttool', 'parttool_example.py')
2018-11-16 05:02:34 +08:00
binary_path = ''
for flash_file in dut.app.flash_files:
if 'parttool.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, '--port', dut.port])
2018-11-16 05:02:34 +08:00
if __name__ == '__main__':
test_examples_parttool()