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