From 9193843d558cdcc9a9615e36d9bf1bddfc800da8 Mon Sep 17 00:00:00 2001 From: adamdebek Date: Wed, 6 Dec 2023 13:57:11 +0100 Subject: [PATCH] trunner: add capability to assert sending long commands due to ash line wrap up JIRA: CI-307 --- fs_mark/fs_mark_clean.c | 2 ++ trunner/harness/psh.py | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/fs_mark/fs_mark_clean.c b/fs_mark/fs_mark_clean.c index bfb49373d..9174e5694 100644 --- a/fs_mark/fs_mark_clean.c +++ b/fs_mark/fs_mark_clean.c @@ -66,6 +66,8 @@ int remove_dir_recursive(const char *dirPath) return -1; } } + + return ret; } int main(int argc, char **argv) diff --git a/trunner/harness/psh.py b/trunner/harness/psh.py index faab06a3d..a0f0cd401 100644 --- a/trunner/harness/psh.py +++ b/trunner/harness/psh.py @@ -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!",