From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson To: passt-dev@passt.top Subject: Re: [PATCH 04/12] test: More robust wait for pasta/passt to be ready Date: Sat, 24 Sep 2022 13:03:32 +1000 Message-ID: In-Reply-To: <20220924010813.75195993@elisabeth> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4734311751662102846==" --===============4734311751662102846== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Sat, Sep 24, 2022 at 01:08:13AM +0200, Stefano Brivio wrote: > On Fri, 23 Sep 2022 17:20:30 +1000 > David Gibson wrote: >=20 > > When we start passt or pasta, it may take a short time to be ready to > > handle packets, especially if running under valgrind. We have a > > number of semi-arbitrary fixed sleeps to account for this. > >=20 > > We can do this more robustly by exploiting the fact that pasta/passt > > doesn't write its pidfile until it's ready to go, so if we wait for > > the pidfile to be created, we can proceed with confidence. > >=20 > > Signed-off-by: David Gibson > > --- > > test/lib/setup | 15 ++++++++++----- > > 1 file changed, 10 insertions(+), 5 deletions(-) > >=20 > > diff --git a/test/lib/setup b/test/lib/setup > > index 7e3f6c3..dee7b46 100755 > > --- a/test/lib/setup > > +++ b/test/lib/setup > > @@ -54,7 +54,9 @@ setup_passt() { > > context_run passt "make clean" > > context_run passt "make valgrind" > > context_run_bg passt "valgrind --max-stackframe=3D$((4 * 1024 * 1024)) = --trace-children=3Dyes --vgdb=3Dno --error-exitcode=3D1 --suppressions=3Dtest= /valgrind.supp ./passt ${__opts} -f -t 10001 -u 10001 -P ${STATESETUP}/passt.= pid" > > - sleep 5 > > + > > + # pidfile isn't created until passt is listening >=20 > Here, >=20 > > + wait_for [ -f "${STATESETUP}/passt.pid" ] > > =20 > > GUEST_CID=3D94557 > > context_run_bg qemu './qrap 5 qemu-system-$(uname -m)' \ > > @@ -99,7 +101,9 @@ setup_pasta() { > > [ ${TRACE} -eq 1 ] && __opts=3D"${__opts} --trace" > > =20 > > context_run_bg passt "./pasta ${__opts} -f -t 10002 -T 10003 -u 10002 -= U 10003 -P ${STATESETUP}/passt.pid ${__target_pid}" > > - sleep 1 > > + > > + # pidfile isn't created until pasta is ready >=20 > and here, we have spaces instead of tabs. I can fix that up on merge, > unless you respin anyway. Oops, fixed, and I will be respinning. --=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 --===============4734311751662102846== Content-Type: application/pgp-signature Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="signature.asc" MIME-Version: 1.0 LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KCmlRSXpCQUVCQ0FBZEZpRUVvVUx4V3U0L1dz MGRCK1h0Z3lwWTRnRXdZU0lGQW1NdWMzNEFDZ2tRZ3lwWTRnRXcKWVNLTmp4QUEwWlZLaXVISk5V TnFWRmhDMWtKVW85TU5kbmVqZVQzNEthcG9pT3N5RUppQXdyZ1R3NjZRWGJpTgpta05tL09IQ2p6 VHBReGhJeUZEdzdKVFozSVZQMFNCU1I4VHdFUTJNbkxlbTRXMHdBbFIzRnhNWlhiY3ptL0pBCm8w enNiVHc0R1prN0diZElUWkcwNUx5dEFBVXZFOEsyUnUvWFZyQWo1SHVUYzZhdnNUMmpMdGpMNFFy S2pXTWkKUjd1V2xXNkhxSzRWaHFWNUV4YXRKT21nbU9wL3k5U3Z2LzI3MXdleklGOXhQenQ1NXJR OENNeWhGTmhZRDV6QwpQaW4wby9TZXIyWWhYYU40bjVyOEdQNENoc2c5enUxd3ZGdlBGWHFGZW5l VG5LaXZJdzJCYTZiYmwwREhkTWI5CjdRTmU0NUliNlUza1FlRUxnaUVtTTEvM2xrM1FOMXZ6OXEw Rm1sT3Q2TFdEa0MzYWRROUttWk1WRDQrYmRJNlcKN0VlQmFjdEtqaTRpcG8wZGdmQjY4NWJDZVIz bDBCaWkxc3RhQm5Uak5ESnFkek8wbkJQUnVCdWNzTzNJYkdoOAoxUGNrdWQ1Tm5yN0h1Zm5nVndT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