ole32/tests: Avoid infinite waits in tests.
This commit is contained in:
parent
8c0eec2c6b
commit
9b2e414e91
|
@ -233,7 +233,7 @@ static DWORD CALLBACK ole_initialize_thread(LPVOID pv)
|
|||
hr = pCoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||
|
||||
SetEvent(info->wait);
|
||||
WaitForSingleObject(info->stop, INFINITE);
|
||||
WaitForSingleObject(info->stop, 10000);
|
||||
|
||||
CoUninitialize();
|
||||
return hr;
|
||||
|
@ -281,7 +281,7 @@ static void test_CoCreateInstance(void)
|
|||
thread = CreateThread(NULL, 0, ole_initialize_thread, &info, 0, &tid);
|
||||
ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
|
||||
|
||||
WaitForSingleObject(info.wait, INFINITE);
|
||||
ok( !WaitForSingleObject(info.wait, 10000 ), "wait timed out\n" );
|
||||
|
||||
pUnk = (IUnknown *)0xdeadbeef;
|
||||
hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
|
||||
|
@ -289,7 +289,7 @@ static void test_CoCreateInstance(void)
|
|||
if (pUnk) IUnknown_Release(pUnk);
|
||||
|
||||
SetEvent(info.stop);
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
|
||||
|
||||
GetExitCodeThread(thread, &exitcode);
|
||||
hr = exitcode;
|
||||
|
@ -330,7 +330,7 @@ static void test_CoGetClassObject(void)
|
|||
thread = CreateThread(NULL, 0, ole_initialize_thread, &info, 0, &tid);
|
||||
ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
|
||||
|
||||
WaitForSingleObject(info.wait, INFINITE);
|
||||
ok( !WaitForSingleObject(info.wait, 10000), "wait timed out\n" );
|
||||
|
||||
pUnk = (IUnknown *)0xdeadbeef;
|
||||
hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
|
||||
|
@ -343,7 +343,7 @@ static void test_CoGetClassObject(void)
|
|||
}
|
||||
|
||||
SetEvent(info.stop);
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
|
||||
|
||||
GetExitCodeThread(thread, &exitcode);
|
||||
hr = exitcode;
|
||||
|
@ -949,7 +949,7 @@ static void test_registered_object_thread_affinity(void)
|
|||
|
||||
thread = CreateThread(NULL, 0, get_class_object_thread, (LPVOID)CLSCTX_INPROC_SERVER, 0, &tid);
|
||||
ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
|
||||
GetExitCodeThread(thread, &exitcode);
|
||||
hr = exitcode;
|
||||
ok(hr == REGDB_E_CLASSNOTREG, "CoGetClassObject on inproc object "
|
||||
|
@ -962,7 +962,7 @@ static void test_registered_object_thread_affinity(void)
|
|||
|
||||
thread = CreateThread(NULL, 0, register_class_object_thread, NULL, 0, &tid);
|
||||
ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
ok ( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
|
||||
GetExitCodeThread(thread, &exitcode);
|
||||
hr = exitcode;
|
||||
ok(hr == S_OK, "CoRegisterClassObject with same CLSID but in different thread should return S_OK instead of 0x%08x\n", hr);
|
||||
|
@ -978,7 +978,7 @@ static void test_registered_object_thread_affinity(void)
|
|||
|
||||
thread = CreateThread(NULL, 0, get_class_object_proxy_thread, (LPVOID)CLSCTX_LOCAL_SERVER, 0, &tid);
|
||||
ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
|
||||
while (MsgWaitForMultipleObjects(1, &thread, FALSE, INFINITE, QS_ALLINPUT) == WAIT_OBJECT_0 + 1)
|
||||
while (MsgWaitForMultipleObjects(1, &thread, FALSE, 10000, QS_ALLINPUT) == WAIT_OBJECT_0 + 1)
|
||||
{
|
||||
MSG msg;
|
||||
while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
|
||||
|
@ -999,7 +999,7 @@ static void test_registered_object_thread_affinity(void)
|
|||
|
||||
thread = CreateThread(NULL, 0, revoke_class_object_thread, (LPVOID)(DWORD_PTR)cookie, 0, &tid);
|
||||
ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
|
||||
GetExitCodeThread(thread, &exitcode);
|
||||
hr = exitcode;
|
||||
ok(hr == RPC_E_WRONG_THREAD, "CoRevokeClassObject called from different "
|
||||
|
@ -1007,7 +1007,7 @@ static void test_registered_object_thread_affinity(void)
|
|||
|
||||
thread = CreateThread(NULL, 0, register_class_object_thread, NULL, 0, &tid);
|
||||
ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
|
||||
GetExitCodeThread(thread, &exitcode);
|
||||
hr = exitcode;
|
||||
ok(hr == S_OK, "CoRegisterClassObject with same CLSID but in different "
|
||||
|
@ -1061,7 +1061,7 @@ static void test_CoFreeUnusedLibraries(void)
|
|||
ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
|
||||
|
||||
thread = CreateThread(NULL, 0, free_libraries_thread, NULL, 0, &tid);
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
|
||||
CloseHandle(thread);
|
||||
|
||||
ok(is_module_loaded("urlmon.dll"), "urlmon.dll should be loaded\n");
|
||||
|
@ -1108,7 +1108,7 @@ static void test_CoGetObjectContext(void)
|
|||
thread = CreateThread(NULL, 0, ole_initialize_thread, &info, 0, &tid);
|
||||
ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
|
||||
|
||||
WaitForSingleObject(info.wait, INFINITE);
|
||||
ok( !WaitForSingleObject(info.wait, 10000), "wait timed out\n" );
|
||||
|
||||
pComThreadingInfo = NULL;
|
||||
hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&pComThreadingInfo);
|
||||
|
@ -1116,7 +1116,7 @@ static void test_CoGetObjectContext(void)
|
|||
IComThreadingInfo_Release(pComThreadingInfo);
|
||||
|
||||
SetEvent(info.stop);
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
|
||||
|
||||
GetExitCodeThread(thread, &exitcode);
|
||||
hr = exitcode;
|
||||
|
@ -1320,7 +1320,7 @@ static void test_CoGetContextToken(void)
|
|||
thread = CreateThread(NULL, 0, ole_initialize_thread, &info, 0, &tid);
|
||||
ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
|
||||
|
||||
WaitForSingleObject(info.wait, INFINITE);
|
||||
ok( !WaitForSingleObject(info.wait, 10000), "wait timed out\n" );
|
||||
|
||||
token = 0;
|
||||
hr = pCoGetContextToken(&token);
|
||||
|
@ -1328,7 +1328,7 @@ static void test_CoGetContextToken(void)
|
|||
IUnknown_Release((IUnknown *)token);
|
||||
|
||||
SetEvent(info.stop);
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
|
||||
|
||||
GetExitCodeThread(thread, &exitcode);
|
||||
hr = exitcode;
|
||||
|
|
|
@ -276,7 +276,7 @@ static DWORD start_host_object2(IStream *stream, REFIID riid, IUnknown *object,
|
|||
*thread = CreateThread(NULL, 0, host_object_proc, data, 0, &tid);
|
||||
|
||||
/* wait for marshaling to complete before returning */
|
||||
WaitForSingleObject(marshal_event, INFINITE);
|
||||
ok( !WaitForSingleObject(marshal_event, 10000), "wait timed out\n" );
|
||||
CloseHandle(marshal_event);
|
||||
|
||||
return tid;
|
||||
|
@ -293,7 +293,7 @@ static void release_host_object(DWORD tid)
|
|||
{
|
||||
HANDLE event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
PostThreadMessage(tid, RELEASEMARSHALDATA, 0, (LPARAM)event);
|
||||
WaitForSingleObject(event, INFINITE);
|
||||
ok( !WaitForSingleObject(event, 10000), "wait timed out\n" );
|
||||
CloseHandle(event);
|
||||
}
|
||||
|
||||
|
@ -302,7 +302,7 @@ static void end_host_object(DWORD tid, HANDLE thread)
|
|||
BOOL ret = PostThreadMessage(tid, WM_QUIT, 0, 0);
|
||||
ok(ret, "PostThreadMessage failed with error %d\n", GetLastError());
|
||||
/* be careful of races - don't return until hosting thread has terminated */
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
|
||||
CloseHandle(thread);
|
||||
}
|
||||
|
||||
|
@ -843,7 +843,7 @@ static DWORD CALLBACK no_couninitialize_server_proc(LPVOID p)
|
|||
|
||||
SetEvent(ncu_params->marshal_event);
|
||||
|
||||
WaitForSingleObject(ncu_params->unmarshal_event, INFINITE);
|
||||
ok( !WaitForSingleObject(ncu_params->unmarshal_event, 10000), "wait timed out\n" );
|
||||
|
||||
/* die without calling CoUninitialize */
|
||||
|
||||
|
@ -872,7 +872,7 @@ static void test_no_couninitialize_server(void)
|
|||
|
||||
thread = CreateThread(NULL, 0, no_couninitialize_server_proc, &ncu_params, 0, &tid);
|
||||
|
||||
WaitForSingleObject(ncu_params.marshal_event, INFINITE);
|
||||
ok( !WaitForSingleObject(ncu_params.marshal_event, 10000), "wait timed out\n" );
|
||||
ok_more_than_one_lock();
|
||||
|
||||
IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
|
||||
|
@ -883,7 +883,7 @@ static void test_no_couninitialize_server(void)
|
|||
ok_more_than_one_lock();
|
||||
|
||||
SetEvent(ncu_params.unmarshal_event);
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
|
||||
|
||||
ok_no_locks();
|
||||
|
||||
|
@ -942,7 +942,7 @@ static void test_no_couninitialize_client(void)
|
|||
|
||||
thread = CreateThread(NULL, 0, no_couninitialize_client_proc, &ncu_params, 0, &tid);
|
||||
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
|
||||
CloseHandle(thread);
|
||||
|
||||
ok_no_locks();
|
||||
|
@ -1109,7 +1109,7 @@ static DWORD CALLBACK weak_and_normal_marshal_thread_proc(void *p)
|
|||
|
||||
SetEvent(data->hReadyEvent);
|
||||
|
||||
while (WAIT_OBJECT_0 + 1 == MsgWaitForMultipleObjects(1, &hQuitEvent, FALSE, INFINITE, QS_ALLINPUT))
|
||||
while (WAIT_OBJECT_0 + 1 == MsgWaitForMultipleObjects(1, &hQuitEvent, FALSE, 10000, QS_ALLINPUT))
|
||||
{
|
||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||
DispatchMessage(&msg);
|
||||
|
@ -1141,7 +1141,7 @@ static void test_tableweak_and_normal_marshal_and_unmarshal(void)
|
|||
ok_ole_success(hr, CreateStreamOnHGlobal);
|
||||
|
||||
thread = CreateThread(NULL, 0, weak_and_normal_marshal_thread_proc, &data, 0, &tid);
|
||||
WaitForSingleObject(data.hReadyEvent, INFINITE);
|
||||
ok( !WaitForSingleObject(data.hReadyEvent, 10000), "wait timed out\n" );
|
||||
CloseHandle(data.hReadyEvent);
|
||||
|
||||
ok_more_than_one_lock();
|
||||
|
@ -1170,7 +1170,7 @@ static void test_tableweak_and_normal_marshal_and_unmarshal(void)
|
|||
IStream_Release(data.pStreamNormal);
|
||||
|
||||
SetEvent(data.hQuitEvent);
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
|
||||
CloseHandle(thread);
|
||||
}
|
||||
|
||||
|
@ -1449,7 +1449,7 @@ static void test_proxy_used_in_wrong_thread(void)
|
|||
/* create a thread that we can misbehave in */
|
||||
thread = CreateThread(NULL, 0, bad_thread_proc, pProxy, 0, &tid2);
|
||||
|
||||
WaitForSingleObject(thread, INFINITE);
|
||||
ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
|
||||
CloseHandle(thread);
|
||||
|
||||
/* do release statement on Win9x that we should have done above */
|
||||
|
@ -2701,7 +2701,7 @@ static void test_local_server(void)
|
|||
ok(process != NULL, "couldn't start local server process, error was %d\n", GetLastError());
|
||||
|
||||
ready_event = CreateEvent(NULL, FALSE, FALSE, "Wine COM Test Ready Event");
|
||||
WaitForSingleObject(ready_event, INFINITE);
|
||||
ok( !WaitForSingleObject(ready_event, 10000), "wait timed out\n" );
|
||||
CloseHandle(ready_event);
|
||||
|
||||
hr = CoCreateInstance(&CLSID_WineOOPTest, NULL, CLSCTX_LOCAL_SERVER, &IID_IClassFactory, (void **)&cf);
|
||||
|
@ -2781,13 +2781,13 @@ static void test_globalinterfacetable(void)
|
|||
* to exit before we can return */
|
||||
thread = CreateThread(NULL, 0, get_global_interface_proc, ¶ms, 0, &tid);
|
||||
|
||||
ret = MsgWaitForMultipleObjects(1, &thread, FALSE, INFINITE, QS_ALLINPUT);
|
||||
ret = MsgWaitForMultipleObjects(1, &thread, FALSE, 10000, QS_ALLINPUT);
|
||||
while (ret == WAIT_OBJECT_0 + 1)
|
||||
{
|
||||
MSG msg;
|
||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||
DispatchMessage(&msg);
|
||||
ret = MsgWaitForMultipleObjects(1, &thread, FALSE, INFINITE, QS_ALLINPUT);
|
||||
ret = MsgWaitForMultipleObjects(1, &thread, FALSE, 10000, QS_ALLINPUT);
|
||||
}
|
||||
|
||||
CloseHandle(thread);
|
||||
|
|
Loading…
Reference in New Issue