Skip to content

Commit

Permalink
Merge pull request #555 from aap-sc/aap-sc/sporadic_faulure_fix
Browse files Browse the repository at this point in the history
debug: workaround for sporadic failures of some tests due to unexpected data present in pexpect match
  • Loading branch information
en-sc authored May 16, 2024
2 parents d3b582e + db7e451 commit 408e461
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion debug/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,15 @@ def __init__(self, server_cmd=None, config=None, debug=False, timeout=60,
self.tclrpc_port = None
self.start(cmd, logfile, extra_env)

self.openocd_cli = pexpect.spawn(f"nc localhost {self.tclrpc_port}")
self.openocd_cli = pexpect.spawn(f"nc localhost {self.tclrpc_port}",
echo=False)
# TCL-RPC uses \x1a as a watermark for end of message. We set raw
# pty mode to disable translation of \x1a to EOF
tty.setraw(self.openocd_cli.child_fd)
hello_string = self.command(
"capture { echo \"Hello TCL-RPC!\" }").decode()
if not "Hello TCL-RPC!" in hello_string:
raise RuntimeError(f"TCL-RPC - unexpected reply:\n{hello_string}")

def start(self, cmd, logfile, extra_env):
combined_env = {**os.environ, **extra_env}
Expand Down

0 comments on commit 408e461

Please sign in to comment.