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

35 lines
934 B
Python
Raw Normal View History

# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0
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 pytest
from pytest_embedded import Dut
2022-07-13 10:30:16 +08:00
@pytest.mark.esp32
@pytest.mark.esp32s2
@pytest.mark.esp32c3
@pytest.mark.esp32s3
@pytest.mark.esp32c6
2022-07-08 17:47:59 +08:00
@pytest.mark.generic
def test_otatool_example(dut: Dut) -> None:
2018-11-16 05:02:34 +08:00
# Verify factory firmware
dut.expect('OTA Tool Example')
dut.expect('Example end')
2018-11-16 05:02:34 +08:00
# Close connection to DUT
dut.serial.proc.close()
2018-11-16 05:02:34 +08:00
script_path = os.path.join(str(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])