[ASan/Win] Don't crash when ASAN_OPTIONS have disable_core=1
[blocksruntime.git] / test / tsan / suppressions_race.cc
blob1d72874d95860a0b8d6da06546cdc2bc7dd280ad
1 // RUN: %clang_tsan -O1 %s -o %t && TSAN_OPTIONS="$TSAN_OPTIONS suppressions=%s.supp" %run %t 2>&1 | FileCheck %s
2 #include <pthread.h>
3 #include <stdio.h>
4 #include <unistd.h>
6 int Global;
8 void *Thread1(void *x) {
9 sleep(1);
10 Global = 42;
11 return NULL;
14 void *Thread2(void *x) {
15 Global = 43;
16 return NULL;
19 int main() {
20 pthread_t t[2];
21 pthread_create(&t[0], NULL, Thread1, NULL);
22 pthread_create(&t[1], NULL, Thread2, NULL);
23 pthread_join(t[0], NULL);
24 pthread_join(t[1], NULL);
25 printf("OK\n");
26 return 0;
29 // CHECK-NOT: failed to open suppressions file
30 // CHECK-NOT: WARNING: ThreadSanitizer: data race