[lib/Fuzzer] build tests that work well with dfsan also w/o dfsan

llvm-svn: 236909
This commit is contained in:
Kostya Serebryany 2015-05-08 21:45:19 +00:00
parent a704600295
commit f3f3ed323a
5 changed files with 12 additions and 10 deletions

View File

@ -4,6 +4,11 @@
# for the Fuzzer lib) # for the Fuzzer lib)
set(CMAKE_CXX_FLAGS_RELEASE "${LIBFUZZER_FLAGS_BASE} -O0 -fsanitize-coverage=edge,indirect-calls") set(CMAKE_CXX_FLAGS_RELEASE "${LIBFUZZER_FLAGS_BASE} -O0 -fsanitize-coverage=edge,indirect-calls")
set(DFSanTests
DFSanMemcmpTest
DFSanSimpleCmpTest
)
set(Tests set(Tests
CounterTest CounterTest
CxxTokensTest CxxTokensTest
@ -13,12 +18,9 @@ set(Tests
NullDerefTest NullDerefTest
SimpleTest SimpleTest
TimeoutTest TimeoutTest
${DFSanTests}
) )
set(DFSanTests
DFSanMemcmpTest
DFSanSimpleCmpTest
)
set(TestBinaries) set(TestBinaries)
@ -60,7 +62,7 @@ set(TestBinaries ${TestBinaries} LLVMFuzzer-Unittest)
add_subdirectory(dfsan) add_subdirectory(dfsan)
foreach(Test ${DFSanTests}) foreach(Test ${DFSanTests})
set(TestBinaries ${TestBinaries} LLVMFuzzer-${Test}) set(TestBinaries ${TestBinaries} LLVMFuzzer-${Test}-DFSan)
endforeach() endforeach()

View File

@ -4,10 +4,10 @@ set(CMAKE_CXX_FLAGS_RELEASE
"${LIBFUZZER_FLAGS_BASE} -O0 -fno-sanitize=all -fsanitize=dataflow") "${LIBFUZZER_FLAGS_BASE} -O0 -fno-sanitize=all -fsanitize=dataflow")
foreach(Test ${DFSanTests}) foreach(Test ${DFSanTests})
add_executable(LLVMFuzzer-${Test} add_executable(LLVMFuzzer-${Test}-DFSan
${Test}.cpp ../${Test}.cpp
) )
target_link_libraries(LLVMFuzzer-${Test} target_link_libraries(LLVMFuzzer-${Test}-DFSan
LLVMFuzzer LLVMFuzzer
) )
endforeach() endforeach()

View File

@ -19,9 +19,9 @@ RUN: not ./LLVMFuzzer-FourIndependentBranchesTest -timeout=15 -seed=1 -use_cover
RUN: not ./LLVMFuzzer-CounterTest -use_counters=1 -max_len=6 -seed=1 -timeout=15 2>&1 | FileCheck %s RUN: not ./LLVMFuzzer-CounterTest -use_counters=1 -max_len=6 -seed=1 -timeout=15 2>&1 | FileCheck %s
RUN: not ./LLVMFuzzer-DFSanSimpleCmpTest -seed=1 -runs=1000000 -timeout=5 2>&1 | FileCheck %s RUN: not ./LLVMFuzzer-DFSanSimpleCmpTest-DFSan -seed=1 -runs=1000000 -timeout=5 2>&1 | FileCheck %s
RUN: not ./LLVMFuzzer-DFSanMemcmpTest -seed=1 -runs=100 -timeout=5 2>&1 | FileCheck %s RUN: not ./LLVMFuzzer-DFSanMemcmpTest-DFSan -seed=1 -runs=100 -timeout=5 2>&1 | FileCheck %s
RUN: not ./LLVMFuzzer-CxxTokensTest -seed=1 -timeout=15 -tokens=%S/../cxx_fuzzer_tokens.txt 2>&1 | FileCheck %s RUN: not ./LLVMFuzzer-CxxTokensTest -seed=1 -timeout=15 -tokens=%S/../cxx_fuzzer_tokens.txt 2>&1 | FileCheck %s