tests: Fix qemuxml2xmltest with audio driver defined in env

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. SDL_AUDIODRIVER also needs scrubbed since it will be
examined if QEMU_AUDIO_DRV=sdl.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Jim Fehlig 2021-04-01 10:57:36 -06:00
parent 8dac0ca1b2
commit ad3d6438fa

View File

@ -198,6 +198,8 @@ 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");
g_unsetenv("SDL_AUDIODRIVER");
DO_TEST("minimal", NONE);
DO_TEST_CAPS_LATEST("genid");