2017-04-25 02:23:24 +08:00
|
|
|
// Test flags inserted by -fsanitize=fuzzer.
|
|
|
|
|
2018-08-01 05:57:35 +08:00
|
|
|
// RUN: %clang -fsanitize=fuzzer %s -target x86_64-apple-darwin14 -### 2>&1 | FileCheck --check-prefixes=CHECK-FUZZER-LIB,CHECK-COVERAGE-FLAGS %s
|
2017-04-25 02:23:24 +08:00
|
|
|
//
|
2017-08-22 08:04:05 +08:00
|
|
|
// CHECK-FUZZER-LIB: libclang_rt.fuzzer
|
2017-09-02 02:34:36 +08:00
|
|
|
// CHECK-COVERAGE: -fsanitize-coverage-inline-8bit-counters
|
2017-04-25 02:23:24 +08:00
|
|
|
// CHECK-COVERAGE-SAME: -fsanitize-coverage-indirect-calls
|
|
|
|
// CHECK-COVERAGE-SAME: -fsanitize-coverage-trace-cmp
|
2017-08-05 05:35:11 +08:00
|
|
|
// CHECK-COVERAGE-SAME: -fsanitize-coverage-pc-table
|
2017-04-25 02:23:24 +08:00
|
|
|
|
2018-08-01 05:57:35 +08:00
|
|
|
// RUN: %clang -fsanitize=fuzzer -target i386-unknown-linux -stdlib=platform %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBCXX-LINUX %s
|
2017-04-25 02:23:24 +08:00
|
|
|
//
|
|
|
|
// CHECK-LIBCXX-LINUX: -lstdc++
|
|
|
|
|
2018-08-01 05:57:35 +08:00
|
|
|
// RUN: %clang -target x86_64-apple-darwin14 -fsanitize=fuzzer %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBCXX-DARWIN %s
|
2017-04-25 02:23:24 +08:00
|
|
|
//
|
|
|
|
// CHECK-LIBCXX-DARWIN: -lc++
|
|
|
|
|
2017-06-30 03:58:20 +08:00
|
|
|
|
2017-06-30 03:52:33 +08:00
|
|
|
// Check that we don't link in libFuzzer.a when producing a shared object.
|
2018-08-01 05:57:35 +08:00
|
|
|
// RUN: %clang -fsanitize=fuzzer %s -shared -o %t.so -### 2>&1 | FileCheck --check-prefixes=CHECK-NOLIB-SO %s
|
2017-08-22 07:25:19 +08:00
|
|
|
// CHECK-NOLIB-SO-NOT: libclang_rt.libfuzzer
|
2017-06-30 03:52:33 +08:00
|
|
|
|
2017-08-12 01:22:58 +08:00
|
|
|
// Check that we don't link in libFuzzer when compiling with -fsanitize=fuzzer-no-link.
|
2018-08-01 05:57:35 +08:00
|
|
|
// RUN: %clang -fsanitize=fuzzer-no-link %s -target x86_64-apple-darwin14 -### 2>&1 | FileCheck --check-prefixes=CHECK-NOLIB,CHECK-COV %s
|
2017-08-22 07:25:19 +08:00
|
|
|
// CHECK-NOLIB-NOT: libclang_rt.libfuzzer
|
2017-09-02 02:34:36 +08:00
|
|
|
// CHECK-COV: -fsanitize-coverage-inline-8bit-counters
|
2017-08-12 01:22:58 +08:00
|
|
|
|
2017-06-30 03:58:20 +08:00
|
|
|
// RUN: %clang -fsanitize=fuzzer -fsanitize-coverage=trace-pc %s -### 2>&1 | FileCheck --check-prefixes=CHECK-MSG %s
|
|
|
|
// CHECK-MSG-NOT: argument unused during compilation
|
|
|
|
|
2017-04-25 02:23:24 +08:00
|
|
|
int LLVMFuzzerTestOneInput(const char *Data, long Size) {
|
|
|
|
return 0;
|
|
|
|
}
|