[PATCH 0/1] MR11080: dsound/tests: Don't fail test if device cannot be opened the second time.
Followup of fc627e04d3 and ebc31cfbee. Since 2026-05-13 (or the day before) there is a single failure with the linux testbot VMs showing: ``` dsound.c:330: Test failed: DirectSoundCreate() failed: 8889000a ``` I could this reproduce inside a minimal Debian bookworm VM, after stopping pulseaudio: ``` systemctl --user stop pulseaudio.service pulseaudio.socket ``` Is there a better way to detect alsa not being able to open multiple times, and base skipping the test on this? CC: @jonkoops [Test pattern page dsound:dsound](https://test.winehq.org/data/patterns.html#dsound:dsound) [Test pattern page dsound:dsound8](https://test.winehq.org/data/patterns.html#dsound:dsound8) [Testbot run with dsound part of this patch](https://testbot.winehq.org/JobDetails.pl?Key=163251) [Testbot run with dsound part of this patch](https://testbot.winehq.org/JobDetails.pl?Key=163252) <details> <summary>Backtrace where the error AUDCLNT_E_DEVICE_IN_USE gets set</summary> ``` Thread 1 "dsound_test.exe" hit Breakpoint 2.1, alsa_open_device (alsa_name=0x7ffffe926140 "plughw:0,0", flow=<optimized out>, pcm_handle=pcm_handle@entry=0x7ffffe10fbb8, hw_params=hw_params@entry=0x7ffffe10fbb0) at .../wine/dlls/winealsa.drv/alsa.c:593 593 WARN("Unable to open PCM \"%s\": %d (%s)\n", alsa_name, err, snd_strerror(err)); (gdb) list 588 else 589 return E_UNEXPECTED; 590 591 err = snd_pcm_open(pcm_handle, alsa_name, pcm_stream, SND_PCM_NONBLOCK); 592 if(err < 0){ 593 WARN("Unable to open PCM \"%s\": %d (%s)\n", alsa_name, err, snd_strerror(err)); 594 switch(err){ 595 case -EBUSY: 596 return AUDCLNT_E_DEVICE_IN_USE; 597 default: (gdb) print err $1 = -16 (gdb) source .../wine/tools/gdbunwind.py (gdb) bt #0 alsa_open_device (alsa_name=0x7ffffe926140 "plughw:0,0", flow=<optimized out>, pcm_handle=pcm_handle@entry=0x7ffffe10fbb8, hw_params=hw_params@entry=0x7ffffe10fbb0) at .../wine/dlls/winealsa.drv/alsa.c:593 #1 0x00007f671ab48e2e in alsa_get_mix_format (args=0x7ffffe30f390) at .../wine/dlls/winealsa.drv/alsa.c:1937 #2 0x00007f671ef69c8a in __wine_unix_call_dispatcher () from .../obj/dlls/ntdll/ntdll.so #3 0x00006ffffcaebd6a in __wine_unix_call (args=0x7ffffe30f3a0, code=16, handle=<optimized out>) at .../wine/include/wine/unixlib.h:297 #4 wine_unix_call (args=0x7ffffe30f3a0, code=16) at .../wine/dlls/mmdevapi/mmdevapi_private.h:117 #5 client_GetMixFormat (iface=0x7ffffe928260, pwfx=0x7ffffe30f430) at .../wine/dlls/mmdevapi/client.c:881 #6 0x00006ffffd8c58f6 in IAudioClient_GetMixFormat (ppDeviceFormat=0x7ffffe30f470, This=<optimized out>) at include/audioclient.h:409 #7 DSOUND_WaveFormat (wfx=<synthetic pointer>, forcewave=0, client=<optimized out>, device=0x7ffffe928040) at .../wine/dlls/dsound/primary.c:129 #8 DSOUND_ReopenDevice (device=0x7ffffe928040, forcewave=forcewave@entry=0) at .../wine/dlls/dsound/primary.c:290 #9 0x00006ffffd8cc155 in DirectSoundDevice_Initialize (lpcGUID=<optimized out>, ppDevice=<optimized out>) at .../wine/dlls/dsound/dsound.c:280 #10 IDirectSound8Impl_Initialize (iface=0x7ffffe926648, lpcGuid=<optimized out>) at .../wine/dlls/dsound/dsound.c:866 #11 0x00006ffffd8c7b88 in DirectSoundCreate (lpcGUID=lpcGUID@entry=0x7ffffe926490, ppDS=0x7ffffe30f6b0, ppDS@entry=0x7ffffe30f6d0, pUnkOuter=pUnkOuter@entry=0x0) at .../wine/dlls/dsound/dsound.c:988 #12 0x0000000140021920 in test_dsound (lpGuid=lpGuid@entry=0x7ffffe926490) at .../wine/dlls/dsound/tests/dsound.c:329 #13 0x000000014000d14b in dsenum_callback (lpGuid=0x7ffffe926490, lpcstrDescription=0x7ffffe9264c0 "Speakers (Out: HDA Intel - Generic Analog)", lpcstrModule=0x7ffffe926540 "{0.0.0.00000000}.{0AE1A760-0EE4-4313-B9B0-9AD613E8DF6B}", lpContext=<optimized out>) at .../wine/dlls/dsound/tests/dsound.c:2006 #14 0x00006ffffd8d6156 in a_to_w_callback (guid=0x7ffffe926490, descW=<optimized out>, modW=0x7ffffe33bd80 L"\173\060\056\060\056\060\056\060\060\060\060\060\060\060\060\175\056\173\060\101\105\061\101\067\066\060\055\060\105\105\064\055\064\063\061\063\055\102\071\102\060\055\071\101\104\066\061\063\105\070\104\106\066\102", <incomplete sequence \175>, data=0x7ffffe30fc00) at .../wine/dlls/dsound/dsound_main.c:298 #15 0x00006ffffd8d9488 in send_device (device=0x7ffffe336e30, guid=guid@entry=0x7ffffe926490, cb=cb@entry=0x6ffffd8d6020 <a_to_w_callback>, user=0x7ffffe30fc00, user@entry=0x7ffffe30fc28) at .../wine/dlls/dsound/dsound_main.c:427 #16 0x00006ffffd8d6f6f in enumerate_mmdevices (flow=flow@entry=eRender, guids=0x7ffffe926480, cb=cb@entry=0x6ffffd8d6020 <a_to_w_callback>, user=0x7ffffe30fc28, user@entry=0x7ffffe30fc00) at .../wine/dlls/dsound/dsound_main.c:508 #17 0x00006ffffd8c81ac in DirectSoundEnumerateW (lpDSEnumCallback=lpDSEnumCallback@entry=0x6ffffd8d6020 <a_to_w_callback>, lpContext=lpContext@entry=0x7ffffe30fc00) at .../wine/dlls/dsound/dsound_main.c:552 #18 0x00006ffffd8c8135 in DirectSoundEnumerateA (lpDSEnumCallback=lpDSEnumCallback@entry=0x14000d0e0 <dsenum_callback>, lpContext=lpContext@entry=0x0) at .../wine/dlls/dsound/dsound_main.c:332 #19 0x0000000140014818 in dsound_tests () at .../wine/dlls/dsound/tests/dsound.c:2032 #20 func_dsound () at .../wine/dlls/dsound/tests/dsound.c:2257 #21 0x00000001400185c3 in run_test (name=0x7ffffe33e7cf "dsound") at .../wine/include/wine/test.h:780 #22 main (argc=<optimized out>, argv=<optimized out>) at .../wine/include/wine/test.h:900 (gdb) ``` </details> -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11080
From: Bernhard Übelacker <bernhardu@mailbox.org> Followup of fc627e04d3 and ebc31cfbee. --- dlls/dsound/tests/dsound.c | 9 ++++++++- dlls/dsound/tests/dsound8.c | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c index 44b5136d7be..ed5c1925e37 100644 --- a/dlls/dsound/tests/dsound.c +++ b/dlls/dsound/tests/dsound.c @@ -291,6 +291,9 @@ static void IDirectSound_tests(void) IDirectSound_Release(dso); } +#define AUDCLNT_ERR(n) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_AUDCLNT, n) +#define AUDCLNT_E_DEVICE_IN_USE AUDCLNT_ERR(0x0a) + static HRESULT test_dsound(LPGUID lpGuid) { HRESULT rc; @@ -327,7 +330,11 @@ static HRESULT test_dsound(LPGUID lpGuid) /* Create a second DirectSound object */ rc = DirectSoundCreate(lpGuid, &dso1, NULL); - ok(rc==DS_OK,"DirectSoundCreate() failed: %08lx\n",rc); + /* Running without pulseaudio can't open twice. */ + if (rc==AUDCLNT_E_DEVICE_IN_USE) + skip("Failed to open device a second time, skipping test.\n"); + else + ok(rc==DS_OK,"DirectSoundCreate() failed: %08lx\n",rc); if (rc==DS_OK) { /* Release the second DirectSound object */ ref=IDirectSound_Release(dso1); diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c index 07b10af45e0..1b363b9ad7b 100644 --- a/dlls/dsound/tests/dsound8.c +++ b/dlls/dsound/tests/dsound8.c @@ -311,7 +311,11 @@ static HRESULT test_dsound8(LPGUID lpGuid) /* Create a second DirectSound8 object */ rc = DirectSoundCreate8(lpGuid, &dso1, NULL); - ok(rc==DS_OK,"DirectSoundCreate8() failed: %08lx\n",rc); + /* Running without pulseaudio can't open twice. */ + if (rc==AUDCLNT_E_DEVICE_IN_USE) + skip("Failed to open device a second time, skipping test.\n"); + else + ok(rc==DS_OK,"DirectSoundCreate8() failed: %08lx\n",rc); if (rc==DS_OK) { /* Release the second DirectSound8 object */ ref=IDirectSound8_Release(dso1); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11080
participants (2)
-
Bernhard Übelacker -
Bernhard Übelacker (@bernhardu)