[PATCH] tests: Fix qemuxml2xmltest with audio driver defined in env

Jim Fehlig posted 1 patch 1 week, 5 days ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20210401171028.29448-1-jfehlig@suse.com
tests/qemuxml2xmltest.c | 1 +
1 file changed, 1 insertion(+)

[PATCH] tests: Fix qemuxml2xmltest with audio driver defined in env

Posted by Jim Fehlig 1 week, 5 days ago
If QEMU_AUDIO_DRV is defined in the build host environment, several tests
in qemuxml2xmltest fail.

$ env | grep -i audio
AUDIODRIVER=pulseaudio
QEMU_AUDIO_DRV=pa
SDL_AUDIODRIVER=pulse

An example test failure with the above environment

907) QEMU XML-2-XML-active video-virtio-gpu-sdl-gl
In 'libvirt/tests/qemuxml2xmloutdata/video-virtio-gpu-sdl-gl.xml':
Offset 1244
Expect [v]
Actual [audio id='1' type='pulseaudio'/>
    <v]

Scrub QEMU_AUDIO_DRV from the environment before executing the tests in
qemuxml2xmltest.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
---

On IRC Daniel suggested scrubbing QEM_AUDIO_DRV and SDL_AUDIODRIVER.
Only QEM_AUDIO_DRV was needed to fix the test failure, but I can scrub
the other one too if that's preferred.

 tests/qemuxml2xmltest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 137f1871af..aff6ae9175 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -198,6 +198,7 @@ mymain(void)
      * using ADD_ENV_COPY, otherwise these tests may fail due to unexpected
      * values for these envvars */
     g_setenv("PATH", "/bin", TRUE);
+    g_unsetenv("QEMU_AUDIO_DRV");
 
     DO_TEST("minimal", NONE);
     DO_TEST_CAPS_LATEST("genid");
-- 
2.30.1


Re: [PATCH] tests: Fix qemuxml2xmltest with audio driver defined in env

Posted by Daniel P. Berrangé 1 week, 5 days ago
On Thu, Apr 01, 2021 at 11:10:28AM -0600, Jim Fehlig wrote:
> If QEMU_AUDIO_DRV is defined in the build host environment, several tests
> in qemuxml2xmltest fail.
> 
> $ env | grep -i audio
> AUDIODRIVER=pulseaudio
> QEMU_AUDIO_DRV=pa
> SDL_AUDIODRIVER=pulse
> 
> An example test failure with the above environment
> 
> 907) QEMU XML-2-XML-active video-virtio-gpu-sdl-gl
> In 'libvirt/tests/qemuxml2xmloutdata/video-virtio-gpu-sdl-gl.xml':
> Offset 1244
> Expect [v]
> Actual [audio id='1' type='pulseaudio'/>
>     <v]
> 
> Scrub QEMU_AUDIO_DRV from the environment before executing the tests in
> qemuxml2xmltest.
> 
> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
> ---
> 
> On IRC Daniel suggested scrubbing QEM_AUDIO_DRV and SDL_AUDIODRIVER.
> Only QEM_AUDIO_DRV was needed to fix the test failure, but I can scrub
> the other one too if that's preferred.

I think we should do both as qemu_domain.c will look at SDL_AUDIODRIVER
if $QEMU_AUDIO_DRV == sdl

> 
>  tests/qemuxml2xmltest.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
> index 137f1871af..aff6ae9175 100644
> --- a/tests/qemuxml2xmltest.c
> +++ b/tests/qemuxml2xmltest.c
> @@ -198,6 +198,7 @@ mymain(void)
>       * using ADD_ENV_COPY, otherwise these tests may fail due to unexpected
>       * values for these envvars */
>      g_setenv("PATH", "/bin", TRUE);
> +    g_unsetenv("QEMU_AUDIO_DRV");
>  
>      DO_TEST("minimal", NONE);
>      DO_TEST_CAPS_LATEST("genid");
> -- 
> 2.30.1
> 
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|