1 // Test blacklist functionality for TSan. 2 3 // RUN: %clangxx_tsan -O1 %s \ 4 // RUN: -fsanitize-blacklist=%p/Helpers/blacklist.txt \ 5 // RUN: -o %t && %t 2>&1 | FileCheck %s 6 #include <pthread.h> 7 #include <stdio.h> 8 9 int Global; 10 11 void *Thread1(void *x) { 12 Global++; 13 return NULL; 14 } 15 16 void *Blacklisted_Thread2(void *x) { 17 Global--; 18 return NULL; 19 } 20 21 int main() { 22 pthread_t t[2]; 23 pthread_create(&t[0], NULL, Thread1, NULL); 24 pthread_create(&t[1], NULL, Blacklisted_Thread2, NULL); 25 pthread_join(t[0], NULL); 26 pthread_join(t[1], NULL); 27 printf("PASS\n"); 28 return 0; 29 } 30 31 // CHECK-NOT: ThreadSanitizer: data race 32