From 9dfed9aeec4bce30c327ae44f564e74ce28c2b44 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Thu, 26 Jul 2012 08:34:26 +0200 Subject: [PATCH] mmdevapi: be stricter about tests Dont care about broken drivers.. --- dlls/mmdevapi/tests/capture.c | 14 +++---- dlls/mmdevapi/tests/render.c | 91 +++++++++++++++++++------------------------ 2 files changed, 47 insertions(+), 58 deletions(-) diff --git a/dlls/mmdevapi/tests/capture.c b/dlls/mmdevapi/tests/capture.c index 96ddf77f2ab..6c087c47d5a 100644 --- a/dlls/mmdevapi/tests/capture.c +++ b/dlls/mmdevapi/tests/capture.c @@ -240,7 +240,7 @@ static void test_capture(IAudioClient *ac, HANDLE handle, WAVEFORMATEX *wfx) ok(hr == S_OK, "Valid IAudioCaptureClient_GetBuffer returns %08x\n", hr); ok(frames2 == frames, "GetBuffer after ReleaseBuffer(0) %u/%u\n", frames2, frames); ok(pos2 == pos, "Position after ReleaseBuffer(0) %u/%u\n", (UINT)pos2, (UINT)pos); - todo_wine ok(qpc2 == qpc, "HPC after ReleaseBuffer(0) %u vs. %u\n", (UINT)qpc2, (UINT)qpc); + ok(qpc2 == qpc, "HPC after ReleaseBuffer(0) %u vs. %u\n", (UINT)qpc2, (UINT)qpc); } /* trace after the GCP test because log output to MS-DOS console disturbs timing */ @@ -303,13 +303,13 @@ static void test_capture(IAudioClient *ac, HANDLE handle, WAVEFORMATEX *wfx) if(hr == S_OK){ /* The discontinuity is reported here, but is this an old or new packet? */ - todo_wine ok(flags & AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY, "expect DISCONTINUITY %x\n", flags); + ok(flags & AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY, "expect DISCONTINUITY %x\n", flags); ok(pad == next, "GCP %u vs. BufferSize %u\n", (UINT32)pad, next); /* Native's position is one period further than what we read. * Perhaps that's precisely the meaning of DATA_DISCONTINUITY: * signal when the position jump left a gap. */ - todo_wine ok(pos == sum + frames, "Position %u gap %d\n", + ok(pos == sum + frames, "Position %u gap %d\n", (UINT)pos, (UINT)pos - sum); if(flags & AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY) sum = pos; @@ -387,7 +387,7 @@ static void test_capture(IAudioClient *ac, HANDLE handle, WAVEFORMATEX *wfx) /* Only PulseAudio goes here; despite snd_pcm_drop it manages * to fill GetBufferSize with a single snd_pcm_read */ trace("Test marked todo: only PulseAudio gets here\n"); - todo_wine ok(flags & AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY, "expect DISCONTINUITY %x\n", flags); + ok(flags & AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY, "expect DISCONTINUITY %x\n", flags); /* Reset zeroes padding, not the position */ ok(pos >= sum, "Position %u last %u\n", (UINT)pos, sum); /*sum = pos; check after next GetBuffer */ @@ -423,7 +423,7 @@ static void test_capture(IAudioClient *ac, HANDLE handle, WAVEFORMATEX *wfx) /* Still receiving events! */ r = WaitForSingleObject(handle, 20); - todo_wine ok(r == WAIT_OBJECT_0, "Wait(event) after Stop gave %x\n", r); + ok(r == WAIT_OBJECT_0, "Wait(event) after Stop gave %x\n", r); hr = IAudioClient_Reset(ac); ok(hr == S_OK, "Reset failed: %08x\n", hr); @@ -431,13 +431,13 @@ static void test_capture(IAudioClient *ac, HANDLE handle, WAVEFORMATEX *wfx) ok(ResetEvent(handle), "ResetEvent\n"); r = WaitForSingleObject(handle, 120); - todo_wine ok(r == WAIT_OBJECT_0, "Wait(event) after Reset gave %x\n", r); + ok(r == WAIT_OBJECT_0, "Wait(event) after Reset gave %x\n", r); hr = IAudioClient_SetEventHandle(ac, NULL); ok(hr == E_INVALIDARG, "SetEventHandle(NULL) returns %08x\n", hr); r = WaitForSingleObject(handle, 70); - todo_wine ok(r == WAIT_OBJECT_0, "Wait(NULL event) gave %x\n", r); + ok(r == WAIT_OBJECT_0, "Wait(NULL event) gave %x\n", r); hr = IAudioClient_Start(ac); ok(hr == S_OK, "Start failed: %08x\n", hr); diff --git a/dlls/mmdevapi/tests/render.c b/dlls/mmdevapi/tests/render.c index e3335aede5e..665eaa50199 100644 --- a/dlls/mmdevapi/tests/render.c +++ b/dlls/mmdevapi/tests/render.c @@ -634,7 +634,7 @@ static void test_event(void) ok(hr == S_OK, "SetEventHandle failed: %08x\n", hr); hr = IAudioClient_SetEventHandle(ac, event); - todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_NAME), "SetEventHandle returns %08x\n", hr); + ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_NAME), "SetEventHandle returns %08x\n", hr); r = WaitForSingleObject(event, 40); ok(r == WAIT_TIMEOUT, "Wait(event) before Start gave %x\n", r); @@ -652,7 +652,7 @@ static void test_event(void) /* Still receiving events! */ r = WaitForSingleObject(event, 20); - todo_wine ok(r == WAIT_OBJECT_0, "Wait(event) after Stop gave %x\n", r); + ok(r == WAIT_OBJECT_0, "Wait(event) after Stop gave %x\n", r); hr = IAudioClient_Reset(ac); ok(hr == S_OK, "Reset failed: %08x\n", hr); @@ -660,13 +660,13 @@ static void test_event(void) ok(ResetEvent(event), "ResetEvent\n"); r = WaitForSingleObject(event, 120); - todo_wine ok(r == WAIT_OBJECT_0, "Wait(event) after Reset gave %x\n", r); + ok(r == WAIT_OBJECT_0, "Wait(event) after Reset gave %x\n", r); hr = IAudioClient_SetEventHandle(ac, NULL); ok(hr == E_INVALIDARG, "SetEventHandle(NULL) returns %08x\n", hr); r = WaitForSingleObject(event, 70); - todo_wine ok(r == WAIT_OBJECT_0, "Wait(NULL event) gave %x\n", r); + ok(r == WAIT_OBJECT_0, "Wait(NULL event) gave %x\n", r); /* test releasing a playing stream */ hr = IAudioClient_Start(ac); @@ -925,7 +925,7 @@ static void test_clock(int share) if (share) ok(gbsize == bufsize, "BufferSize %u at rate %u\n", gbsize, pwfx->nSamplesPerSec); - else todo_wine + else ok(gbsize == parts * fragment || gbsize == MulDiv(bufsize, 1, 1024) * 1024, "BufferSize %u misfits fragment size %u at rate %u\n", gbsize, fragment, pwfx->nSamplesPerSec); @@ -945,7 +945,7 @@ static void test_clock(int share) trace("Clock Frequency %u\n", (UINT)freq); /* MSDN says it's arbitrary units, but shared mode is unlikely to change */ - if (share) todo_wine + if (share) ok(freq == pwfx->nSamplesPerSec * pwfx->nBlockAlign, "Clock Frequency %u\n", (UINT)freq); else @@ -973,7 +973,7 @@ static void test_clock(int share) ok(hr == S_OK, "GetBuffer failed: %08x\n", hr); trace("data at %p\n", data); - hr = IAudioRenderClient_ReleaseBuffer(arc, avail, winetest_debug>2 ? + hr = IAudioRenderClient_ReleaseBuffer(arc, avail, winetest_interactive ? wave_generate_tone(pwfx, data, avail) : AUDCLNT_BUFFERFLAGS_SILENT); ok(hr == S_OK, "ReleaseBuffer failed: %08x\n", hr); if(hr == S_OK) sum += avail; @@ -1010,8 +1010,7 @@ static void test_clock(int share) ok(hr == S_OK, "GetPosition failed: %08x\n", hr); ok(pos >= last, "Position %u vs. last %u\n", (UINT)pos,(UINT)last); last = pos; - if(/*share &&*/ winetest_debug>1) todo_wine - ok(pos*1000/freq <= slept*1.1, "Position %u too far after stop %ums\n", (UINT)pos, slept); + ok(pos*1000/freq <= slept*1.1, "Position %u too far after stop %ums\n", (UINT)pos, slept); hr = IAudioClient_Start(ac); /* #2 */ ok(hr == S_OK, "Start failed: %08x\n", hr); @@ -1044,12 +1043,11 @@ static void test_clock(int share) ok(pos * pwfx->nSamplesPerSec <= sum * freq, "Position %u > written %u\n", (UINT)pos, sum); /* Prove that Stop must not drop frames (in shared mode). */ ok(pad ? pos > last : pos >= last, "Position %u vs. last %u\n", (UINT)pos,(UINT)last); - if (share && pad > 0 && winetest_debug>1) todo_wine + if (share && pad > 0) ok(pos*1000/freq <= slept*1.1, "Position %u too far after playing %ums\n", (UINT)pos, slept); /* in exclusive mode, testbot's w7 machines yield pos > sum-pad */ - if(/*share &&*/ winetest_debug>1) - ok(pos * pwfx->nSamplesPerSec == (sum-pad) * freq, - "Position %u after stop vs. %u padding\n", (UINT)pos, pad); + ok(pos * pwfx->nSamplesPerSec == (sum-pad) * freq, + "Position %u after stop vs. %u padding\n", (UINT)pos, pad); last = pos; Sleep(100); @@ -1077,7 +1075,7 @@ static void test_clock(int share) ok(hr == S_OK, "GetBuffer failed: %08x\n", hr); trace("data at %p\n", data); - hr = IAudioRenderClient_ReleaseBuffer(arc, avail, winetest_debug>2 ? + hr = IAudioRenderClient_ReleaseBuffer(arc, avail, winetest_interactive ? wave_generate_tone(pwfx, data, avail) : AUDCLNT_BUFFERFLAGS_SILENT); ok(hr == S_OK, "ReleaseBuffer failed: %08x\n", hr); if(hr == S_OK) sum += avail; @@ -1102,10 +1100,7 @@ static void test_clock(int share) trace("position %u past %ums sleep #3\n", (UINT)pos, slept); ok(pos > last, "Position %u vs. last %u\n", (UINT)pos,(UINT)last); ok(pos * pwfx->nSamplesPerSec <= sum * freq, "Position %u > written %u\n", (UINT)pos, sum); - if (winetest_debug>1) - ok(pos*1000/freq <= slept*1.1, "Position %u too far after playing %ums\n", (UINT)pos, slept); - else - skip("Rerun with WINETEST_DEBUG=2 for GetPosition tests.\n"); + ok(pos*1000/freq <= slept*1.1, "Position %u too far after playing %ums\n", (UINT)pos, slept); last = pos; hr = IAudioClient_Reset(ac); @@ -1123,11 +1118,10 @@ static void test_clock(int share) ok(pos >= last, "Position %u vs. last %u\n", (UINT)pos,(UINT)last); ok(pcpos > pcpos0, "pcpos should increase\n"); ok(pos * pwfx->nSamplesPerSec <= sum * freq, "Position %u > written %u\n", (UINT)pos, sum); - if (pad > 0 && winetest_debug>1) todo_wine + if (pad > 0) ok(pos*1000/freq <= slept*1.1, "Position %u too far after stop %ums\n", (UINT)pos, slept); - if(winetest_debug>1) - ok(pos * pwfx->nSamplesPerSec == (sum-pad) * freq, - "Position %u after stop vs. %u padding\n", (UINT)pos, pad); + ok(pos * pwfx->nSamplesPerSec == (sum-pad) * freq, + "Position %u after stop vs. %u padding\n", (UINT)pos, pad); last = pos; /* Begin the big loop */ @@ -1150,19 +1144,17 @@ static void test_clock(int share) ok(hr == S_OK, "GetBuffer failed: %08x\n", hr); trace("data at %p for prefill %u\n", data, avail); - if (winetest_debug>2) { - hr = IAudioClient_Stop(ac); - ok(hr == S_OK, "Stop failed: %08x\n", hr); + hr = IAudioClient_Stop(ac); + ok(hr == S_OK, "Stop failed: %08x\n", hr); - Sleep(20); - slept += 20; + Sleep(20); + slept += 20; - hr = IAudioClient_Reset(ac); - ok(hr == AUDCLNT_E_BUFFER_OPERATION_PENDING, "Reset failed: %08x\n", hr); + hr = IAudioClient_Reset(ac); + ok(hr == AUDCLNT_E_BUFFER_OPERATION_PENDING, "Reset failed: %08x\n", hr); - hr = IAudioClient_Start(ac); - ok(hr == S_OK, "Start failed: %08x\n", hr); - } + hr = IAudioClient_Start(ac); + ok(hr == S_OK, "Start failed: %08x\n", hr); /* Despite passed time, data must still point to valid memory... */ hr = IAudioRenderClient_ReleaseBuffer(arc, avail, @@ -1207,14 +1199,13 @@ static void test_clock(int share) trace("padding %u position %u/%u slept %ums iteration %d\n", pad, (UINT)pos, sum-pad, slept, i); ok(pad ? pos > last : pos >= last, "No position increase at iteration %d\n", i); ok(pos * pwfx->nSamplesPerSec <= sum * freq, "Position %u > written %u\n", (UINT)pos, sum); - if (winetest_debug>1) { - /* Padding does not lag behind by much */ - ok(pos * pwfx->nSamplesPerSec <= (sum-pad+fragment) * freq, "Position %u > written %u\n", (UINT)pos, sum); - ok(pos*1000/freq <= slept*1.1, "Position %u too far after %ums\n", (UINT)pos, slept); - if (pad) /* not in case of underrun */ - ok((pos-last)*1000/freq >= 90 && 110 >= (pos-last)*1000/freq, - "Position delta %ld not regular\n", (long)(pos-last)); - } + + /* Padding does not lag behind by much */ + ok(pos * pwfx->nSamplesPerSec <= (sum-pad+fragment) * freq, "Position %u > written %u\n", (UINT)pos, sum); + ok(pos*1000/freq <= slept*1.1, "Position %u too far after %ums\n", (UINT)pos, slept); + if (pad) /* not in case of underrun */ + ok((pos-last)*1000/freq >= 90 && 110 >= (pos-last)*1000/freq, + "Position delta %ld not regular\n", (long)(pos-last)); last = pos; hr = IAudioClient_GetStreamLatency(ac, &t1); @@ -1227,7 +1218,7 @@ static void test_clock(int share) /* ok(hr == AUDCLNT_E_BUFFER_TOO_LARGE || (hr == S_OK && i==0) without todo_wine */ ok(hr == S_OK || hr == AUDCLNT_E_BUFFER_TOO_LARGE, "GetBuffer large (%u) failed: %08x\n", avail, hr); - if(hr == S_OK && i) todo_wine ok(FALSE, "GetBuffer large (%u) at iteration %d\n", avail, i); + if(hr == S_OK && i) ok(FALSE, "GetBuffer large (%u) at iteration %d\n", avail, i); /* Only the first iteration should allow that large a buffer * as prefill was drained during the first 350+100ms sleep. * Afterwards, only 100ms of data should find room per iteration. */ @@ -2079,7 +2070,7 @@ static void test_worst_case(void) hr = IAudioClock_GetFrequency(acl, &freq); ok(hr == S_OK, "GetFrequency failed: %08x\n", hr); - for(j = 0; j <= (winetest_interactive ? 9 : 2); j++){ + for(j = 0; j < 10; j++){ sum = 0; trace("Should play %ums continuous tone with fragment size %u.\n", (ULONG)(defp/100), fragment); @@ -2088,15 +2079,13 @@ static void test_worst_case(void) ok(hr == S_OK, "GetPosition failed: %08x\n", hr); /* XAudio2 prefills one period, play without it */ - if(winetest_debug>2){ - hr = IAudioRenderClient_GetBuffer(arc, fragment, &data); - ok(hr == S_OK, "GetBuffer failed: %08x\n", hr); - - hr = IAudioRenderClient_ReleaseBuffer(arc, fragment, AUDCLNT_BUFFERFLAGS_SILENT); - ok(hr == S_OK, "ReleaseBuffer failed: %08x\n", hr); - if(hr == S_OK) - sum += fragment; - } + hr = IAudioRenderClient_GetBuffer(arc, fragment, &data); + ok(hr == S_OK, "GetBuffer failed: %08x\n", hr); + + hr = IAudioRenderClient_ReleaseBuffer(arc, fragment, AUDCLNT_BUFFERFLAGS_SILENT); + ok(hr == S_OK, "ReleaseBuffer failed: %08x\n", hr); + if(hr == S_OK) + sum += fragment; hr = IAudioClient_Start(ac); ok(hr == S_OK, "Start failed: %08x\n", hr); -- 2.11.4.GIT