On Fri, 23 Sep 2022 17:20:30 +1000 David Gibson <david(a)gibson.dropbear.id.au> 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. 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. Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au> --- test/lib/setup | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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=$((4 * 1024 * 1024)) --trace-children=yes --vgdb=no --error-exitcode=1 --suppressions=test/valgrind.supp ./passt ${__opts} -f -t 10001 -u 10001 -P ${STATESETUP}/passt.pid" - sleep 5 + + # pidfile isn't created until passt is listeningHere,+ wait_for [ -f "${STATESETUP}/passt.pid" ] GUEST_CID=94557 context_run_bg qemu './qrap 5 qemu-system-$(uname -m)' \ @@ -99,7 +101,9 @@ setup_pasta() { [ ${TRACE} -eq 1 ] && __opts="${__opts} --trace" 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 readyand here, we have spaces instead of tabs. I can fix that up on merge, unless you respin anyway. -- Stefano