Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Joachim Wiberg <troglobit@gmail.com>
To: buildroot@buildroot.org
Cc: Joachim Wiberg <troglobit@gmail.com>
Subject: [Buildroot] [PATCH 3/3] support/testing: mdnsd: new runtime test
Date: Fri, 17 Jul 2026 16:25:28 +0200	[thread overview]
Message-ID: <20260717142528.2709557-3-troglobit@gmail.com> (raw)
In-Reply-To: <20260717142528.2709557-1-troglobit@gmail.com>

Boot an armv5 image running the mdnsd responder alongside the mquery
client, then check that service discovery works: mquery browses for the
bundled _http._tcp service and mdnsd, on the same host, answers over the
loopback of the eth0 multicast group.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
---
 DEVELOPERS                                  |  1 +
 support/testing/tests/package/test_mdnsd.py | 38 +++++++++++++++++++++
 2 files changed, 39 insertions(+)
 create mode 100644 support/testing/tests/package/test_mdnsd.py

diff --git a/DEVELOPERS b/DEVELOPERS
index fdfab8b489..82300c4a18 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1664,6 +1664,7 @@ F:	package/ssdp-responder/
 F:	package/sysklogd/
 F:	package/uredir/
 F:	package/watchdogd/
+F:	support/testing/tests/package/test_mdnsd.py
 
 N:	Jochen Baltes <jochen.baltes@gmail.com>
 F:	package/altera-stapl
diff --git a/support/testing/tests/package/test_mdnsd.py b/support/testing/tests/package/test_mdnsd.py
new file mode 100644
index 0000000000..43057d4351
--- /dev/null
+++ b/support/testing/tests/package/test_mdnsd.py
@@ -0,0 +1,38 @@
+import os
+
+import infra.basetest
+
+
+class TestMdnsd(infra.basetest.BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_PACKAGE_MDNSD=y
+        BR2_PACKAGE_MDNSD_MQUERY=y
+        BR2_PACKAGE_MDNSD_HTTP_SERVICE=y
+        BR2_SYSTEM_DHCP="eth0"
+        BR2_TARGET_ROOTFS_CPIO=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """
+
+    def test_run(self):
+        img = os.path.join(self.builddir, "images", "rootfs.cpio")
+        self.emulator.boot(arch="armv5",
+                           kernel="builtin",
+                           options=["-initrd", img,
+                                    "-net", "nic,model=rtl8139",
+                                    "-net", "user"])
+        self.emulator.login()
+
+        # The responder is started at boot by /etc/init.d/S50mdnsd and
+        # advertises the bundled _http._tcp service from /etc/mdns.d/.
+        self.assertRunOk("pidof mdnsd")
+
+        # 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"
+        self.assertRunOk(cmd, timeout=30)
+
+        # mquery sends a multicast query for the advertised service;
+        # output is one "+ NAME (IP)" line per instance
+        cmd = "mquery -T _http._tcp |grep -F buildroot._http._tcp.local"
+        self.assertRunOk(cmd, timeout=30)
-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  parent reply	other threads:[~2026-07-17 14:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 14:25 [Buildroot] [PATCH 1/3] package/mdnsd: bump to v1.1 Joachim Wiberg
2026-07-17 14:25 ` [Buildroot] [PATCH 2/3] package/mdnsd: install libmdnsd to staging/ Joachim Wiberg
2026-07-17 14:25 ` Joachim Wiberg [this message]
2026-07-19 11:07 ` [Buildroot] [PATCH 1/3] package/mdnsd: bump to v1.1 Julien Olivain via buildroot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260717142528.2709557-3-troglobit@gmail.com \
    --to=troglobit@gmail.com \
    --cc=buildroot@buildroot.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox