Skip to content

Commit

Permalink
console_timeout: wait for newline on expect call
Browse files Browse the repository at this point in the history
  • Loading branch information
lschuermann committed Nov 11, 2024
1 parent 8d54b1d commit 40e36ce
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions hwci/tests/console_timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ def oneshot_test(self, board):

# Wait for the expected output from the application
logging.info("Waiting for the application to output the result...")
output = serial.expect(
r"Userspace call to read console returned: (.*)", timeout=10
)
pattern = r"Userspace call to read console returned: (.*)"
output = serial.expect(pattern, timeout=10)

if output:
received_line = serial.child.after.decode("utf-8", errors="replace").strip()
logging.info(f"Received output: {received_line}")
match = re.search(
r"Userspace call to read console returned: (.*)", received_line
)
match = re.search(pattern, received_line)
if match:
received_text = match.group(1)
# Check if received text starts with the first word of our input
Expand Down

0 comments on commit 40e36ce

Please sign in to comment.