diff options
Diffstat (limited to 'compiler-rt/test/tsan/sunrpc.cpp')
| -rw-r--r-- | compiler-rt/test/tsan/sunrpc.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/compiler-rt/test/tsan/sunrpc.cpp b/compiler-rt/test/tsan/sunrpc.cpp new file mode 100644 index 00000000000..8e32d6d3043 --- /dev/null +++ b/compiler-rt/test/tsan/sunrpc.cpp @@ -0,0 +1,27 @@ +// REQUIRES: sunrpc + +// RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s + +#include <pthread.h> +#include <rpc/types.h> +#include <rpc/xdr.h> +#include <stdio.h> + +void *thr(void *p) { + XDR xdrs; + char buf[100]; + xdrmem_create(&xdrs, buf, sizeof(buf), XDR_ENCODE); + xdr_destroy(&xdrs); + return 0; +} + +int main(int argc, char *argv[]) { + pthread_t th[2]; + pthread_create(&th[0], 0, thr, 0); + pthread_create(&th[1], 0, thr, 0); + pthread_join(th[0], 0); + pthread_join(th[1], 0); + fprintf(stderr, "DONE\n"); + // CHECK: DONE + return 0; +} |

