forked from OSchip/llvm-project
[Windows] Add 10s timeout to some WaitForSingleObject calls
I ran the test suite yesterday and when I came back this morning the queue_user_work_item.cc test was hung. This could be why the sanitizer-windows buildbot keeps randomly timing out. I updated all the usages of WaitForSingleObject involving threading events. I'm assuming the API can reliably wait for subprocesses, which is what the majority of call sites use it for. While I'm at it, we can simplify some EH tests now that clang can compile C++ EH. llvm-svn: 261338
This commit is contained in:
parent
171313c69a
commit
00203bc60b
|
@ -6,8 +6,7 @@
|
|||
// the rest is built with Clang. This represents the typical scenario when we
|
||||
// build a large project using "clang-cl -fallback -fsanitize=address".
|
||||
//
|
||||
// RUN: cl -c %s -Fo%t.obj
|
||||
// RUN: %clangxx_asan -o %t.exe %s %t.obj
|
||||
// RUN: %clangxx_asan %s -o %t.exe
|
||||
// RUN: %run %t.exe 2>&1 | FileCheck %s
|
||||
|
||||
#include <windows.h>
|
||||
|
@ -15,7 +14,6 @@
|
|||
|
||||
void ThrowAndCatch();
|
||||
|
||||
#if !defined(__clang__)
|
||||
__declspec(noinline)
|
||||
void Throw() {
|
||||
fprintf(stderr, "Throw\n");
|
||||
|
@ -32,7 +30,6 @@ void ThrowAndCatch() {
|
|||
// CHECK: Catch
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
char buffer[65536];
|
||||
HANDLE done;
|
||||
|
@ -62,9 +59,8 @@ int main(int argc, char **argv) {
|
|||
GetLastError() != ERROR_IO_PENDING)
|
||||
return 4;
|
||||
|
||||
if (WAIT_OBJECT_0 != WaitForSingleObject(done, INFINITE))
|
||||
if (WAIT_OBJECT_0 != WaitForSingleObject(done, 10 * 1000))
|
||||
return 5;
|
||||
fprintf(stderr, "Done!\n");
|
||||
// CHECK: Done!
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
// the rest is built with Clang. This represents the typical scenario when we
|
||||
// build a large project using "clang-cl -fallback -fsanitize=address".
|
||||
//
|
||||
// RUN: cl -c %s -Fo%t.obj
|
||||
// RUN: %clangxx_asan -o %t.exe %s %t.obj
|
||||
// RUN: %clangxx_asan %s -o %t.exe
|
||||
// RUN: %run %t.exe 2>&1 | FileCheck %s
|
||||
|
||||
#include <windows.h>
|
||||
|
@ -15,7 +14,6 @@
|
|||
|
||||
void ThrowAndCatch();
|
||||
|
||||
#if !defined(__clang__)
|
||||
__declspec(noinline)
|
||||
void Throw() {
|
||||
fprintf(stderr, "Throw\n");
|
||||
|
@ -32,7 +30,6 @@ void ThrowAndCatch() {
|
|||
// CHECK: Catch
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
HANDLE done;
|
||||
|
||||
|
@ -47,9 +44,13 @@ int main(int argc, char **argv) {
|
|||
if (!done)
|
||||
return 1;
|
||||
QueueUserWorkItem(&work_item, nullptr, 0);
|
||||
if (WAIT_OBJECT_0 != WaitForSingleObject(done, INFINITE))
|
||||
unsigned wait_result = WaitForSingleObject(done, 10 * 1000);
|
||||
if (wait_result == WAIT_ABANDONED)
|
||||
fprintf(stderr, "Timed out\n");
|
||||
if (wait_result != WAIT_OBJECT_0) {
|
||||
fprintf(stderr, "Wait for work item failed\n");
|
||||
return 2;
|
||||
}
|
||||
fprintf(stderr, "Done!\n");
|
||||
// CHECK: Done!
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,6 @@ int main(int argc, char **argv) {
|
|||
return 1;
|
||||
// CHECK-NOT: Thread T1 created
|
||||
QueueUserWorkItem(&work_item, nullptr, 0);
|
||||
if (WAIT_OBJECT_0 != WaitForSingleObject(done, INFINITE))
|
||||
if (WAIT_OBJECT_0 != WaitForSingleObject(done, 10 * 1000))
|
||||
return 2;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue