[PATCH] tests: don't build audio tests when no audio drivers are enabled

Anton Kuchin posted 1 patch 5 days, 21 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/DB8P190MB07142E1BA8DEEA8B2E41D5B2DB57A@DB8P190MB0714.EURP190.PROD.OUTLOOK.COM
Maintainers: Gerd Hoffmann <kraxel@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>
tests/audio/meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] tests: don't build audio tests when no audio drivers are enabled
Posted by Anton Kuchin 5 days, 21 hours ago
When there are no audio drivers configure fails with "ERROR: Command
cannot have '@INPUT@', since no input files were specified".

Fixes: 3220b38a8d ("tests: start manual audio backend test")
Signed-off-by: Anton Kuchin <antonkuchin@nebius.com>
---
 tests/audio/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/audio/meson.build b/tests/audio/meson.build
index 84754bde22..322755b880 100644
--- a/tests/audio/meson.build
+++ b/tests/audio/meson.build
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-or-later

-if not have_system
+if not have_system or audio_modinfo_files.length() == 0
   subdir_done()
 endif

-- 
2.34.1
Re: [PATCH] tests: don't build audio tests when no audio drivers are enabled
Posted by Marc-André Lureau 3 days, 3 hours ago
Hi

On Fri, Mar 27, 2026 at 8:46 PM Anton Kuchin <antonkuchin@nebius.com> wrote:
>
> When there are no audio drivers configure fails with "ERROR: Command
> cannot have '@INPUT@', since no input files were specified".
>

thanks for the report

> Fixes: 3220b38a8d ("tests: start manual audio backend test")
> Signed-off-by: Anton Kuchin <antonkuchin@nebius.com>
> ---
>  tests/audio/meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/audio/meson.build b/tests/audio/meson.build
> index 84754bde22..322755b880 100644
> --- a/tests/audio/meson.build
> +++ b/tests/audio/meson.build
> @@ -1,6 +1,6 @@
>  # SPDX-License-Identifier: GPL-2.0-or-later
>
> -if not have_system
> +if not have_system or audio_modinfo_files.length() == 0

audio_modinfo_files is only populated and used when modules are
enabled though, so this should only be checked in this case

thanks
Re: [PATCH] tests: don't build audio tests when no audio drivers are enabled
Posted by Marc-André Lureau 3 days, 3 hours ago
Hi

On Mon, Mar 30, 2026 at 2:12 PM Marc-André Lureau
<marcandre.lureau@redhat.com> wrote:
>
> Hi
>
> On Fri, Mar 27, 2026 at 8:46 PM Anton Kuchin <antonkuchin@nebius.com> wrote:
> >
> > When there are no audio drivers configure fails with "ERROR: Command
> > cannot have '@INPUT@', since no input files were specified".
> >
>
> thanks for the report
>
> > Fixes: 3220b38a8d ("tests: start manual audio backend test")
> > Signed-off-by: Anton Kuchin <antonkuchin@nebius.com>
> > ---
> >  tests/audio/meson.build | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tests/audio/meson.build b/tests/audio/meson.build
> > index 84754bde22..322755b880 100644
> > --- a/tests/audio/meson.build
> > +++ b/tests/audio/meson.build
> > @@ -1,6 +1,6 @@
> >  # SPDX-License-Identifier: GPL-2.0-or-later
> >
> > -if not have_system
> > +if not have_system or audio_modinfo_files.length() == 0
>
> audio_modinfo_files is only populated and used when modules are
> enabled though, so this should only be checked in this case

Could you check if this is good enough and resend:
-if not have_system or audio_modinfo_files.length() == 0
+if not have_system
   subdir_done()
 endif

 modinfo_dep = not_found
