mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
tiny-test-fw: fix running tests which use IDFDUT class
This commit is contained in:
parent
1f22910468
commit
6306ea5a92
@ -122,9 +122,10 @@ def _uses_esptool(func):
|
|||||||
settings = self.port_inst.get_settings()
|
settings = self.port_inst.get_settings()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
rom = self._get_rom()(self.port_inst)
|
if not self._rom_inst:
|
||||||
rom.connect('hard_reset')
|
self._rom_inst = esptool.ESPLoader.detect_chip(self.port_inst)
|
||||||
esp = rom.run_stub()
|
self._rom_inst.connect('hard_reset')
|
||||||
|
esp = self._rom_inst.run_stub()
|
||||||
|
|
||||||
ret = func(self, esp, *args, **kwargs)
|
ret = func(self, esp, *args, **kwargs)
|
||||||
# do hard reset after use esptool
|
# do hard reset after use esptool
|
||||||
@ -158,6 +159,7 @@ class IDFDUT(DUT.SerialDUT):
|
|||||||
self.allow_dut_exception = allow_dut_exception
|
self.allow_dut_exception = allow_dut_exception
|
||||||
self.exceptions = _queue.Queue()
|
self.exceptions = _queue.Queue()
|
||||||
self.performance_items = _queue.Queue()
|
self.performance_items = _queue.Queue()
|
||||||
|
self._rom_inst = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_rom(cls):
|
def _get_rom(cls):
|
||||||
@ -186,11 +188,16 @@ class IDFDUT(DUT.SerialDUT):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def confirm_dut(cls, port, app, **kwargs):
|
def confirm_dut(cls, port, app, **kwargs):
|
||||||
inst = None
|
inst = None
|
||||||
|
try:
|
||||||
|
expected_rom_class = cls._get_rom()
|
||||||
|
except NotImplementedError:
|
||||||
|
expected_rom_class = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# TODO: check whether 8266 works with this logic
|
# TODO: check whether 8266 works with this logic
|
||||||
# Otherwise overwrite it in ESP8266DUT
|
# Otherwise overwrite it in ESP8266DUT
|
||||||
inst = esptool.ESPLoader.detect_chip(port)
|
inst = esptool.ESPLoader.detect_chip(port)
|
||||||
if type(inst) != cls._get_rom():
|
if expected_rom_class and type(inst) != expected_rom_class:
|
||||||
raise RuntimeError("Target not expected")
|
raise RuntimeError("Target not expected")
|
||||||
return inst.read_mac() is not None
|
return inst.read_mac() is not None
|
||||||
except(esptool.FatalError, RuntimeError):
|
except(esptool.FatalError, RuntimeError):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user