brintos

brintos / llvm-project-archived public Read only

0
0
Text · 658 B · dc7ed6d Raw
31 lines · cpp
1// Test ignorelist functionality for TSan.2 3// RUN: echo "fun:*Ignorelisted_Thread2*" > %t.ignorelist4// RUN: %clangxx_tsan -O1 %s -fsanitize-ignorelist=%t.ignorelist -o %t && %run %t 2>&1 | FileCheck %s5#include <pthread.h>6#include <stdio.h>7 8int Global;9 10void *Thread1(void *x) {11  Global++;12  return NULL;13}14 15void *Ignorelisted_Thread2(void *x) {16  Global--;17  return NULL;18}19 20int 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 race31