From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson To: passt-dev@passt.top Subject: Re: [PATCH v2 05/11] test: Issue host commands via context for most tests Date: Sat, 10 Sep 2022 16:38:15 +1000 Message-ID: In-Reply-To: <20220909171848.7723d946@elisabeth> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8680970037650854926==" --===============8680970037650854926== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Fri, Sep 09, 2022 at 05:18:48PM +0200, Stefano Brivio wrote: > Nit: >=20 > On Thu, 8 Sep 2022 11:49:14 +1000 > David Gibson wrote: >=20 > > 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. > >=20 > > Signed-off-by: David Gibson > > --- > > test/lib/layout | 20 ++++++++++---------- > > test/lib/setup | 47 ++++++++++++++++++++++++++++++++--------------- > > 2 files changed, 42 insertions(+), 25 deletions(-) > >=20 > > 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" > > =20 > > - 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 > > =20 > > info_layout "host commands only" > > =20 > > @@ -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" > > =20 > > - 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 > > =20 > > 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" > > =20 > > - 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 > > =20 > > 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" > > =20 > > - 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 > > =20 > > 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" > > =20 > > - 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 > > =20 > > 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=3D"$((${__mem_kib} / 1024 / 4))" > > =20 > > # setup_build() - Set up pane layout for build tests > > setup_build() { > > + context_setup_host host > > + > > layout_host > > } > > =20 > > @@ -30,6 +32,8 @@ setup_distro() { > > =20 > > # setup_passt() - Start qemu and passt > > setup_passt() { > > + context_setup_host host > > + > > layout_passt > > =20 > > # Ports: > > @@ -63,17 +67,12 @@ setup_passt() { > > " -netdev socket,fd=3D5,id=3Dhostnet0" \ > > ' -pidfile passt_qemu.pid' > > pane_status GUEST > > - > > - # Set things up to reduce problems parsing host command output > > - pane_run HOST "PS1=3D'$ '" > > - pane_wait HOST > > - # Non-bash shells will fail this, but also don't need it, so ignore err= ors > > - pane_run HOST "bind 'set enable-bracketed-paste off'" > > - pane_wait HOST > > } > > =20 > > # setup_pasta() - Create a network and user namespace, connect pasta to = it > > setup_pasta() { > > + context_setup_host host > > + > > layout_pasta > > =20 > > pane_run NS 'echo $$' > > @@ -105,6 +104,8 @@ setup_pasta() { > > =20 > > # setup_passt_in_ns() - Set up namespace (with pasta), run qemu and pass= t into it > > setup_passt_in_ns() { > > + context_setup_host host > > + > > layout_passt_in_pasta > > =20 > > # Ports: > > @@ -182,17 +183,12 @@ setup_passt_in_ns() { > > " -netdev socket,fd=3D5,id=3Dhostnet0" \ > > ' -pidfile passt_in_ns_qemu.pid' > > pane_status GUEST > > - > > - # Set things up to reduce problems parsing host command output > > - pane_run HOST "PS1=3D'$ '" > > - pane_wait HOST > > - # Non-bash shells will fail this, but also don't need it, so ignore err= ors > > - pane_run HOST "bind 'set enable-bracketed-paste off'" > > - pane_wait HOST > > } > > =20 > > # 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 > > =20 > > # Ports: > > @@ -290,9 +286,21 @@ setup_two_guests() { > > pane_status GUEST_2 > > } > > =20 > > +# teardown_context_watch() - Remove contexts and stop panes watching them > > +# $1: Pane number watching > > +# $@: Context names > > +teardown_context_watch() { > > + __pane=3D"$1" > > + shift > > + for __c ; do >=20 > 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. Adjusted, thanks. --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --===============8680970037650854926== Content-Type: application/pgp-signature Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="signature.asc" MIME-Version: 1.0 LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KCmlRSXpCQUVCQ0FBZEZpRUVvVUx4V3U0L1dz MGRCK1h0Z3lwWTRnRXdZU0lGQW1NY01OQUFDZ2tRZ3lwWTRnRXcKWVNMRWl4QUFwZ2JZSm5rVzZy bmpBNjA4TTZ5cWRoMnJQci84YXRxOUh1ak1FUHBhU1lZbTN1bEMrMFo4SUtkQwpJeU5YTHZJY1dG YXA4ZzNpS1IvZkZldkZaNDZBd2lnK0NtQXZFL0gwRXpSeGVEakZOYkoveFp2NHRwNXhVM2pxCmpr bDJsTWZkamo3cDdUZkRVajg5Tlc2YTBVVnNQWEc5dE9QUkZiQlVCZEZ5MGQzZ0p2R3B5dHBseGZi bzBCYjcKTm92ZVFURElJQXFJT2VLaVlCdUZlU284bG5yT2lLOG13enRrZmhZRnZUa2twMEJGQXow VjZmYWlMb2JqNWdrcQpBaHpSZzJlSGk3ZC93aEJqb3hRY2VyaFJZNE42aXVGTmcwbDJibnVRQXVF Q1hFYmhUa3hOZDdMakc0ZTFoUHNqCkxPdnRnTW40WmgvRHpuM3JOMWxGd1RtUWZVenNrVkNwMVhO d3RjaW5SSnorRmlSNlZVMXZCRlMyMlJGQzByK2cKS3NLSDBLMEUvT1NVVmhEZ3RWR0ZCa3N1bU9E aGFFaExPQzN0OWFnenp6T0VjaUp6bCtrVmJ6QU9UZlVud1FMbApocmRSc1ZmeUh6dityb015ZGFz VklHV0REU2N4YUc0NjVUSjRkcjQyQnRFY1BHckhUMkFrRXJXMHhFa29wT29VCjBLbzVHbElmbWNN djRTcFZ0YlVqOGZOaXRuTnY3YkVxdXkvVHRTN3RkU2RKWkxVclkyU0I0cXFGWVZnZHVBLysKQlZk RHhMcXBoa0VEcWNqaU9oNVBwS21XcmJjaDh4eDdPR1lzVEczRngxbzc1VUZiYXVjdXFIUUdPQWV3 WWlEQQp4dlVGa0Z3ekxmVmZCMzdkYlRVNXRIZmtxbTBjMnFKNW90YnVUdzI0RnQwaTNPMVJkRWM9 Cj12V1FaCi0tLS0tRU5EIFBHUCBTSUdOQVRVUkUtLS0tLQo= --===============8680970037650854926==--