mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-03 20:54:32 +02:00
Merge branch 'bugfix/ttfw_dut_check_function_called_after_case_finished' into 'master'
ttfw: fix DUT check functions are called after case finished: Closes IDFCI-672 See merge request espressif/esp-idf!13990
This commit is contained in:
@@ -50,7 +50,13 @@ import time
|
|||||||
try:
|
try:
|
||||||
import Queue as _queue
|
import Queue as _queue
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import queue as _queue
|
import queue as _queue # type: ignore
|
||||||
|
|
||||||
|
try:
|
||||||
|
from typing import Callable, List
|
||||||
|
except ImportError:
|
||||||
|
# Only used for type annotations
|
||||||
|
pass
|
||||||
|
|
||||||
import serial
|
import serial
|
||||||
from serial.tools import list_ports
|
from serial.tools import list_ports
|
||||||
@@ -206,7 +212,7 @@ class _LogThread(threading.Thread, _queue.Queue):
|
|||||||
|
|
||||||
class RecvThread(threading.Thread):
|
class RecvThread(threading.Thread):
|
||||||
|
|
||||||
CHECK_FUNCTIONS = []
|
CHECK_FUNCTIONS = [] # type: List[Callable]
|
||||||
""" DUT subclass can define a few check functions to process received data. """
|
""" DUT subclass can define a few check functions to process received data. """
|
||||||
|
|
||||||
def __init__(self, read, dut):
|
def __init__(self, read, dut):
|
||||||
@@ -251,16 +257,18 @@ class RecvThread(threading.Thread):
|
|||||||
while not self.exit_event.isSet():
|
while not self.exit_event.isSet():
|
||||||
raw_data = self.read(1000)
|
raw_data = self.read(1000)
|
||||||
if raw_data:
|
if raw_data:
|
||||||
|
# we need to do line completion before call check functions
|
||||||
|
# need to call check functions first
|
||||||
|
# otherwise check functions could be called after cases finished
|
||||||
|
comp_data = self._line_completion(raw_data)
|
||||||
|
for check_function in self.CHECK_FUNCTIONS:
|
||||||
|
check_function(self, comp_data)
|
||||||
|
|
||||||
with self.record_data_lock:
|
with self.record_data_lock:
|
||||||
self.data_cache.put(raw_data)
|
self.data_cache.put(raw_data)
|
||||||
for capture_id in self.recorded_data:
|
for capture_id in self.recorded_data:
|
||||||
self.recorded_data[capture_id].put(raw_data)
|
self.recorded_data[capture_id].put(raw_data)
|
||||||
|
|
||||||
# we need to do line completion before call check functions
|
|
||||||
comp_data = self._line_completion(raw_data)
|
|
||||||
for check_function in self.CHECK_FUNCTIONS:
|
|
||||||
check_function(self, comp_data)
|
|
||||||
|
|
||||||
def exit(self):
|
def exit(self):
|
||||||
self.exit_event.set()
|
self.exit_event.set()
|
||||||
self.join()
|
self.join()
|
||||||
|
Reference in New Issue
Block a user