twister: fix the mis-placed drain logic.
The logic to drain the leftover logs of previous test should be put before the monitor_serial(). It was misplaced when re-adding this logic back. Signed-off-by: Ming Shao <ming.shao@intel.com>
This commit is contained in:
parent
42bb67ca85
commit
75914111d9
1 changed files with 13 additions and 13 deletions
|
@ -333,19 +333,6 @@ class DeviceHandler(Handler):
|
|||
|
||||
ser.flush()
|
||||
|
||||
# turns out the ser.flush() is not enough to clear serial leftover from last case
|
||||
# explicitly readline() can do it reliably
|
||||
old_timeout = ser.timeout
|
||||
# wait for 1s if no serial output
|
||||
ser.timeout = 1
|
||||
# or read 1000 lines at most
|
||||
# if the leftovers are more than 1000 lines, user should realize that once
|
||||
# saw the caught ones and fix it.
|
||||
leftover_lines = ser.readlines(1000)
|
||||
for line in leftover_lines:
|
||||
logger.debug(f"leftover log of previous test: {line}")
|
||||
ser.timeout = old_timeout
|
||||
|
||||
while ser.isOpen():
|
||||
if halt_event.is_set():
|
||||
logger.debug('halted')
|
||||
|
@ -538,6 +525,19 @@ class DeviceHandler(Handler):
|
|||
|
||||
ser.flush()
|
||||
|
||||
# turns out the ser.flush() is not enough to clear serial leftover from last case
|
||||
# explicitly readline() can do it reliably
|
||||
old_timeout = ser.timeout
|
||||
# wait for 1s if no serial output
|
||||
ser.timeout = 1
|
||||
# or read 1000 lines at most
|
||||
# if the leftovers are more than 1000 lines, user should realize that once
|
||||
# saw the caught ones and fix it.
|
||||
leftover_lines = ser.readlines(1000)
|
||||
for line in leftover_lines:
|
||||
logger.debug(f"leftover log of previous test: {line}")
|
||||
ser.timeout = old_timeout
|
||||
|
||||
harness_name = self.instance.testsuite.harness.capitalize()
|
||||
harness_import = HarnessImporter(harness_name)
|
||||
harness = harness_import.instance
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue