diff options
author | Reid Kleckner <rnk@google.com> | 2016-02-19 17:30:38 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-02-19 17:30:38 +0000 |
commit | e15376e69ddc3aa149743ea187c379ef31244195 (patch) | |
tree | e82b0fc32ea1cf6ca0639178d9383f009fa82c37 /test | |
parent | f81e6602b952223ae346f2d6c3ec0be082a328b7 (diff) |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261338 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
3 files changed, 10 insertions, 13 deletions
diff --git a/test/asan/TestCases/Windows/bind_io_completion_callback.cc b/test/asan/TestCases/Windows/bind_io_completion_callback.cc index c062a799f..44b92ab91 100644 --- a/test/asan/TestCases/Windows/bind_io_completion_callback.cc +++ b/test/asan/TestCases/Windows/bind_io_completion_callback.cc @@ -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 diff --git a/test/asan/TestCases/Windows/queue_user_work_item.cc b/test/asan/TestCases/Windows/queue_user_work_item.cc index d99ea6fc2..2a0b622f6 100644 --- a/test/asan/TestCases/Windows/queue_user_work_item.cc +++ b/test/asan/TestCases/Windows/queue_user_work_item.cc @@ -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 diff --git a/test/asan/TestCases/Windows/queue_user_work_item_report.cc b/test/asan/TestCases/Windows/queue_user_work_item_report.cc index f0d3d3e7c..e500a919f 100644 --- a/test/asan/TestCases/Windows/queue_user_work_item_report.cc +++ b/test/asan/TestCases/Windows/queue_user_work_item_report.cc @@ -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; } |