[compiler-rt] r261338 - [Windows] Add 10s timeout to some WaitForSingleObject calls
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 19 09:30:38 PST 2016
Author: rnk
Date: Fri Feb 19 11:30:38 2016
New Revision: 261338
URL: http://llvm.org/viewvc/llvm-project?rev=261338&view=rev
Log:
[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.
Modified:
compiler-rt/trunk/test/asan/TestCases/Windows/bind_io_completion_callback.cc
compiler-rt/trunk/test/asan/TestCases/Windows/queue_user_work_item.cc
compiler-rt/trunk/test/asan/TestCases/Windows/queue_user_work_item_report.cc
Modified: compiler-rt/trunk/test/asan/TestCases/Windows/bind_io_completion_callback.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/bind_io_completion_callback.cc?rev=261338&r1=261337&r2=261338&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/bind_io_completion_callback.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/bind_io_completion_callback.cc Fri Feb 19 11:30:38 2016
@@ -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
Modified: compiler-rt/trunk/test/asan/TestCases/Windows/queue_user_work_item.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/queue_user_work_item.cc?rev=261338&r1=261337&r2=261338&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/queue_user_work_item.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/queue_user_work_item.cc Fri Feb 19 11:30:38 2016
@@ -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
Modified: compiler-rt/trunk/test/asan/TestCases/Windows/queue_user_work_item_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/queue_user_work_item_report.cc?rev=261338&r1=261337&r2=261338&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Windows/queue_user_work_item_report.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Windows/queue_user_work_item_report.cc Fri Feb 19 11:30:38 2016
@@ -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;
}
More information about the llvm-commits
mailing list