support/testing: TestMdnsd: improve test reliability

The mdnsd runtime test can randomly fail on slow runners.

It's hard to reproduce locally (only one failure after a few attempts)
but we can reproduce it easily by removing the while loop entirely.

It means that the "sleep 1" is not used on the Gitlab runner.
The timestamp of the failed job seems to confirm that [1].

07:06:55    [BRTEST# while ! ifconfig eth0 | grep -q 'inet addr'; do sleep 1; done
07:06:55    [BRTEST# echo $?
07:06:55    0
07:06:55    [BRTEST# mquery -T _http._tcp |grep -F buildroot._http._tcp.local
07:06:55    [BRTEST# echo $?
07:06:55    1

So wait a bit for mdnsd to be ready.

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/16060152862

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Romain Naour
2026-08-26 21:31:34 +02:00
committed by Julien Olivain
parent 23fd881bdb
commit b4b1de1f7f

View File

@@ -1,4 +1,5 @@
import os
import time
import infra.basetest
@@ -30,6 +31,9 @@ class TestMdnsd(infra.basetest.BRTest):
# advertises the bundled _http._tcp service from /etc/mdns.d/.
self.assertRunOk("pidof mdnsd")
# We wait for mdnsd to be ready...
time.sleep(1)
# mdnsd only answers on multicast capable interfaces that are
# up, so wait for eth0 to get its DHCP address before querying.
cmd = "while ! ifconfig eth0 | grep -q 'inet addr'; do sleep 1; done"