diff options
author | andrew <andrew@FreeBSD.org> | 2012-07-30 10:58:13 +0000 |
---|---|---|
committer | andrew <andrew@FreeBSD.org> | 2012-07-30 10:58:13 +0000 |
commit | cfeab007a554034f0b3ab4a677cf9dd2696c12f9 (patch) | |
tree | 40cc44a3d02ed86de24f2117a55680e4f0eb01a0 /lib/tsan/go/test.c | |
parent | 07af089f1449ec5506ca7ede5b593e11a0f48603 (diff) | |
download | FreeBSD-src-cfeab007a554034f0b3ab4a677cf9dd2696c12f9.zip FreeBSD-src-cfeab007a554034f0b3ab4a677cf9dd2696c12f9.tar.gz |
Import compiler-rt r160957.
Diffstat (limited to 'lib/tsan/go/test.c')
-rw-r--r-- | lib/tsan/go/test.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/lib/tsan/go/test.c b/lib/tsan/go/test.c new file mode 100644 index 0000000..a9a5b3d --- /dev/null +++ b/lib/tsan/go/test.c @@ -0,0 +1,51 @@ +//===-- 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. +// +//===----------------------------------------------------------------------===// + +#include <stdio.h> + +void __tsan_init(); +void __tsan_fini(); +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_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); + __tsan_fini(); + return 0; +} |