2018-11-15 16:02:34 -05:00
|
|
|
from __future__ import print_function
|
2021-01-25 21:49:01 -05:00
|
|
|
|
2018-11-15 16:02:34 -05:00
|
|
|
import os
|
|
|
|
import subprocess
|
2021-01-25 21:49:01 -05:00
|
|
|
import sys
|
2018-11-15 16:02:34 -05:00
|
|
|
|
2019-11-26 22:58:07 -05:00
|
|
|
import ttfw_idf
|
2018-11-15 16:02:34 -05:00
|
|
|
|
|
|
|
|
2020-06-11 02:22:05 -04:00
|
|
|
@ttfw_idf.idf_example_test(env_tag='Example_GENERIC')
|
2018-11-15 16:02:34 -05:00
|
|
|
def test_examples_parttool(env, extra_data):
|
2019-11-26 22:58:07 -05:00
|
|
|
dut = env.get_dut('parttool', 'examples/storage/parttool', dut_class=ttfw_idf.ESP32DUT)
|
2018-11-15 16:02:34 -05:00
|
|
|
dut.start_app(False)
|
|
|
|
|
|
|
|
# Verify factory firmware
|
2021-01-25 21:49:01 -05:00
|
|
|
dut.expect('Partitions Tool Example')
|
|
|
|
dut.expect('Example end')
|
2018-11-15 16:02:34 -05:00
|
|
|
|
|
|
|
# Close connection to DUT
|
|
|
|
dut.receive_thread.exit()
|
|
|
|
dut.port_inst.close()
|
|
|
|
|
|
|
|
# Run the example python script
|
2021-01-25 21:49:01 -05:00
|
|
|
script_path = os.path.join(os.getenv('IDF_PATH'), 'examples', 'storage', 'parttool', 'parttool_example.py')
|
2018-11-15 16:02:34 -05:00
|
|
|
|
2021-01-25 21:49:01 -05:00
|
|
|
binary_path = ''
|
2019-01-02 20:57:47 -05:00
|
|
|
for flash_file in dut.app.flash_files:
|
2021-01-25 21:49:01 -05:00
|
|
|
if 'parttool.bin' in flash_file[1]:
|
2019-01-02 20:57:47 -05:00
|
|
|
binary_path = flash_file[1]
|
2018-11-15 16:02:34 -05:00
|
|
|
break
|
|
|
|
|
2021-01-25 21:49:01 -05:00
|
|
|
subprocess.check_call([sys.executable, script_path, '--binary', binary_path, '--port', dut.port])
|
2018-11-15 16:02:34 -05:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
test_examples_parttool()
|