mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
fix(ci): twai test disable board after test finish
This commit is contained in:
@@ -1,12 +1,27 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import time
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
def esp_enter_flash_mode(dut: Dut) -> None:
|
||||
ser = dut.serial.proc
|
||||
ser.setRTS(True) # EN Low
|
||||
time.sleep(0.5)
|
||||
ser.setDTR(True) # GPIO0 Low
|
||||
ser.setRTS(False) # EN High
|
||||
dut.expect('waiting for download', timeout=2)
|
||||
ser.setDTR(False) # Back RTS/DTR to 1/1 to avoid affect to esptool
|
||||
|
||||
|
||||
@pytest.mark.twai_adapter
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_twai_alert_recovery_example(dut: Dut) -> None:
|
||||
dut.expect_exact('TWAI Alert and Recovery: Driver installed')
|
||||
dut.expect_exact('TWAI Alert and Recovery: Driver uninstalled')
|
||||
try:
|
||||
dut.expect_exact('TWAI Alert and Recovery: Driver installed')
|
||||
dut.expect_exact('TWAI Alert and Recovery: Driver uninstalled')
|
||||
finally:
|
||||
esp_enter_flash_mode(dut)
|
||||
|
||||
@@ -1,12 +1,27 @@
|
||||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
import time
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
|
||||
def esp_enter_flash_mode(dut: Dut) -> None:
|
||||
ser = dut.serial.proc
|
||||
ser.setRTS(True) # EN Low
|
||||
time.sleep(0.5)
|
||||
ser.setDTR(True) # GPIO0 Low
|
||||
ser.setRTS(False) # EN High
|
||||
dut.expect('waiting for download', timeout=2)
|
||||
ser.setDTR(False) # Back RTS/DTR to 1/1 to avoid affect to esptool
|
||||
|
||||
|
||||
@pytest.mark.twai_adapter
|
||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
||||
def test_twai_self_test_example(dut: Dut) -> None:
|
||||
dut.expect_exact('TWAI Self Test: Driver installed')
|
||||
dut.expect_exact('TWAI Self Test: Driver uninstalled')
|
||||
try:
|
||||
dut.expect_exact('TWAI Self Test: Driver installed')
|
||||
dut.expect_exact('TWAI Self Test: Driver uninstalled')
|
||||
finally:
|
||||
esp_enter_flash_mode(dut)
|
||||
|
||||
Reference in New Issue
Block a user