-if enable_modules
+if enable_modules and audio_modinfo_files.length() != 0
     modinfo_src = custom_target('modinfo.c',
                                 output: 'modinfo.c',
                                 input: audio_modinfo_files,
Re: [PATCH] tests: don't build audio tests when no audio drivers are enabled
Posted by Anton Kuchin 2 days, 22 hours ago
Hi Marc-André!
Thanks for the quick review.

> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> Sent: Monday, March 30, 2026 12:27:29 pm
> 
> Could you check if this is good enough and resend:
> -if not have_system or audio_modinfo_files.length() == 0
> +if not have_system
>    subdir_done()
>  endif
> 
>  modinfo_dep = not_found
> -if enable_modules
> +if enable_modules and audio_modinfo_files.length() != 0
>      modinfo_src = custom_target('modinfo.c',
>                                  output: 'modinfo.c',
>                                  input: audio_modinfo_files,

I checked this and configure passes, but then build fails with:

FAILED: tests/audio/test-audio 
clang -m64  -o tests/audio/test-audio libqemuaudio.a.p/audio_audio.c.o libqemuaudio.a.p/audio_audio-be.c.o libqemuaudio.a.p/audio_audio-mixeng-be.c.o libqemuaudio.a.p/audio_mixeng.c.o libqemuaudio.a.p/audio_noaudio.c.o libqemuaudio.a.p/audio_wavaudio.c.o libqom.a.p/qom_container.c.o libqom.a.p/qom_object.c.o libqom.a.p/qom_object_interfaces.c.o libqom.a.p/qom_qom-qobject.c.o libevent-loop-base.a.p/event-loop-base.c.o tests/audio/test-audio.p/test-audio.c.o tests/audio/test-audio.p/audio-stubs.c.o -Wl,--as-needed -Wl,--no-undefined -pie -Wl,-z,relro -Wl,-z,now -g -O2 -fdebug-prefix-map=/home/antonkuchin/src/qemu-upstream/build-with-fix/..=. -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -DVENDOR_UBUNTU -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed -Wl,--start-group libqemuutil.a subprojects/libvhost-user/libvhost-user-glib.a subprojects/libvhost-user/libvhost-user.a -lnuma /usr/lib/x86_64-linux-gnu/libglib-2.0.so -Wl,--export-dynamic /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so -pthread /usr/lib/x86_64-linux-gnu/libgnutls.so -lm /usr/lib/x86_64-linux-gnu/libpixman-1.so -Wl,--end-group
/usr/bin/ld: tests/audio/test-audio.p/test-audio.c.o: in function `main':
/home/antonkuchin/src/qemu-upstream/build-with-fix/../tests/audio/test-audio.c:588:(.text+0xff): undefined reference to `qemu_modinfo'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I think that's because "executable('test-audio',..." is outside of conditional block and it doesn't work with "modinfo_dep = not_found".
If I move "executable('test-audio',..." inside the block configure and build work but I'm not sure if this is what we want here.
From the structure of the original patch I assume that test-audio is supposed to be built even when enable_modules is False. Does it?
Or should we build test-audio only when modules are enabled?

--
Anton
Re: [PATCH] tests: don't build audio tests when no audio drivers are enabled
Posted by Marc-André Lureau 2 days, 4 hours ago
Hi

On Mon, Mar 30, 2026 at 7:30 PM Anton Kuchin <antonkuchin@nebius.com> wrote:
>
> Hi Marc-André!
> Thanks for the quick review.
>
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> > Sent: Monday, March 30, 2026 12:27:29 pm
> >
> > Could you check if this is good enough and resend:
> > -if not have_system or audio_modinfo_files.length() == 0
> > +if not have_system
> >    subdir_done()
> >  endif
> >
> >  modinfo_dep = not_found
> > -if enable_modules
> > +if enable_modules and audio_modinfo_files.length() != 0
> >      modinfo_src = custom_target('modinfo.c',
> >                                  output: 'modinfo.c',
> >                                  input: audio_modinfo_files,
>
> I checked this and configure passes, but then build fails with:
>
> FAILED: tests/audio/test-audio
> clang -m64  -o tests/audio/test-audio libqemuaudio.a.p/audio_audio.c.o libqemuaudio.a.p/audio_audio-be.c.o libqemuaudio.a.p/audio_audio-mixeng-be.c.o libqemuaudio.a.p/audio_mixeng.c.o libqemuaudio.a.p/audio_noaudio.c.o libqemuaudio.a.p/audio_wavaudio.c.o libqom.a.p/qom_container.c.o libqom.a.p/qom_object.c.o libqom.a.p/qom_object_interfaces.c.o libqom.a.p/qom_qom-qobject.c.o libevent-loop-base.a.p/event-loop-base.c.o tests/audio/test-audio.p/test-audio.c.o tests/audio/test-audio.p/audio-stubs.c.o -Wl,--as-needed -Wl,--no-undefined -pie -Wl,-z,relro -Wl,-z,now -g -O2 -fdebug-prefix-map=/home/antonkuchin/src/qemu-upstream/build-with-fix/..=. -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -DVENDOR_UBUNTU -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed -Wl,--start-group libqemuutil.a subprojects/libvhost-user/libvhost-user-glib.a subprojects/libvhost-user/libvhost-user.a -lnuma /usr/lib/x86_64-linux-gnu/libglib-2.0.so -Wl,--export-dynamic /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so -pthread /usr/lib/x86_64-linux-gnu/libgnutls.so -lm /usr/lib/x86_64-linux-gnu/libpixman-1.so -Wl,--end-group
> /usr/bin/ld: tests/audio/test-audio.p/test-audio.c.o: in function `main':
> /home/antonkuchin/src/qemu-upstream/build-with-fix/../tests/audio/test-audio.c:588:(.text+0xff): undefined reference to `qemu_modinfo'
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
>
> I think that's because "executable('test-audio',..." is outside of conditional block and it doesn't work with "modinfo_dep = not_found".
> If I move "executable('test-audio',..." inside the block configure and build work but I'm not sure if this is what we want here.
> From the structure of the original patch I assume that test-audio is supposed to be built even when enable_modules is False. Does it?

yes, both cases should work.

There are two issues with empty modinfo atm:
1. modinfo-generate.py requires non-empty modinfo files list
2. meson @INPUT@ require non-empty list

I will modify your patch this way, I tested it works and will send it for merge:
--- /dev/null
+++ b/tests/audio/modinfo-stub.c
@@ -0,0 +1,5 @@
+#include "qemu/osdep.h"
+#include "qemu/module.h"
+const QemuModinfo qemu_modinfo[] = {
+  { /* end of list */ }
+};
diff --git a/tests/audio/meson.build b/tests/audio/meson.build
index 84754bde221..be96313a63e 100644
--- a/tests/audio/meson.build
+++ b/tests/audio/meson.build
@@ -6,12 +6,14 @@ endif

 modinfo_dep = not_found
 if enable_modules
-    modinfo_src = custom_target('modinfo.c',
-                                output: 'modinfo.c',
-                                input: audio_modinfo_files,
-                                command: [modinfo_generate,
'--skip-missing-deps', '@INPUT@'],
-                                capture: true)
-
+    modinfo_src = 'modinfo-stub.c'
+    if audio_modinfo_files.length() != 0
+        modinfo_src = custom_target('modinfo.c',
+                                    output: 'modinfo.c',
+                                    input: audio_modinfo_files,
+                                    command: [modinfo_generate,
'--skip-missing-deps', '@INPUT@'],
+                                    capture: true)
+    endif
     modinfo_lib = static_library('modinfo.c', modinfo_src)


> Or should we build test-audio only when modules are enabled?
>
> --
> Anton



-- 
Marc-André Lureau