From 44a81794dfc4e293f94654f2ef4dbfa0c5e81e95 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 8 Sep 2022 17:48:59 +0200 Subject: [PATCH] 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 --- 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 dcb5c852a92..f3e39f42b5f 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 = %08lx, expected E_PENDING or S_OK\n", hrResult); else - ok(hrResult == expect_hrResult, "hrResult = %08lx, expected: %08lx\n", - hrResult, expect_hrResult); + ok(hrResult == expect_hrResult || (test_abort && hrResult == S_OK), /* result can come in before the abort */ + "hrResult = %08lx, expected: %08lx\n", hrResult, expect_hrResult); if(SUCCEEDED(hrResult) || tested_protocol == FTP_TEST || test_abort || hrResult == INET_E_REDIRECT_FAILED) ok(dwError == ERROR_SUCCESS, "dwError = %ld, expected ERROR_SUCCESS\n", dwError); else @@ -3331,7 +3331,8 @@ static void test_protocol_terminate(IInternetProtocol *protocol) ok(hres == S_OK, "LockRequest failed: %08lx\n", hres); hres = IInternetProtocol_Read(protocol, buf, 1, &cb); - ok(hres == (test_abort ? S_OK : S_FALSE), "Read failed: %08lx\n", hres); + ok(hres == S_FALSE || (test_abort && hres == S_OK), /* result can come in before the abort */ + "Read failed: %08lx\n", hres); hres = IInternetProtocol_Terminate(protocol, 0); ok(hres == S_OK, "Terminate failed: %08lx\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)