Skip to content

Commit

Permalink
trunner: add capability to assert sending long commands in ash
Browse files Browse the repository at this point in the history
JIRA: CI-307
  • Loading branch information
adamdebek committed Dec 21, 2023
1 parent 4ee3367 commit 56501b5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion trunner/harness/psh.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,15 @@ def __call__(self, result: TestResult) -> TestResult:
if self.cmd is not None:
self.dut.send(self.cmd + "\n")
try:
self.dut.expect(f"{self.cmd}(\r+)\n")
# ash wraps up lines longer than 80 characters
if len(self.cmd) <= 80 - len(self.prompt):
self.dut.expect(f"{self.cmd}(\r+)\n")
else:
full_cmd = ""
while full_cmd not in self.cmd:
self.dut.expect("(\r+)\n")
full_cmd += self.dut.before

except (pexpect.TIMEOUT, pexpect.EOF) as e:
raise ShellError(
msg="Couldn't find the echoed command!",
Expand Down

0 comments on commit 56501b5

Please sign in to comment.