Module: wine Branch: oldstable Commit: 7db96e3a5925946c2b36cfab9b71f3ed07246198 URL: https://gitlab.winehq.org/wine/wine/-/commit/7db96e3a5925946c2b36cfab9b71f3e...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Sep 8 17:48:59 2022 +0200
urlmon/tests: Fix race condition in abort test.
The result can arrive before we have time to abort.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53268 (cherry picked from commit 44a81794dfc4e293f94654f2ef4dbfa0c5e81e95) Conflicts: dlls/urlmon/tests/protocol.c Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
dlls/urlmon/tests/protocol.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/dlls/urlmon/tests/protocol.c b/dlls/urlmon/tests/protocol.c index b997be7fa01..d202fd9275a 100644 --- a/dlls/urlmon/tests/protocol.c +++ b/dlls/urlmon/tests/protocol.c @@ -1193,8 +1193,8 @@ static HRESULT WINAPI ProtocolSink_ReportResult(IInternetProtocolSink *iface, HR if(tested_protocol == FTP_TEST) ok(hrResult == E_PENDING || hrResult == S_OK, "hrResult = %08x, expected E_PENDING or S_OK\n", hrResult); else - ok(hrResult == expect_hrResult, "hrResult = %08x, expected: %08x\n", - hrResult, expect_hrResult); + ok(hrResult == expect_hrResult || (test_abort && hrResult == S_OK), /* result can come in before the abort */ + "hrResult = %08x, expected: %08x\n", hrResult, expect_hrResult); if(SUCCEEDED(hrResult) || tested_protocol == FTP_TEST || test_abort || hrResult == INET_E_REDIRECT_FAILED) ok(dwError == ERROR_SUCCESS, "dwError = %d, expected ERROR_SUCCESS\n", dwError); else @@ -3331,7 +3331,8 @@ static void test_protocol_terminate(IInternetProtocol *protocol) ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
hres = IInternetProtocol_Read(protocol, buf, 1, &cb); - ok(hres == (test_abort ? S_OK : S_FALSE), "Read failed: %08x\n", hres); + ok(hres == S_FALSE || (test_abort && hres == S_OK), /* result can come in before the abort */ + "Read failed: %08x\n", hres);
hres = IInternetProtocol_Terminate(protocol, 0); ok(hres == S_OK, "Terminate failed: %08x\n", hres); @@ -3421,7 +3422,7 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym return; }
- if(!direct_read && !test_abort && !bind_from_cache) + if(!direct_read && !bind_from_cache) SET_EXPECT(ReportResult);
if(flags & TEST_DISABLEAUTOREDIRECT)