From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Brivio 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 01:08:13 +0200 Message-ID: <20220924010813.75195993@elisabeth> In-Reply-To: <20220923072038.1667106-5-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7143030216756218686==" --===============7143030216756218686== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Fri, 23 Sep 2022 17:20:30 +1000 David Gibson wrote: > 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/v= algrind.supp ./passt ${__opts} -f -t 10001 -u 10001 -P ${STATESETUP}/passt.pi= d" > - sleep 5 > + > + # pidfile isn't created until passt is listening Here, > + 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 and here, we have spaces instead of tabs. I can fix that up on merge, unless you respin anyway. --=20 Stefano --===============7143030216756218686==--