twister: pytest: fix missing messages from hardware target
When pytest harness test is run on harware, messages sent from target right after application start-up are lost, because connection to COM port is not established yet. It can cause unexpected behavior of a test. Fix it by flashing and running application after connecting to COM port when testing on hardware. Signed-off-by: Michal Smola <michal.smola@nxp.com>
This commit is contained in:
parent
5c78b3d842
commit
1f25531d7c
|
@ -66,11 +66,19 @@ class DeviceAdapter(abc.ABC):
|
|||
|
||||
if not self.command:
|
||||
self.generate_command()
|
||||
self._flash_and_run()
|
||||
|
||||
if self.device_config.type != 'hardware':
|
||||
self._flash_and_run()
|
||||
|
||||
self._device_run.set()
|
||||
self._start_reader_thread()
|
||||
self.connect()
|
||||
|
||||
if self.device_config.type == 'hardware':
|
||||
# On hardware, flash after connecting to COM port, otherwise some messages
|
||||
# from target can be lost.
|
||||
self._flash_and_run()
|
||||
|
||||
def close(self) -> None:
|
||||
"""Disconnect, close device and close reader thread."""
|
||||
if not self._device_run.is_set():
|
||||
|
|
Loading…
Reference in a new issue