summaryrefslogtreecommitdiff
path: root/test/tsan/longjmp.cc
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2014-02-14 14:35:48 +0000
committerAlexey Samsonov <samsonov@google.com>2014-02-14 14:35:48 +0000
commite951fe4eec98de20b9b843f97fec2cca84c48b9c (patch)
treee5d5d3dbf11683bfde3cfd829ccea8ddbbc0dd0e /test/tsan/longjmp.cc
parentba2d0d7b386f38c97eee11749f2fc75449c2b253 (diff)
Move TSan lit-tests under test/tsan
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201414 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/tsan/longjmp.cc')
-rw-r--r--test/tsan/longjmp.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/tsan/longjmp.cc b/test/tsan/longjmp.cc
new file mode 100644
index 000000000..d9ca4ca5e
--- /dev/null
+++ b/test/tsan/longjmp.cc
@@ -0,0 +1,22 @@
+// RUN: %clang_tsan -O1 %s -o %t && %t 2>&1 | FileCheck %s
+#include <stdio.h>
+#include <stdlib.h>
+#include <setjmp.h>
+
+int foo(jmp_buf env) {
+ longjmp(env, 42);
+}
+
+int main() {
+ jmp_buf env;
+ if (setjmp(env) == 42) {
+ printf("JUMPED\n");
+ return 0;
+ }
+ foo(env);
+ printf("FAILED\n");
+ return 0;
+}
+
+// CHECK-NOT: FAILED
+// CHECK: JUMPED