diff mbox series

[2/2] support/testing: TestMdnsd: improve test reliability

Message ID 20260831205703.3909457-2-romain.naour@smile.fr
State New
Headers show
Series [1/2] Revert "support/testing: TestMdnsd: improve test reliability" | expand

Commit Message

Romain Naour Aug. 31, 2026, 8:57 p.m. UTC
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 turns out that mdnsd is started by S50mdnsd before the
emulator.login() change the system date:

  [BRTEST# date -s @1788032864
  Sat Aug 29 19:47:44 UTC 2026

Since the minimal rootfs.cpio generated	for TestMdnsd doesn't have any
ntp client installed, it start with "January 1, 1970".

The date change may cause some issue to the mdnsd daemon which blocks
any response from mquery command.

When the problem occurs, "mquery -T _http._tcp" reply is empty:

  # mquery -T _http._tcp
  Querying _http._tcp.local. for PTR (12) ... press Ctrl-C to stop

To workaround the issue, restart mdnsd manually.

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

Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
 support/testing/tests/package/test_mdnsd.py | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Fiona Klute Sept. 1, 2026, 8:11 p.m. UTC | #1
Am 31.08.26 um 22:57 schrieb Romain Naour via buildroot:
> 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 turns out that mdnsd is started by S50mdnsd before the
> emulator.login() change the system date:
> 
>    [BRTEST# date -s @1788032864
>    Sat Aug 29 19:47:44 UTC 2026
> 
> Since the minimal rootfs.cpio generated	for TestMdnsd doesn't have any
> ntp client installed, it start with "January 1, 1970".
> 
> The date change may cause some issue to the mdnsd daemon which blocks
> any response from mquery command.
> 
> When the problem occurs, "mquery -T _http._tcp" reply is empty:
> 
>    # mquery -T _http._tcp
>    Querying _http._tcp.local. for PTR (12) ... press Ctrl-C to stop
> 
> To workaround the issue, restart mdnsd manually.

Thanks for the workaround! If mdnsd gets stuck if there's a time jump, 
that sounds like an issue that should also be reported upstream (and 
hopefully fixed there). Even with an NTP client installed there'd be no 
guarantee the time would have been set before mdnsd starts.

Best regards,
Fiona

> Fixes:
> https://gitlab.com/buildroot.org/buildroot/-/jobs/16185948555
> 
> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> ---
>   support/testing/tests/package/test_mdnsd.py | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/support/testing/tests/package/test_mdnsd.py b/support/testing/tests/package/test_mdnsd.py
> index 214eea7dd9..ebb8971e38 100644
> --- a/support/testing/tests/package/test_mdnsd.py
> +++ b/support/testing/tests/package/test_mdnsd.py
> @@ -23,6 +23,10 @@ class TestMdnsd(infra.basetest.BRTest):
>                                       "-net", "user"])
>           self.emulator.login()
>   
> +        # Restart mdnsd after setting the date in emulator.login() setup.
> +        cmd = "/etc/init.d/S50mdnsd restart"
> +        self.assertRunOk(cmd, timeout=30)
> +
>           # We check the program can execute.
>           self.assertRunOk("mdnsd -v")
>
Romain Naour Sept. 1, 2026, 9:15 p.m. UTC | #2
Hello Fiona, All,

Le 01/09/2026 à 22:11, Fiona Klute a écrit :
> Am 31.08.26 um 22:57 schrieb Romain Naour via buildroot:
>> 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 turns out that mdnsd is started by S50mdnsd before the
>> emulator.login() change the system date:
>>
>>    [BRTEST# date -s @1788032864
>>    Sat Aug 29 19:47:44 UTC 2026
>>
>> Since the minimal rootfs.cpio generated    for TestMdnsd doesn't have any
>> ntp client installed, it start with "January 1, 1970".
>>
>> The date change may cause some issue to the mdnsd daemon which blocks
>> any response from mquery command.
>>
>> When the problem occurs, "mquery -T _http._tcp" reply is empty:
>>
>>    # mquery -T _http._tcp
>>    Querying _http._tcp.local. for PTR (12) ... press Ctrl-C to stop
>>
>> To workaround the issue, restart mdnsd manually.
> 
> Thanks for the workaround! If mdnsd gets stuck if there's a time jump, that
> sounds like an issue that should also be reported upstream (and hopefully fixed
> there). Even with an NTP client installed there'd be no guarantee the time would
> have been set before mdnsd starts.

I just created a new issue on Github:
https://github.com/troglobit/mdnsd/issues/99

Hopefully this is the last issue for the runtime testsuite for the upcoming
2026.08 release!

Best regards,
Romain

> 
> Best regards,
> Fiona
> 
>> Fixes:
>> https://gitlab.com/buildroot.org/buildroot/-/jobs/16185948555
>>
>> Signed-off-by: Romain Naour <romain.naour@smile.fr>
>> ---
>>   support/testing/tests/package/test_mdnsd.py | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/support/testing/tests/package/test_mdnsd.py b/support/testing/
>> tests/package/test_mdnsd.py
>> index 214eea7dd9..ebb8971e38 100644
>> --- a/support/testing/tests/package/test_mdnsd.py
>> +++ b/support/testing/tests/package/test_mdnsd.py
>> @@ -23,6 +23,10 @@ class TestMdnsd(infra.basetest.BRTest):
>>                                       "-net", "user"])
>>           self.emulator.login()
>>   +        # Restart mdnsd after setting the date in emulator.login() setup.
>> +        cmd = "/etc/init.d/S50mdnsd restart"
>> +        self.assertRunOk(cmd, timeout=30)
>> +
>>           # We check the program can execute.
>>           self.assertRunOk("mdnsd -v")
>>   
>
diff mbox series

Patch

diff --git a/support/testing/tests/package/test_mdnsd.py b/support/testing/tests/package/test_mdnsd.py
index 214eea7dd9..ebb8971e38 100644
--- a/support/testing/tests/package/test_mdnsd.py
+++ b/support/testing/tests/package/test_mdnsd.py
@@ -23,6 +23,10 @@  class TestMdnsd(infra.basetest.BRTest):
                                     "-net", "user"])
         self.emulator.login()
 
+        # Restart mdnsd after setting the date in emulator.login() setup.
+        cmd = "/etc/init.d/S50mdnsd restart"
+        self.assertRunOk(cmd, timeout=30)
+
         # We check the program can execute.
         self.assertRunOk("mdnsd -v")