From: Stefano Brivio <sbrivio@redhat.com>
To: passt-dev@passt.top
Subject: [PATCH 09/12] tests: Simplify *tools commands using pane_status
Date: Tue, 17 May 2022 14:36:11 +0200 [thread overview]
Message-ID: <20220517123614.1892316-10-sbrivio@redhat.com> (raw)
In-Reply-To: <20220517123614.1892316-1-sbrivio@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2230 bytes --]
From: David Gibson <david(a)gibson.dropbear.id.au>
Now that we have pane_status to check the success of commands issued to
panes, we can more easily check for the success of the 'which' commands
used to check tool availability, rather than constructing, then parsing
special "skip" output.
Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
---
test/lib/test | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/test/lib/test b/test/lib/test
index 4262343..a5583e3 100755
--- a/test/lib/test
+++ b/test/lib/test
@@ -151,9 +151,8 @@ test_one_line() {
tmux send-keys -t ${PANE_HOST} "C-c"
;;
"htools")
- pane_run HOST 'which '"${__arg}"' >/dev/null || echo skip'
- pane_wait HOST
- [ "$(pane_parse HOST)" = "skip" ] && TEST_ONE_skip=1 || true
+ pane_run HOST 'which '"${__arg}"' >/dev/null'
+ pane_status HOST || TEST_ONE_skip=1
;;
"passt")
pane_run PASST "${__arg}"
@@ -192,19 +191,16 @@ test_one_line() {
pane_status GUEST_1 || TEST_ONE_nok=1
;;
"gtools")
- pane_run GUEST 'which '"${__arg}"' >/dev/null || echo skip'
- pane_wait GUEST
- [ "$(pane_parse GUEST)" = "skip" ] && TEST_ONE_skip=1 || true
+ pane_run GUEST 'which '"${__arg}"' >/dev/null'
+ pane_status GUEST || TEST_ONE_skip=1
;;
"g1tools")
- pane_run GUEST_1 'which '"${__arg}"' >/dev/null || echo skip'
- pane_wait GUEST_1
- [ "$(pane_parse GUEST_1)" = "skip" ] && TEST_ONE_skip=1 || true
+ pane_run GUEST_1 'which '"${__arg}"' >/dev/null'
+ pane_status GUEST_1 || TEST_ONE_skip=1
;;
"g2tools")
- pane_run GUEST_2 'which '"${__arg}"' >/dev/null || echo skip'
- pane_wait GUEST_2
- [ "$(pane_parse GUEST_2)" = "skip" ] && TEST_ONE_skip=1 || true
+ pane_run GUEST_2 'which '"${__arg}"' >/dev/null'
+ pane_status GUEST_2 || TEST_ONE_skip=1
;;
"guest2")
pane_run GUEST_2 "${__arg}"
@@ -247,9 +243,8 @@ test_one_line() {
pane_status NS2 || TEST_ONE_nok=1
;;
"nstools")
- pane_run NS 'which '"${__arg}"' >/dev/null || echo skip'
- pane_wait NS
- [ "$(pane_parse NS)" = "skip" ] && TEST_ONE_skip=1 || true
+ pane_run NS 'which '"${__arg}"' >/dev/null'
+ pane_status NS || TEST_ONE_skip=1
;;
"gout")
__varname="${__arg%% *}"
--
@@ -151,9 +151,8 @@ test_one_line() {
tmux send-keys -t ${PANE_HOST} "C-c"
;;
"htools")
- pane_run HOST 'which '"${__arg}"' >/dev/null || echo skip'
- pane_wait HOST
- [ "$(pane_parse HOST)" = "skip" ] && TEST_ONE_skip=1 || true
+ pane_run HOST 'which '"${__arg}"' >/dev/null'
+ pane_status HOST || TEST_ONE_skip=1
;;
"passt")
pane_run PASST "${__arg}"
@@ -192,19 +191,16 @@ test_one_line() {
pane_status GUEST_1 || TEST_ONE_nok=1
;;
"gtools")
- pane_run GUEST 'which '"${__arg}"' >/dev/null || echo skip'
- pane_wait GUEST
- [ "$(pane_parse GUEST)" = "skip" ] && TEST_ONE_skip=1 || true
+ pane_run GUEST 'which '"${__arg}"' >/dev/null'
+ pane_status GUEST || TEST_ONE_skip=1
;;
"g1tools")
- pane_run GUEST_1 'which '"${__arg}"' >/dev/null || echo skip'
- pane_wait GUEST_1
- [ "$(pane_parse GUEST_1)" = "skip" ] && TEST_ONE_skip=1 || true
+ pane_run GUEST_1 'which '"${__arg}"' >/dev/null'
+ pane_status GUEST_1 || TEST_ONE_skip=1
;;
"g2tools")
- pane_run GUEST_2 'which '"${__arg}"' >/dev/null || echo skip'
- pane_wait GUEST_2
- [ "$(pane_parse GUEST_2)" = "skip" ] && TEST_ONE_skip=1 || true
+ pane_run GUEST_2 'which '"${__arg}"' >/dev/null'
+ pane_status GUEST_2 || TEST_ONE_skip=1
;;
"guest2")
pane_run GUEST_2 "${__arg}"
@@ -247,9 +243,8 @@ test_one_line() {
pane_status NS2 || TEST_ONE_nok=1
;;
"nstools")
- pane_run NS 'which '"${__arg}"' >/dev/null || echo skip'
- pane_wait NS
- [ "$(pane_parse NS)" = "skip" ] && TEST_ONE_skip=1 || true
+ pane_run NS 'which '"${__arg}"' >/dev/null'
+ pane_status NS || TEST_ONE_skip=1
;;
"gout")
__varname="${__arg%% *}"
--
2.35.1
next prev parent reply other threads:[~2022-05-17 12:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-17 12:36 [PATCH 00/12] Tests fixes and clean-ups Stefano Brivio
2022-05-17 12:36 ` [PATCH 01/12] tests: Update mbuto git URLs Stefano Brivio
2022-05-17 12:36 ` [PATCH 02/12] tests: Remove unused XVFB variable Stefano Brivio
2022-05-17 12:36 ` [PATCH 03/12] tests: Add some debugging output for the test scripts themselves Stefano Brivio
2022-05-17 12:36 ` [PATCH 04/12] tests: Don't use tmux update-environment Stefano Brivio
2022-05-17 12:36 ` [PATCH 05/12] tests: Don't globally set tmux default-shell Stefano Brivio
2022-05-17 12:36 ` [PATCH 06/12] tests: Improve control character filtering in pane_parse Stefano Brivio
2022-05-17 12:36 ` [PATCH 07/12] tests: Don't ignore errors during script Stefano Brivio
2022-05-17 12:36 ` [PATCH 08/12] tests: Add pane_status command to check for success of issued commands Stefano Brivio
2022-05-17 12:36 ` Stefano Brivio [this message]
2022-05-17 12:36 ` [PATCH 10/12] tests: Simplify explicit checks for command success Stefano Brivio
2022-05-17 12:36 ` [PATCH 11/12] test/perf/pasta_udp: Drop redundant assignment of ::1 to loopback interface Stefano Brivio
2022-05-17 12:36 ` [PATCH 12/12] test/run: Return 0 from run(), exit value already reflects failures Stefano Brivio
2022-05-18 3:17 ` [PATCH 00/12] Tests fixes and clean-ups David Gibson
2022-05-18 5:40 ` Stefano Brivio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220517123614.1892316-10-sbrivio@redhat.com \
--to=sbrivio@redhat.com \
--cc=passt-dev@passt.top \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).