Home | History | Annotate | Download | only in Driver
      1 // General blacklist usage.
      2 
      3 // PR12920
      4 // REQUIRES: clang-driver, shell
      5 
      6 // Make sure we don't match the -NOT lines with the linker invocation.
      7 // Delimiters match the start of the cc1 and the start of the linker lines
      8 // for fragile tests.
      9 // DELIMITERS: {{^ *"}}
     10 
     11 // RUN: echo "fun:foo" > %t.good
     12 // RUN: echo "fun:bar" > %t.second
     13 // RUN: echo "badline" > %t.bad
     14 
     15 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blacklist=%t.good -fsanitize-blacklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BLACKLIST
     16 // CHECK-BLACKLIST: -fsanitize-blacklist={{.*}}.good" "-fsanitize-blacklist={{.*}}.second
     17 
     18 // Now, check for -fdepfile-entry flags.
     19 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blacklist=%t.good -fsanitize-blacklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BLACKLIST2
     20 // CHECK-BLACKLIST2: -fdepfile-entry={{.*}}.good" "-fdepfile-entry={{.*}}.second
     21 
     22 // Check that the default blacklist is not added as an extra dependency.
     23 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-BLACKLIST --implicit-check-not=fdepfile-entry
     24 // CHECK-DEFAULT-BLACKLIST: -fsanitize-blacklist={{.*}}asan_blacklist.txt
     25 
     26 // Ignore -fsanitize-blacklist flag if there is no -fsanitize flag.
     27 // RUN: %clang -target x86_64-linux-gnu -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE --check-prefix=DELIMITERS
     28 // CHECK-NO-SANITIZE-NOT: -fsanitize-blacklist
     29 
     30 // Ignore -fsanitize-blacklist flag if there is no -fsanitize flag.
     31 // Now, check for the absense of -fdepfile-entry flags.
     32 // RUN: %clang -target x86_64-linux-gnu -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE2 --check-prefix=DELIMITERS
     33 // CHECK-NO-SANITIZE2-NOT: -fdepfile-entry
     34 
     35 // Flag -fno-sanitize-blacklist wins if it is specified later.
     36 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blacklist=%t.good -fno-sanitize-blacklist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-BLACKLIST --check-prefix=DELIMITERS
     37 // CHECK-NO-BLACKLIST-NOT: -fsanitize-blacklist
     38 
     39 // Driver barks on unexisting blacklist files.
     40 // RUN: %clang -target x86_64-linux-gnu -fno-sanitize-blacklist -fsanitize-blacklist=unexisting.txt %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SUCH-FILE
     41 // CHECK-NO-SUCH-FILE: error: no such file or directory: 'unexisting.txt'
     42 
     43 // Driver properly reports malformed blacklist files.
     44 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blacklist=%t.second -fsanitize-blacklist=%t.bad -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BAD-BLACKLIST
     45 // CHECK-BAD-BLACKLIST: error: malformed sanitizer blacklist: 'error parsing file '{{.*}}.bad': malformed line 1: 'badline''
     46 
     47 // -fno-sanitize-blacklist disables all blacklists specified earlier.
     48 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-blacklist=%t.good -fno-sanitize-blacklist -fsanitize-blacklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-FIRST-DISABLED
     49 // CHECK-ONLY_FIRST-DISABLED-NOT: good
     50 // CHECK-ONLY-FIRST-DISABLED: -fsanitize-blacklist={{.*}}.second
     51 // CHECK-ONLY_FIRST-DISABLED-NOT: good
     52 
     53 // DELIMITERS: {{^ *"}}
     54