From: Stefano Brivio <sbrivio@redhat.com>
To: passt-dev@passt.top
Subject: Re: [PATCH v2 05/11] test: Issue host commands via context for most tests
Date: Fri, 09 Sep 2022 17:18:48 +0200 [thread overview]
Message-ID: <20220909171848.7723d946@elisabeth> (raw)
In-Reply-To: <20220908014920.1474597-6-david@gibson.dropbear.id.au>
[-- Attachment #1: Type: text/plain, Size: 5607 bytes --]
Nit:
On Thu, 8 Sep 2022 11:49:14 +1000
David Gibson <david(a)gibson.dropbear.id.au> wrote:
> Convert most of the tests to use the new-style system for issuing commands
> for all host commands. We leave the distro tests for now: they use
> the same pane for both host and guest commands which we'll need some more
> things to deal with.
>
> Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au>
> ---
> test/lib/layout | 20 ++++++++++----------
> test/lib/setup | 47 ++++++++++++++++++++++++++++++++---------------
> 2 files changed, 42 insertions(+), 25 deletions(-)
>
> diff --git a/test/lib/layout b/test/lib/layout
> index 2d6b197..09c213a 100644
> --- a/test/lib/layout
> +++ b/test/lib/layout
> @@ -31,8 +31,12 @@ layout_host() {
> tmux send-keys -t ${PANE_INFO} -N 100 C-m
> tmux select-pane -t ${PANE_INFO} -T "test log"
>
> - tmux pipe-pane -O -t ${PANE_HOST} "cat >> ${LOGDIR}/pane_host.log"
> - tmux select-pane -t ${PANE_HOST} -T "host"
> + if context_exists host; then
> + pane_watch_contexts 0 host host
> + else
> + tmux pipe-pane -O -t ${PANE_HOST} "cat >> ${LOGDIR}/pane_host.log"
> + tmux select-pane -t ${PANE_HOST} -T "host"
> + fi
>
> info_layout "host commands only"
>
> @@ -64,8 +68,7 @@ layout_pasta() {
> tmux send-keys -t ${PANE_INFO} -N 100 C-m
> tmux select-pane -t ${PANE_INFO} -T "test log"
>
> - tmux pipe-pane -O -t ${PANE_HOST} "cat >> ${LOGDIR}/pane_host.log"
> - tmux select-pane -t ${PANE_HOST} -T "host"
> + pane_watch_contexts ${PANE_HOST} host host
>
> tmux pipe-pane -O -t ${PANE_PASST} "cat >> ${LOGDIR}/pane_passt.log"
> tmux select-pane -t ${PANE_PASST} -T "pasta"
> @@ -100,8 +103,7 @@ layout_passt() {
> tmux send-keys -t ${PANE_INFO} -N 100 C-m
> tmux select-pane -t ${PANE_INFO} -T "test log"
>
> - tmux pipe-pane -O -t ${PANE_HOST} "cat >> ${LOGDIR}/pane_host.log"
> - tmux select-pane -t ${PANE_HOST} -T "host"
> + pane_watch_contexts ${PANE_HOST} host host
>
> tmux pipe-pane -O -t ${PANE_PASST} "cat >> ${LOGDIR}/pane_passt.log"
> tmux select-pane -t ${PANE_PASST} -T "passt"
> @@ -141,8 +143,7 @@ layout_passt_in_pasta() {
> tmux send-keys -t ${PANE_INFO} -N 100 C-m
> tmux select-pane -t ${PANE_INFO} -T "test log"
>
> - tmux pipe-pane -O -t ${PANE_HOST} "cat >> ${LOGDIR}/pane_host.log"
> - tmux select-pane -t ${PANE_HOST} -T "host"
> + pane_watch_contexts ${PANE_HOST} host host
>
> tmux pipe-pane -O -t ${PANE_PASST} "cat >> ${LOGDIR}/pane_passt.log"
> tmux select-pane -t ${PANE_PASST} -T "passt in pasta (namespace)"
> @@ -189,8 +190,7 @@ layout_two_guests() {
> tmux send-keys -t ${PANE_INFO} -N 100 C-m
> tmux select-pane -t ${PANE_INFO} -T "test log"
>
> - tmux pipe-pane -O -t ${PANE_HOST} "cat >> ${LOGDIR}/pane_host.log"
> - tmux select-pane -t ${PANE_HOST} -T "host"
> + pane_watch_contexts ${PANE_HOST} host host
>
> tmux pipe-pane -O -t ${PANE_PASST_1} "cat >> ${LOGDIR}/pane_passt_1.log"
> tmux select-pane -t ${PANE_PASST_1} -T "passt #1 in namespace #1"
> diff --git a/test/lib/setup b/test/lib/setup
> index 42f03c1..9b5e9ff 100755
> --- a/test/lib/setup
> +++ b/test/lib/setup
> @@ -20,6 +20,8 @@ VMEM="$((${__mem_kib} / 1024 / 4))"
>
> # setup_build() - Set up pane layout for build tests
> setup_build() {
> + context_setup_host host
> +
> layout_host
> }
>
> @@ -30,6 +32,8 @@ setup_distro() {
>
> # setup_passt() - Start qemu and passt
> setup_passt() {
> + context_setup_host host
> +
> layout_passt
>
> # Ports:
> @@ -63,17 +67,12 @@ setup_passt() {
> " -netdev socket,fd=5,id=hostnet0" \
> ' -pidfile passt_qemu.pid'
> pane_status GUEST
> -
> - # Set things up to reduce problems parsing host command output
> - pane_run HOST "PS1='$ '"
> - pane_wait HOST
> - # Non-bash shells will fail this, but also don't need it, so ignore errors
> - pane_run HOST "bind 'set enable-bracketed-paste off'"
> - pane_wait HOST
> }
>
> # setup_pasta() - Create a network and user namespace, connect pasta to it
> setup_pasta() {
> + context_setup_host host
> +
> layout_pasta
>
> pane_run NS 'echo $$'
> @@ -105,6 +104,8 @@ setup_pasta() {
>
> # setup_passt_in_ns() - Set up namespace (with pasta), run qemu and passt into it
> setup_passt_in_ns() {
> + context_setup_host host
> +
> layout_passt_in_pasta
>
> # Ports:
> @@ -182,17 +183,12 @@ setup_passt_in_ns() {
> " -netdev socket,fd=5,id=hostnet0" \
> ' -pidfile passt_in_ns_qemu.pid'
> pane_status GUEST
> -
> - # Set things up to reduce problems parsing host command output
> - pane_run HOST "PS1='$ '"
> - pane_wait HOST
> - # Non-bash shells will fail this, but also don't need it, so ignore errors
> - pane_run HOST "bind 'set enable-bracketed-paste off'"
> - pane_wait HOST
> }
>
> # setup_two_guests() - Set up two namespace, run qemu and passt in both of them
> setup_two_guests() {
> + context_setup_host host
> +
> layout_two_guests
>
> # Ports:
> @@ -290,9 +286,21 @@ setup_two_guests() {
> pane_status GUEST_2
> }
>
> +# teardown_context_watch() - Remove contexts and stop panes watching them
> +# $1: Pane number watching
> +# $@: Context names
> +teardown_context_watch() {
> + __pane="$1"
> + shift
> + for __c ; do
Whitespace between ; and do is the most common coding style from POSIX
references, but otherwise inconsistent with everything else in these
files (and, say, with pane_watch_contexts() in 3/11) -- I'd drop it.
--
Stefano
next prev parent reply other threads:[~2022-09-09 15:18 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-08 1:49 [PATCH v2 00/11] Improve command dispatch in test scripts David Gibson
2022-09-08 1:49 ` [PATCH v2 01/11] test: Correctly match "background" with "wait" commands David Gibson
2022-09-08 1:49 ` [PATCH v2 02/11] test: Context execution helpers David Gibson
2022-09-08 1:49 ` [PATCH v2 03/11] test: Allow a tmux pane to watch commands executed in contexts David Gibson
2022-09-09 15:18 ` Stefano Brivio
2022-09-10 6:36 ` David Gibson
2022-09-08 1:49 ` [PATCH v2 04/11] test: Integration of old-style pane execution and new context execution David Gibson
2022-09-08 1:49 ` [PATCH v2 05/11] test: Issue host commands via context for most tests David Gibson
2022-09-09 15:18 ` Stefano Brivio [this message]
2022-09-10 6:38 ` David Gibson
2022-09-08 1:49 ` [PATCH v2 06/11] test: Use new-style contexts for passt pane in the pasta and passt tests David Gibson
2022-09-08 1:49 ` [PATCH v2 07/11] test: Add nsholder utility David Gibson
2022-09-09 15:18 ` Stefano Brivio
2022-09-10 6:45 ` David Gibson
2022-09-08 1:49 ` [PATCH v2 08/11] test: Extend context system to run commands in namespace for pasta tests David Gibson
2022-09-08 1:49 ` [PATCH v2 09/11] test: Use context system for guest commands David Gibson
2022-09-08 1:49 ` [PATCH v2 10/11] test: Use context system for two_guests tests David Gibson
2022-09-08 1:49 ` [PATCH v2 11/11] test: Use new-style command issue for passt_in_ns tests David Gibson
2022-09-09 15:19 ` Stefano Brivio
2022-09-10 6:47 ` David Gibson
2022-09-10 20:40 ` Stefano Brivio
2022-09-09 15:21 ` [PATCH v2 00/11] Improve command dispatch in test scripts Stefano Brivio
2022-09-10 6:59 ` David Gibson
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=20220909171848.7723d946@elisabeth \
--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).