summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan/go/test.c
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2012-07-27 14:00:39 +0000
committerDmitry Vyukov <dvyukov@google.com>2012-07-27 14:00:39 +0000
commit4e94662db42473c10526ff29b19e0f1607375c7d (patch)
tree501bef878323708b64caee9472d77403940e5921 /compiler-rt/lib/tsan/go/test.c
parent536551d02d72014907ea0e0ec037abb993db3e0f (diff)
downloadbcm5719-llvm-4e94662db42473c10526ff29b19e0f1607375c7d.tar.gz
bcm5719-llvm-4e94662db42473c10526ff29b19e0f1607375c7d.zip
tsan: change event handling from single HandleEvent() to a set of separate functions (Go runtime)
llvm-svn: 160863
Diffstat (limited to 'compiler-rt/lib/tsan/go/test.c')
-rw-r--r--compiler-rt/lib/tsan/go/test.c42
1 files changed, 36 insertions, 6 deletions
diff --git a/compiler-rt/lib/tsan/go/test.c b/compiler-rt/lib/tsan/go/test.c
index 7d6a8ce3ea9..34d68eae9bc 100644
--- a/compiler-rt/lib/tsan/go/test.c
+++ b/compiler-rt/lib/tsan/go/test.c
@@ -1,19 +1,49 @@
-#include <stdio.h>
+//===-- test.c ------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Sanity test for Go runtime.
+//
+//===----------------------------------------------------------------------===//
void __tsan_init();
void __tsan_fini();
-void __tsan_event(int typ, int tid, void *pc, void *addr, int info);
+void __tsan_go_start(int pgoid, int chgoid, void *pc);
+void __tsan_go_end(int goid);
+void __tsan_read(int goid, void *addr, void *pc);
+void __tsan_write(int goid, void *addr, void *pc);
+void __tsan_func_enter(int goid, void *pc);
+void __tsan_func_exit(int goid);
+void __tsan_malloc(int goid, void *p, unsigned long sz, void *pc);
+void __tsan_free(void *p);
+void __tsan_acquire(int goid, void *addr);
+void __tsan_release(int goid, void *addr);
+void __tsan_release_merge(int goid, void *addr);
int __tsan_symbolize(void *pc, char **img, char **rtn, char **file, int *l) {
return 0;
}
+char buf[10];
+
int main(void) {
__tsan_init();
- __tsan_event(1, 0, 0, &main, 0); // READ
- __tsan_event(11, 1, 0, 0, 0); // THR_START
- __tsan_event(11, 0, 0, &main, 0); // READ
- __tsan_event(13, 1, 0, 0, 0); // THR_END
+ __tsan_func_enter(0, &main);
+ __tsan_malloc(0, buf, 10, 0);
+ __tsan_release(0, buf);
+ __tsan_release_merge(0, buf);
+ __tsan_go_start(0, 1, 0);
+ __tsan_write(1, buf, 0);
+ __tsan_acquire(1, buf);
+ __tsan_go_end(1);
+ __tsan_read(0, buf, 0);
+ __tsan_free(buf);
+ __tsan_func_exit(0);
printf("OK\n");
__tsan_fini();
return 0;
OpenPOWER on IntegriCloud