tests: Simplify *tools commands using pane_status

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@gibson.dropbear.id.au>
This commit is contained in:
David Gibson 2022-05-12 16:33:57 +10:00 committed by Stefano Brivio
parent 13ad716f30
commit 4643b9b74c

View file

@ -151,9 +151,8 @@ test_one_line() {
tmux send-keys -t ${PANE_HOST} "C-c" tmux send-keys -t ${PANE_HOST} "C-c"
;; ;;
"htools") "htools")
pane_run HOST 'which '"${__arg}"' >/dev/null || echo skip' pane_run HOST 'which '"${__arg}"' >/dev/null'
pane_wait HOST pane_status HOST || TEST_ONE_skip=1
[ "$(pane_parse HOST)" = "skip" ] && TEST_ONE_skip=1 || true
;; ;;
"passt") "passt")
pane_run PASST "${__arg}" pane_run PASST "${__arg}"
@ -192,19 +191,16 @@ test_one_line() {
pane_status GUEST_1 || TEST_ONE_nok=1 pane_status GUEST_1 || TEST_ONE_nok=1
;; ;;
"gtools") "gtools")
pane_run GUEST 'which '"${__arg}"' >/dev/null || echo skip' pane_run GUEST 'which '"${__arg}"' >/dev/null'
pane_wait GUEST pane_status GUEST || TEST_ONE_skip=1
[ "$(pane_parse GUEST)" = "skip" ] && TEST_ONE_skip=1 || true
;; ;;
"g1tools") "g1tools")
pane_run GUEST_1 'which '"${__arg}"' >/dev/null || echo skip' pane_run GUEST_1 'which '"${__arg}"' >/dev/null'
pane_wait GUEST_1 pane_status GUEST_1 || TEST_ONE_skip=1
[ "$(pane_parse GUEST_1)" = "skip" ] && TEST_ONE_skip=1 || true
;; ;;
"g2tools") "g2tools")
pane_run GUEST_2 'which '"${__arg}"' >/dev/null || echo skip' pane_run GUEST_2 'which '"${__arg}"' >/dev/null'
pane_wait GUEST_2 pane_status GUEST_2 || TEST_ONE_skip=1
[ "$(pane_parse GUEST_2)" = "skip" ] && TEST_ONE_skip=1 || true
;; ;;
"guest2") "guest2")
pane_run GUEST_2 "${__arg}" pane_run GUEST_2 "${__arg}"
@ -247,9 +243,8 @@ test_one_line() {
pane_status NS2 || TEST_ONE_nok=1 pane_status NS2 || TEST_ONE_nok=1
;; ;;
"nstools") "nstools")
pane_run NS 'which '"${__arg}"' >/dev/null || echo skip' pane_run NS 'which '"${__arg}"' >/dev/null'
pane_wait NS pane_status NS || TEST_ONE_skip=1
[ "$(pane_parse NS)" = "skip" ] && TEST_ONE_skip=1 || true
;; ;;
"gout") "gout")
__varname="${__arg%% *}" __varname="${__arg%% *}"