From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH 1/4] test/lib/term: Allow for a wider variety of prompt characters in pane_wait() Date: Fri, 28 Jan 2022 19:34:01 +0100 Message-ID: <20220128183404.3407759-2-sbrivio@redhat.com> In-Reply-To: <20220128183404.3407759-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3960841972130926179==" --===============3960841972130926179== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit We might have highlighting and slightly different prompts across different distributions, allow a more reasonable set of prompt strings to be accepted as prompts. Signed-off-by: Stefano Brivio --- test/lib/term | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/test/lib/term b/test/lib/term index 78e2bd3..cc6349f 100755 --- a/test/lib/term +++ b/test/lib/term @@ -193,13 +193,16 @@ pane_run() { # pane_wait() - Wait for command to be done in given pane name # $1: Pane name pane_wait() { - __pane_lc="$(echo "${1}" | tr [A-Z] [a-z])" - - while [ "$(tail -n1 ${LOGDIR}/pane_${__pane_lc}.log)" != '$ ' ] && \ - [ "$(tail -n1 ${LOGDIR}/pane_${__pane_lc}.log)" != '# ' ] && \ - [ "$(tail -n1 ${LOGDIR}/pane_${__pane_lc}.log)" != '# # ' ]; do - sleep 0.1 || sleep 1 - done + __lc="$(echo "${1}" | tr [A-Z] [a-z])" + + __done=0 + while + __l="$(tail -1 ${LOGDIR}/pane_${__lc}.log | tr -d [:cntrl:])" + case ${__l} in + '$ ' | '# ' | '# # ' | *"$ " | *"# ") return ;; + *" #[m " | *" #[m [K" | *"]# ["*) return ;; + esac + do sleep 0.1 || sleep 1; done } # pane_parse() - Print last line, @EMPTY@ if command had no output -- 2.33.0 --===============3960841972130926179==--