Skip to content

Commit

Permalink
trunner: provide traceback for internal exceptions when waiting for plo
Browse files Browse the repository at this point in the history
JIRA: CI-362
  • Loading branch information
damianloew committed Oct 26, 2023
1 parent a37c915 commit 1c7e694
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions trunner/tools/phoenix.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import threading
import time
import pexpect
import traceback

from trunner.harness import ProcessError
from serial.tools import list_ports
Expand All @@ -24,7 +25,7 @@ def wait_for_vid_pid(vid: int, pid: int, timeout=0):
found_ports = [port for port in list_ports.comports() if port.pid == pid and port.vid == vid]

if len(found_ports) > 1:
raise Exception(
raise AssertionError(
"More than one plo port was found! Maybe more than one device is connected? Hint used to find port:"
f"{vid:04x}:{pid:04x}"
)
Expand Down Expand Up @@ -119,8 +120,10 @@ def _run(self):
# such wait avoids a following issue with loading an app:
# https://github.com/phoenix-rtos/phoenix-rtos-project/issues/545
time.sleep(0.5)
except (TimeoutError, Exception) as exc:
raise PhoenixdError(str(exc)) from exc
except (TimeoutError, AssertionError) as exc:
raise PhoenixdError(msg=str(exc)) from exc
except Exception as exc:
raise PhoenixdError(msg=str(exc), output=traceback.format_exc()) from exc

# Use pexpect.spawn to run a process as PTY, so it will flush on a new line
self.proc = pexpect.spawn(
Expand Down

0 comments on commit 1c7e694

Please sign in to comment.