From 56e755ba1146dc6bd488bedc155db5be9c47ac12 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Mon, 12 Sep 2022 20:56:22 +1000 Subject: test: Use context system for guest commands Extends the context system in the test scripts to allow executing commands within a guest. Do this without requiring an existing network in the guest by using socat to run ssh via a vsock connection. We do need some additional "sleep"s in the tests, because the new faster dispatch means that sometimes we attempt to connect before socat has managed to listen. For now, only use this for the plain "passt" tests. The "passt_in_ns" and other tests have additional complications we still need to deal with. Signed-off-by: David Gibson --- test/lib/term | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'test/lib/term') diff --git a/test/lib/term b/test/lib/term index fc229f1..2355e64 100755 --- a/test/lib/term +++ b/test/lib/term @@ -266,7 +266,8 @@ pane_or_context_run() { __name="${1}" shift if context_exists "${__name}"; then - context_run "${__name}" "$@" >/dev/null 2>&1 + # Redirect stdin to stop ssh from eating the test instructions file we have on stdin + context_run "${__name}" "$@" >/dev/null 2>&1 < /dev/null else __uc="$(echo "${__name}" | tr [a-z] [A-Z])" pane_run "${__uc}" "$@" @@ -281,7 +282,8 @@ pane_or_context_run_bg() { __name="${1}" shift if context_exists "${__name}"; then - context_run_bg "${__name}" "$@" >/dev/null 2>&1 + # Redirect stdin to stop ssh from eating the test instructions file we have on stdin + context_run_bg "${__name}" "$@" >/dev/null 2>&1 < /dev/null else __uc="$(echo "${__name}" | tr [a-z] [A-Z])" pane_run "${__uc}" "$@" @@ -295,7 +297,8 @@ pane_or_context_output() { __name="${1}" shift if context_exists "${__name}"; then - __output=$(context_run "${__name}" "$@" 2>/dev/null) + # Redirect stdin to stop ssh from eating the test instructions file we have on stdin + __output=$(context_run "${__name}" "$@" 2>/dev/null