* [Buildroot] [PATCH v3 0/2] Add runtime test for mpd
@ 2026-08-27 3:26 Andreas Ziegler
2026-08-27 3:26 ` [Buildroot] [PATCH v3 1/2] package/mpd: use upstream mpd.conf w/ buildroot modifications Andreas Ziegler
2026-08-27 3:26 ` [Buildroot] [PATCH v3 2/2] support/testing: add runtime test for mpd Andreas Ziegler
0 siblings, 2 replies; 5+ messages in thread
From: Andreas Ziegler @ 2026-08-27 3:26 UTC (permalink / raw)
To: buildroot; +Cc: Thomas Petazzoni, Marcus Hoffmann, Andreas Ziegler
Buildroot mpd.conf now contains exactly the minimum changes, that need to
be merged with the upstream configuration file to make a default build of
mpd runnable.
The runtime test has been stripped down to be able to dispense with
using test data. It uses the standard Buildroot configuration for mpd
without customization.
Changes v1 -> v2:
split test data in chunks to overcome mailing list restrictions
Changes v2 -> v3:
leave Config.in unchanged
reintroduce Buildroot mpd.conf as fragment file
simplify test to be used without test data
remove test data
remove mpd.conf rootfs overlay
Andreas Ziegler (2):
package/mpd: use upstream mpd.conf w/ buildroot modifications
support/testing: add runtime test for mpd
DEVELOPERS | 2 +
package/mpd/mpd.conf | 31 +++--------
package/mpd/mpd.mk | 22 +++++++-
support/testing/tests/package/test_mpd.py | 51 +++++++++++++++++++
.../tests/package/test_mpd/busybox.fragment | 4 ++
.../test_mpd/rootfs-overlay/root/test_mpd.sh | 35 +++++++++++++
6 files changed, 121 insertions(+), 24 deletions(-)
create mode 100644 support/testing/tests/package/test_mpd.py
create mode 100644 support/testing/tests/package/test_mpd/busybox.fragment
create mode 100755 support/testing/tests/package/test_mpd/rootfs-overlay/root/test_mpd.sh
--
2.53.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH v3 1/2] package/mpd: use upstream mpd.conf w/ buildroot modifications
2026-08-27 3:26 [Buildroot] [PATCH v3 0/2] Add runtime test for mpd Andreas Ziegler
@ 2026-08-27 3:26 ` Andreas Ziegler
2026-08-27 5:40 ` Thomas Petazzoni via buildroot
2026-08-27 3:26 ` [Buildroot] [PATCH v3 2/2] support/testing: add runtime test for mpd Andreas Ziegler
1 sibling, 1 reply; 5+ messages in thread
From: Andreas Ziegler @ 2026-08-27 3:26 UTC (permalink / raw)
To: buildroot; +Cc: Thomas Petazzoni, Marcus Hoffmann, Andreas Ziegler
The configuration file supplied by Buildroot is only a sample; it will
not start MPD on a default installation. In a production build, a custom
mpd.conf has to be supplied via rootfs overlay.
Treat Buildroot mpd.conf as a fragment file, containing the minimum
modifications necessary to run mpd in a default build. Install the
upstream sample and inject the values from the Buildroot fragment.
* log_file, pid_file: Buildroot specific; referenced in mpd.mk and S95mpd
* audio_output: At least one output has to be defined to run mpd
Signed-off-by: Andreas Ziegler <br025@umbiko.net>
---
Changes v2 -> v3:
reintroduce Buildroot mpd.conf as fragment file
package/mpd/mpd.conf | 31 ++++++++-----------------------
package/mpd/mpd.mk | 22 +++++++++++++++++++++-
2 files changed, 29 insertions(+), 24 deletions(-)
diff --git a/package/mpd/mpd.conf b/package/mpd/mpd.conf
index 5956b75e24..db81d69d73 100644
--- a/package/mpd/mpd.conf
+++ b/package/mpd/mpd.conf
@@ -1,32 +1,17 @@
#
-# Sample configuration file for mpd
-# This is a minimal configuration, see the manpage for more options
+# The configuration file is provided by the mpd package. This file
+# contains values that will override settings from the main config
+# file to make mpd startable in a default configuration.
#
-# Directory where the music is stored
-music_directory "/var/lib/mpd/music"
-
-# Directory where user-made playlists are stored (RW)
-playlist_directory "/var/lib/mpd/playlists"
-
-# Database file (RW)
-db_file "/var/lib/mpd/database"
-
# Log file (RW)
log_file "/var/log/mpd.log"
# Process ID file (RW)
pid_file "/var/run/mpd.pid"
-# State file (RW)
-state_file "/var/lib/mpd/state"
-
-# User id to run the daemon as
-#user "nobody"
-
-# TCP socket binding
-bind_to_address "any"
-#bind_to_address "localhost"
-
-# Unix socket to listen on
-bind_to_address "/var/lib/mpd/socket"
+# One output has to be defined
+audio_output {
+ type "null"
+ name "/dev/null"
+}
diff --git a/package/mpd/mpd.mk b/package/mpd/mpd.mk
index d063d509f4..d8e1d22611 100644
--- a/package/mpd/mpd.mk
+++ b/package/mpd/mpd.mk
@@ -345,8 +345,28 @@ else
MPD_CONF_OPTS += -Dzzip=disabled
endif
+# sed snippet from https://stackoverflow.com/a/37911473
+# single-line configurations will be inserted behind the last matching line
+# in the target file, multi-line blocks are just appended at the bottom.
define MPD_INSTALL_EXTRA_FILES
- $(INSTALL) -m 0644 -D package/mpd/mpd.conf $(TARGET_DIR)/etc/mpd.conf
+ $(INSTALL) -m 0644 -D $(@D)/doc/mpdconf.example $(TARGET_DIR)/etc/mpd.conf
+ export multiline=0
+ while read -r line; do \
+ if [[ $$line =~ ^[a-zA-Z] ]]; then \
+ if [ "$${line##*[[:space:]]}" == "{" ]; then \
+ export multiline=1; \
+ printf "%s\n" "$$line" >> "$(TARGET_DIR)"/etc/mpd.conf; \
+ else \
+ [ $$multiline ] && \
+ printf "\t%s\n" "$$line" >> "$(TARGET_DIR)"/etc/mpd.conf; \
+ [ ! $$multiline ] && \
+ sed '/#'$${line%%[[:space:]]*}'[^\n]*/,$$!b;//{x;//p;g};//!H;$$!d;x;s||&\n'"$$line"'|' -i "$(TARGET_DIR)"/etc/mpd.conf; \
+ fi \
+ elif [ "$$line" == "}" ]; then \
+ printf "%s\n" "$$line" >> "$(TARGET_DIR)"/etc/mpd.conf; \
+ export multiline=0; \
+ fi \
+ done < package/mpd/mpd.conf
mkdir -p $(TARGET_DIR)/var/lib/mpd/music
mkdir -p $(TARGET_DIR)/var/lib/mpd/playlists
endef
--
2.53.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH v3 2/2] support/testing: add runtime test for mpd
2026-08-27 3:26 [Buildroot] [PATCH v3 0/2] Add runtime test for mpd Andreas Ziegler
2026-08-27 3:26 ` [Buildroot] [PATCH v3 1/2] package/mpd: use upstream mpd.conf w/ buildroot modifications Andreas Ziegler
@ 2026-08-27 3:26 ` Andreas Ziegler
1 sibling, 0 replies; 5+ messages in thread
From: Andreas Ziegler @ 2026-08-27 3:26 UTC (permalink / raw)
To: buildroot; +Cc: Thomas Petazzoni, Marcus Hoffmann, Andreas Ziegler
Signed-off-by: Andreas Ziegler <br025@umbiko.net>
---
Changes v2 -> v3:
simplify test to be used without test data
remove mpd.conf rootfs overlay
DEVELOPERS | 2 +
support/testing/tests/package/test_mpd.py | 51 +++++++++++++++++++
.../tests/package/test_mpd/busybox.fragment | 4 ++
.../test_mpd/rootfs-overlay/root/test_mpd.sh | 35 +++++++++++++
4 files changed, 92 insertions(+)
create mode 100644 support/testing/tests/package/test_mpd.py
create mode 100644 support/testing/tests/package/test_mpd/busybox.fragment
create mode 100755 support/testing/tests/package/test_mpd/rootfs-overlay/root/test_mpd.sh
diff --git a/DEVELOPERS b/DEVELOPERS
index 5eb438906f..dae1d39ee1 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -205,6 +205,8 @@ F: package/qt6/qt6opcua/
N: Andreas Ziegler <br025@umbiko.net>
F: package/mpd/
+F: support/testing/tests/package/test_mpd
+F: support/testing/tests/package/test_mpd.py
N: Andrey Smirnov <andrew.smirnov@gmail.com>
F: package/python-decorator/
diff --git a/support/testing/tests/package/test_mpd.py b/support/testing/tests/package/test_mpd.py
new file mode 100644
index 0000000000..f93033260e
--- /dev/null
+++ b/support/testing/tests/package/test_mpd.py
@@ -0,0 +1,51 @@
+#!/bin/python
+
+import os
+import infra.basetest
+
+class TestMpd(infra.basetest.BRTest):
+
+ rootfs_overlay = \
+ infra.filepath("tests/package/test_mpd/rootfs-overlay")
+ busybox_fragment = \
+ infra.filepath("tests/package/test_mpd/busybox.fragment")
+
+ # use a custom configuration
+ config = \
+ """
+ BR2_x86_64=y
+ BR2_x86_x86_64_v2=y
+ BR2_TOOLCHAIN_EXTERNAL=y
+ BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_X86_64_GLIBC_BLEEDING_EDGE=y
+ BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
+ BR2_ROOTFS_OVERLAY="{}"
+ BR2_LINUX_KERNEL=y
+ BR2_LINUX_KERNEL_LATEST_VERSION=y
+ BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+ BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/x86_64/linux.config"
+ BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+ BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
+ BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="{}"
+ BR2_PACKAGE_MPD=y
+ # BR2_PACKAGE_MPD_MAD is not set
+ # BR2_PACKAGE_MPD_ALSA is not set
+ BR2_TARGET_ROOTFS_INITRAMFS=y
+ # BR2_TARGET_ROOTFS_TAR is not set
+ """.format(rootfs_overlay, busybox_fragment)
+
+ def test_run(self):
+ cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
+ kern = os.path.join(self.builddir, "images", "bzImage")
+ self.emulator.boot(arch="x86_64",
+ kernel=kern,
+ kernel_cmdline=["console=ttyS0"],
+ options=[
+ "-M", "q35",
+ "-cpu", "Westmere",
+ "-smp", "2",
+ "-initrd", cpio_file,
+ ])
+
+ self.emulator.login()
+
+ self.assertRunOk("/root/test_mpd.sh", timeout=30)
diff --git a/support/testing/tests/package/test_mpd/busybox.fragment b/support/testing/tests/package/test_mpd/busybox.fragment
new file mode 100644
index 0000000000..0c92d86c49
--- /dev/null
+++ b/support/testing/tests/package/test_mpd/busybox.fragment
@@ -0,0 +1,4 @@
+#
+# Networking Utilities
+#
+CONFIG_NC=y
diff --git a/support/testing/tests/package/test_mpd/rootfs-overlay/root/test_mpd.sh b/support/testing/tests/package/test_mpd/rootfs-overlay/root/test_mpd.sh
new file mode 100755
index 0000000000..4cc6895602
--- /dev/null
+++ b/support/testing/tests/package/test_mpd/rootfs-overlay/root/test_mpd.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+mpd_command() {
+ mpd_result=""
+ mpd_state=""
+ printf "Execute %s" "$1"
+ while IFS= read -r line; do
+ case $line in
+ OK) mpd_result=$line ;;
+ OK\ MPD*) mpd_protocol=${line##* } ;;
+ state:*) mpd_state=${line##*: } ;;
+ ACK\ \[[0-9]*@[0-9]*\]*) mpd_error=${line##*\} } ;;
+ esac
+ done <<- EOF
+ $( ( echo "$1"; echo "close" ) | nc localhost 6600 )
+EOF
+
+ if [ "$mpd_result" != "OK" ]; then
+ printf "\nmpd protocol error: %s\n" "$mpd_error"
+ return 1
+ else
+ printf " [OK]\n"
+ fi
+
+ export mpd_protocol
+ export mpd_state
+}
+
+test_mpd() {
+ mpd_command "status" || return 1
+ printf "MPD protocol version: %s\n" "$mpd_protocol"
+}
+
+# run main function if invoked from a subshell
+[ "$0" = "-sh" ] || test_mpd
--
2.53.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Buildroot] [PATCH v3 1/2] package/mpd: use upstream mpd.conf w/ buildroot modifications
2026-08-27 3:26 ` [Buildroot] [PATCH v3 1/2] package/mpd: use upstream mpd.conf w/ buildroot modifications Andreas Ziegler
@ 2026-08-27 5:40 ` Thomas Petazzoni via buildroot
2026-08-28 2:53 ` Andreas Ziegler
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-08-27 5:40 UTC (permalink / raw)
To: Andreas Ziegler; +Cc: buildroot, Marcus Hoffmann
Hello Andreas,
On Thu, Aug 27, 2026 at 05:26:38AM +0200, Andreas Ziegler wrote:
> +# sed snippet from https://stackoverflow.com/a/37911473
> +# single-line configurations will be inserted behind the last matching line
> +# in the target file, multi-line blocks are just appended at the bottom.
> define MPD_INSTALL_EXTRA_FILES
> - $(INSTALL) -m 0644 -D package/mpd/mpd.conf $(TARGET_DIR)/etc/mpd.conf
> + $(INSTALL) -m 0644 -D $(@D)/doc/mpdconf.example $(TARGET_DIR)/etc/mpd.conf
> + export multiline=0
> + while read -r line; do \
> + if [[ $$line =~ ^[a-zA-Z] ]]; then \
> + if [ "$${line##*[[:space:]]}" == "{" ]; then \
> + export multiline=1; \
> + printf "%s\n" "$$line" >> "$(TARGET_DIR)"/etc/mpd.conf; \
> + else \
> + [ $$multiline ] && \
> + printf "\t%s\n" "$$line" >> "$(TARGET_DIR)"/etc/mpd.conf; \
> + [ ! $$multiline ] && \
> + sed '/#'$${line%%[[:space:]]*}'[^\n]*/,$$!b;//{x;//p;g};//!H;$$!d;x;s||&\n'"$$line"'|' -i "$(TARGET_DIR)"/etc/mpd.conf; \
> + fi \
> + elif [ "$$line" == "}" ]; then \
> + printf "%s\n" "$$line" >> "$(TARGET_DIR)"/etc/mpd.conf; \
> + export multiline=0; \
> + fi \
> + done < package/mpd/mpd.conf
I am sorry, but this is way too complicated for Buildroot's KISS
principle. Some much simpler approach needs to be found.
Best regards,
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Buildroot] [PATCH v3 1/2] package/mpd: use upstream mpd.conf w/ buildroot modifications
2026-08-27 5:40 ` Thomas Petazzoni via buildroot
@ 2026-08-28 2:53 ` Andreas Ziegler
0 siblings, 0 replies; 5+ messages in thread
From: Andreas Ziegler @ 2026-08-28 2:53 UTC (permalink / raw)
To: Thomas Petazzoni; +Cc: buildroot, Marcus Hoffmann
Ji Thomas,
On 2026-08-27 05:40, Thomas Petazzoni wrote:
> Hello Andreas,
>
> On Thu, Aug 27, 2026 at 05:26:38AM +0200, Andreas Ziegler wrote:
>> +# sed snippet from https://stackoverflow.com/a/37911473
>> +# single-line configurations will be inserted behind the last
>> matching line
>> +# in the target file, multi-line blocks are just appended at the
>> bottom.
>> define MPD_INSTALL_EXTRA_FILES
>> - $(INSTALL) -m 0644 -D package/mpd/mpd.conf
>> $(TARGET_DIR)/etc/mpd.conf
>> + $(INSTALL) -m 0644 -D $(@D)/doc/mpdconf.example
>> $(TARGET_DIR)/etc/mpd.conf
>> + export multiline=0
>> + while read -r line; do \
>> + if [[ $$line =~ ^[a-zA-Z] ]]; then \
>> + if [ "$${line##*[[:space:]]}" == "{" ]; then \
>> + export multiline=1; \
>> + printf "%s\n" "$$line" >> "$(TARGET_DIR)"/etc/mpd.conf; \
>> + else \
>> + [ $$multiline ] && \
>> + printf "\t%s\n" "$$line" >> "$(TARGET_DIR)"/etc/mpd.conf; \
>> + [ ! $$multiline ] && \
>> + sed
>> '/#'$${line%%[[:space:]]*}'[^\n]*/,$$!b;//{x;//p;g};//!H;$$!d;x;s||&\n'"$$line"'|'
>> -i "$(TARGET_DIR)"/etc/mpd.conf; \
>> + fi \
>> + elif [ "$$line" == "}" ]; then \
>> + printf "%s\n" "$$line" >> "$(TARGET_DIR)"/etc/mpd.conf; \
>> + export multiline=0; \
>> + fi \
>> + done < package/mpd/mpd.conf
>
> I am sorry, but this is way too complicated for Buildroot's KISS
> principle. Some much simpler approach needs to be found.
You might have a point: too much effort for a file that is probably
never used :-D
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
Kind regards,
Andreas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-28 2:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-27 3:26 [Buildroot] [PATCH v3 0/2] Add runtime test for mpd Andreas Ziegler
2026-08-27 3:26 ` [Buildroot] [PATCH v3 1/2] package/mpd: use upstream mpd.conf w/ buildroot modifications Andreas Ziegler
2026-08-27 5:40 ` Thomas Petazzoni via buildroot
2026-08-28 2:53 ` Andreas Ziegler
2026-08-27 3:26 ` [Buildroot] [PATCH v3 2/2] support/testing: add runtime test for mpd Andreas Ziegler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox