]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Driver/fuzzer.c
Vendor import of clang trunk r306956:
[FreeBSD/FreeBSD.git] / test / Driver / fuzzer.c
1 // Test flags inserted by -fsanitize=fuzzer.
2
3 // RUN: %clang -fsanitize=fuzzer %s -target x86_64-apple-darwin14 -### 2>&1 | FileCheck --check-prefixes=CHECK-FUZZER-LIB,CHECK-COVERAGE-FLAGS %s
4 //
5 // CHECK-FUZZER-LIB: libLLVMFuzzer.a
6 // CHECK-COVERAGE: -fsanitize-coverage-trace-pc-guard
7 // CHECK-COVERAGE-SAME: -fsanitize-coverage-indirect-calls
8 // CHECK-COVERAGE-SAME: -fsanitize-coverage-trace-cmp
9
10 // RUN: %clang -fsanitize=fuzzer -target i386-unknown-linux -stdlib=platform %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBCXX-LINUX %s
11 //
12 // CHECK-LIBCXX-LINUX: -lstdc++
13
14 // RUN: %clang -target x86_64-apple-darwin14 -fsanitize=fuzzer %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBCXX-DARWIN %s
15 //
16 // CHECK-LIBCXX-DARWIN: -lc++
17
18
19 // Check that we don't link in libFuzzer.a when producing a shared object.
20 // RUN: %clang -fsanitize=fuzzer %s -shared -o %t.so -### 2>&1 | FileCheck --check-prefixes=CHECK-NOLIB-SO %s
21 // CHECK-NOLIB-SO-NOT: libLLVMFuzzer.a
22
23 // RUN: %clang -fsanitize=fuzzer -fsanitize-coverage=trace-pc %s -### 2>&1 | FileCheck --check-prefixes=CHECK-MSG %s
24 // CHECK-MSG-NOT: argument unused during compilation
25
26 int LLVMFuzzerTestOneInput(const char *Data, long Size) {
27   return 0;
28 }