blob: fdaa9faf8902eb4f60e52e8789b854d1afcd2708 [file] [log] [blame]
Alexey Samsonov3f3b3ab2015-05-07 18:31:29 +00001// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0
Alexey Samsonovdfa908c2015-05-07 22:34:06 +00002// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge -fsanitize-coverage=0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0
3// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0
Alexey Samsonov3f3b3ab2015-05-07 18:31:29 +00004// CHECK-SANITIZE-COVERAGE-0-NOT: fsanitize-coverage-type
Alexey Samsonovdfa908c2015-05-07 22:34:06 +00005
Alexey Samsonov3f3b3ab2015-05-07 18:31:29 +00006// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1
7// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1
8// RUN: %clang -target x86_64-linux-gnu -fsanitize=leak -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1
9// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1
10// RUN: %clang -target x86_64-linux-gnu -fsanitize=bool -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1
11// RUN: %clang -target x86_64-linux-gnu -fsanitize=dataflow -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1
12// CHECK-SANITIZE-COVERAGE-1: fsanitize-coverage-type=1
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000013
14// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=2 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-2
15// CHECK-SANITIZE-COVERAGE-2: fsanitize-coverage-type=2
16
17// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=3 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-3
18// CHECK-SANITIZE-COVERAGE-3: fsanitize-coverage-type=3
19
Alexey Samsonov3f3b3ab2015-05-07 18:31:29 +000020// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=4 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-4
21// CHECK-SANITIZE-COVERAGE-4: fsanitize-coverage-type=3
22// CHECK-SANITIZE-COVERAGE-4: fsanitize-coverage-indirect-calls
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000023
Alexey Samsonov3f3b3ab2015-05-07 18:31:29 +000024// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-5
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000025// CHECK-SANITIZE-COVERAGE-5: error: unsupported argument '5' to option 'fsanitize-coverage='
26
Alexey Samsonov3f3b3ab2015-05-07 18:31:29 +000027// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-UNUSED
28// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-UNUSED
29// CHECK-SANITIZE-COVERAGE-UNUSED: argument unused during compilation: '-fsanitize-coverage=1'
30
Alexey Samsonovde0aff32015-05-21 01:07:52 +000031// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=1 -fno-sanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-SAN-DISABLED
32// CHECK-SANITIZE-COVERAGE-SAN-DISABLED-NOT: argument unused
33
Alexey Samsonovdfa908c2015-05-07 22:34:06 +000034// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge,indirect-calls,trace-bb,trace-cmp,8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FEATURES
35// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-type=3
36// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-indirect-calls
37// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-bb
38// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-cmp
39// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-8bit-counters
40
41// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func,edge,indirect-calls,trace-bb,trace-cmp -fno-sanitize-coverage=edge,indirect-calls,trace-bb %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MASK
42// CHECK-MASK: -fsanitize-coverage-type=1
43// CHECK-MASK: -fsanitize-coverage-trace-cmp
44// CHECK-MASK-NOT: -fsanitize-coverage-
45
46// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=foobar %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID-VALUE
47// CHECK-INVALID-VALUE: error: unsupported argument 'foobar' to option 'fsanitize-coverage='
48
49// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func -fsanitize-coverage=edge %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INCOMPATIBLE
50// CHECK-INCOMPATIBLE: error: invalid argument '-fsanitize-coverage=func' not allowed with '-fsanitize-coverage=edge'
51
52// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-TYPE
53// CHECK-MISSING-TYPE: error: invalid argument '-fsanitize-coverage=8bit-counters' only allowed with '-fsanitize-coverage=(func|bb|edge)'
54
55// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=trace-cmp,indirect-calls %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-TYPE-NECESSARY
56// CHECK-NO-TYPE-NECESSARY-NOT: error:
57// CHECK-NO-TYPE-NECESSARY: -fsanitize-coverage-indirect-calls
58// CHECK-NO-TYPE-NECESSARY: -fsanitize-coverage-trace-cmp
59
60// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=1 -fsanitize-coverage=trace-cmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-EXTEND-LEGACY
61// CHECK-EXTEND-LEGACY: -fsanitize-coverage-type=1
62// CHECK-EXTEND-LEGACY: -fsanitize-coverage-trace-cmp
63
Alexey Samsonovc079df02015-09-03 20:53:14 +000064// RUN: %clang_cl --target=i386-pc-win32 -fsanitize=address -fsanitize-coverage=1 -c -### -- %s 2>&1 | FileCheck %s -check-prefix=CLANG-CL-COVERAGE
Alexey Samsonov3f3b3ab2015-05-07 18:31:29 +000065// CLANG-CL-COVERAGE-NOT: error:
66// CLANG-CL-COVERAGE-NOT: warning:
67// CLANG-CL-COVERAGE-NOT: argument unused
68// CLANG-CL-COVERAGE-NOT: unknown argument
69// CLANG-CL-COVERAGE: -fsanitize=address
70// CLANG-CL-COVERAGE: -fsanitize-coverage-type=1