diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 2046f41..ab5ec63 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -16,6 +16,13 @@ add_executable(Crash Crash.cpp) target_link_libraries(Crash deepstate) +if (BUILD_LIBFUZZER) + add_executable(Crash_LF Crash.cpp) + target_link_libraries(Crash_LF deepstate_LF) + target_link_libraries (Crash_LF "-fsanitize=fuzzer") + set_target_properties(Crash_LF PROPERTIES COMPILE_DEFINITIONS "LIBFUZZER") +endif() + add_executable(OneOf OneOf.cpp) target_link_libraries(OneOf deepstate) @@ -29,24 +36,73 @@ endif() add_executable(Fixture Fixture.cpp) target_link_libraries(Fixture deepstate) +if (BUILD_LIBFUZZER) + add_executable(Fixture_LF Fixture.cpp) + target_link_libraries(Fixture_LF deepstate_LF) + target_link_libraries (Fixture_LF "-fsanitize=fuzzer") + set_target_properties(Fixture_LF PROPERTIES COMPILE_DEFINITIONS "LIBFUZZER") +endif() + add_executable(Primes Primes.cpp) target_link_libraries(Primes deepstate) +if (BUILD_LIBFUZZER) + add_executable(Primes_LF Primes.cpp) + target_link_libraries(Primes_LF deepstate_LF) + target_link_libraries (Primes_LF "-fsanitize=fuzzer") + set_target_properties(Primes_LF PROPERTIES COMPILE_DEFINITIONS "LIBFUZZER") +endif() + add_executable(Euler Euler.cpp) target_link_libraries(Euler deepstate) +if (BUILD_LIBFUZZER) + add_executable(Euler_LF Euler.cpp) + target_link_libraries(Euler_LF deepstate_LF) + target_link_libraries (Euler_LF "-fsanitize=fuzzer") + set_target_properties(Euler_LF PROPERTIES COMPILE_DEFINITIONS "LIBFUZZER") +endif() + add_executable(IntegerOverflow IntegerOverflow.cpp) target_link_libraries(IntegerOverflow deepstate) +if (BUILD_LIBFUZZER) + add_executable(IntegerOverflow_LF IntegerOverflow.cpp) + target_link_libraries(IntegerOverflow_LF deepstate_LF) + target_link_libraries (IntegerOverflow_LF "-fsanitize=fuzzer") + set_target_properties(IntegerOverflow_LF PROPERTIES COMPILE_DEFINITIONS "LIBFUZZER") +endif() + add_executable(IntegerArithmetic IntegerArithmetic.cpp) target_link_libraries(IntegerArithmetic deepstate) +if (BUILD_LIBFUZZER) + add_executable(IntegerArithmetic_LF IntegerArithmetic.cpp) + target_link_libraries(IntegerArithmetic_LF deepstate_LF) + target_link_libraries (IntegerArithmetic_LF "-fsanitize=fuzzer") + set_target_properties(IntegerArithmetic_LF PROPERTIES COMPILE_DEFINITIONS "LIBFUZZER") +endif() + add_executable(Lists Lists.cpp) target_link_libraries(Lists deepstate) +if (BUILD_LIBFUZZER) + add_executable(Lists_LF Lists.cpp) + target_link_libraries(Lists_LF deepstate_LF) + target_link_libraries (Lists_LF "-fsanitize=fuzzer") + set_target_properties(Lists_LF PROPERTIES COMPILE_DEFINITIONS "LIBFUZZER") +endif() + add_executable(StreamingAndFormatting StreamingAndFormatting.cpp) target_link_libraries(StreamingAndFormatting deepstate) +if (BUILD_LIBFUZZER) + add_executable(StreamingAndFormatting_LF StreamingAndFormatting.cpp) + target_link_libraries(StreamingAndFormatting_LF deepstate_LF) + target_link_libraries (StreamingAndFormatting_LF "-fsanitize=fuzzer") + set_target_properties(StreamingAndFormatting_LF PROPERTIES COMPILE_DEFINITIONS "LIBFUZZER") +endif() + add_executable(Squares Squares.c) target_link_libraries(Squares deepstate) set_target_properties(Squares PROPERTIES COMPILE_DEFINITIONS "DEEPSTATE_TEST") diff --git a/examples/Crash.cpp b/examples/Crash.cpp index ca0e66f..7aa1fc5 100644 --- a/examples/Crash.cpp +++ b/examples/Crash.cpp @@ -36,7 +36,9 @@ TEST(Crash, SegFault) { ASSERT_EQ(x, x); } +#ifndef LIBFUZZER int main(int argc, char *argv[]) { DeepState_InitOptions(argc, argv); return DeepState_Run(); } +#endif diff --git a/examples/Euler.cpp b/examples/Euler.cpp index 20f9790..8f2dd0d 100644 --- a/examples/Euler.cpp +++ b/examples/Euler.cpp @@ -39,7 +39,9 @@ TEST(Euler, SumsOfLikePowers) { << "^5 + " << d << "^5 = " << e << "^5"; } +#ifndef LIBFUZZER int main(int argc, char *argv[]) { DeepState_InitOptions(argc, argv); return DeepState_Run(); } +#endif diff --git a/examples/Fixture.cpp b/examples/Fixture.cpp index a4af0e1..2c864c6 100644 --- a/examples/Fixture.cpp +++ b/examples/Fixture.cpp @@ -36,8 +36,9 @@ TEST_F(MyTest, Something) { ASSUME_NE(x, 0); } +#ifndef LIBFUZZER int main(int argc, char *argv[]) { DeepState_InitOptions(argc, argv); return DeepState_Run(); } - +#endif diff --git a/examples/IntegerArithmetic.cpp b/examples/IntegerArithmetic.cpp index 37b2ac0..7af644d 100644 --- a/examples/IntegerArithmetic.cpp +++ b/examples/IntegerArithmetic.cpp @@ -45,7 +45,9 @@ TEST(Arithmetic, InvertibleMultiplication_CanFail) { }); } +#ifndef LIBFUZZER int main(int argc, char *argv[]) { DeepState_InitOptions(argc, argv); return DeepState_Run(); } +#endif diff --git a/examples/IntegerOverflow.cpp b/examples/IntegerOverflow.cpp index 09fd32f..c5add45 100644 --- a/examples/IntegerOverflow.cpp +++ b/examples/IntegerOverflow.cpp @@ -40,7 +40,9 @@ TEST(SignedInteger, MultiplicationOverflow) { << x << " squared overflowed."; } +#ifndef LIBFUZZER int main(int argc, char *argv[]) { DeepState_InitOptions(argc, argv); return DeepState_Run(); } +#endif diff --git a/examples/Lists.cpp b/examples/Lists.cpp index 1e4ad12..8d21f6c 100644 --- a/examples/Lists.cpp +++ b/examples/Lists.cpp @@ -31,7 +31,9 @@ TEST(Vector, DoubleReversal) { }); } +#ifndef LIBFUZZER int main(int argc, char *argv[]) { DeepState_InitOptions(argc, argv); DeepState_Run(); } +#endif diff --git a/examples/Primes.cpp b/examples/Primes.cpp index 161527d..1401d35 100644 --- a/examples/Primes.cpp +++ b/examples/Primes.cpp @@ -53,8 +53,9 @@ TEST(PrimePolynomial, OnlyGeneratesPrimes_NoStreaming) { DeepState_Assert(IsPrime(Pump(poly))); } - +#ifndef LIBFUZZER int main(int argc, char *argv[]) { DeepState_InitOptions(argc, argv); return DeepState_Run(); } +#endif diff --git a/examples/StreamingAndFormatting.cpp b/examples/StreamingAndFormatting.cpp index f2fb956..f34c8fe 100644 --- a/examples/StreamingAndFormatting.cpp +++ b/examples/StreamingAndFormatting.cpp @@ -40,7 +40,9 @@ TEST(Formatting, OverridePrintf) { printf("hello again!"); } +#ifndef LIBFUZZER int main(int argc, char *argv[]) { DeepState_InitOptions(argc, argv); return DeepState_Run(); } +#endif