summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulian Lettner <jlettner@apple.com>2019-02-12 00:37:40 +0000
committerJulian Lettner <jlettner@apple.com>2019-02-12 00:37:40 +0000
commitee82db57ec6de0446317b1fa84c9cb5467cbd09c (patch)
tree456d94879ca63905ebc1540c414012f30689e543
parent806136f8ef1cc440df2a1387187303fa080fd001 (diff)
downloadbcm5719-llvm-ee82db57ec6de0446317b1fa84c9cb5467cbd09c.tar.gz
bcm5719-llvm-ee82db57ec6de0446317b1fa84c9cb5467cbd09c.zip
[libFuzzer] Make coverage.test work on ARM64
Summary: This test instruments the following code with coverage, runs the fuzzer once, and asserts that there are uncovered PCs. The ARM64 backend optimizes this code using the `csel` (Conditional select) instruction, which removes all branching from the resulting machine code. The test then fails because we do not have any uncovered PCs. The easiest solution for now is to turn off optimization for the DSOs used in this test. ``` int DSO1(int a) { if (a < 123456) return 0; return 1; } ``` rdar://47646400 Reviewers: kcc Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D58087 llvm-svn: 353780
-rw-r--r--compiler-rt/test/fuzzer/coverage.test12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler-rt/test/fuzzer/coverage.test b/compiler-rt/test/fuzzer/coverage.test
index 08c0c825a3f..db15c7a66c6 100644
--- a/compiler-rt/test/fuzzer/coverage.test
+++ b/compiler-rt/test/fuzzer/coverage.test
@@ -1,8 +1,8 @@
# FIXME: Disabled on Windows because -fPIC cannot be used to compile for Windows.
UNSUPPORTED: windows
RUN: %cpp_compiler -mllvm -use-unknown-locations=Disable %S/NullDerefTest.cpp -o %t-NullDerefTest
-RUN: %cpp_compiler -mllvm -use-unknown-locations=Disable %S/DSO1.cpp -fPIC %ld_flags_rpath_so1 -shared -o %dynamiclib1
-RUN: %cpp_compiler -mllvm -use-unknown-locations=Disable %S/DSO2.cpp -fPIC %ld_flags_rpath_so2 -shared -o %dynamiclib2
+RUN: %cpp_compiler -mllvm -use-unknown-locations=Disable %S/DSO1.cpp -fPIC %ld_flags_rpath_so1 -O0 -shared -o %dynamiclib1
+RUN: %cpp_compiler -mllvm -use-unknown-locations=Disable %S/DSO2.cpp -fPIC %ld_flags_rpath_so2 -O0 -shared -o %dynamiclib2
RUN: %cpp_compiler -mllvm -use-unknown-locations=Disable %S/DSOTestMain.cpp %S/DSOTestExtra.cpp %ld_flags_rpath_exe1 %ld_flags_rpath_exe2 -o %t-DSOTest
CHECK: COVERAGE:
@@ -11,10 +11,10 @@ RUN: not %run %t-NullDerefTest -print_coverage=1 2>&1 | FileCheck %s
RUN: %run %t-DSOTest -print_coverage=1 -runs=0 2>&1 | FileCheck %s --check-prefix=DSO
DSO: COVERAGE:
-DSO-DAG: COVERED_FUNC:{{.*}}1{{.*}}
-DSO-DAG: COVERED_FUNC:{{.*}}2{{.*}}
+DSO-DAG: COVERED_FUNC:{{.*}}DSO1
+DSO-DAG: COVERED_FUNC:{{.*}}DSO2
DSO-DAG: COVERED_FUNC:{{.*}}LLVMFuzzerTestOneInput{{.*}}DSOTestMain
-DSO-DAG: UNCOVERED_PC:{{.*}}1
-DSO-DAG: UNCOVERED_PC:{{.*}}2
+DSO-DAG: UNCOVERED_PC:{{.*}}DSO1
+DSO-DAG: UNCOVERED_PC:{{.*}}DSO2
DSO-DAG: UNCOVERED_PC:{{.*}}DSOTestMain
DSO-DAG: UNCOVERED_FUNC:{{.*}}Uncovered1
OpenPOWER on IntegriCloud