2022-03-30 05:07:25 -04:00
|
|
|
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
|
|
|
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
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
|
|
|
|
2022-03-30 05:07:25 -04:00
|
|
|
import pytest
|
|
|
|
from pytest_embedded import Dut
|
2019-11-26 22:58:07 -05:00
|
|
|
|
|
|
|
|
2022-07-12 22:30:16 -04:00
|
|
|
@pytest.mark.esp32
|
|
|
|
@pytest.mark.esp32s2
|
|
|
|
@pytest.mark.esp32c3
|
|
|
|
@pytest.mark.esp32s3
|
2022-11-22 04:01:25 -05:00
|
|
|
@pytest.mark.esp32c6
|
2022-07-08 05:47:59 -04:00
|
|
|
@pytest.mark.generic
|
2022-03-30 05:07:25 -04:00
|
|
|
def test_otatool_example(dut: Dut) -> None:
|
2018-11-15 16:02:34 -05:00
|
|
|
# Verify factory firmware
|
2021-01-25 21:49:01 -05:00
|
|
|
dut.expect('OTA Tool Example')
|
|
|
|
dut.expect('Example end')
|
2018-11-15 16:02:34 -05:00
|
|
|
|
|
|
|
# Close connection to DUT
|
2022-03-30 05:07:25 -04:00
|
|
|
dut.serial.proc.close()
|
2018-11-15 16:02:34 -05:00
|
|
|
|
2022-03-30 05:07:25 -04:00
|
|
|
script_path = os.path.join(str(os.getenv('IDF_PATH')), 'examples', 'system', 'ota', 'otatool', 'otatool_example.py')
|
2021-01-25 21:49:01 -05:00
|
|
|
binary_path = ''
|
2018-11-15 16:02:34 -05:00
|
|
|
|
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 'otatool.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])
|