Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug: workaround for sporadic failures of some tests due to unexpected data present in pexpect match #555

Merged
merged 1 commit into from
May 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading