Skip to content

Commit

Permalink
Add oss-fuzz build script
Browse files Browse the repository at this point in the history
  • Loading branch information
nathaniel-brough committed Apr 26, 2023
1 parent 9242192 commit 3119f19
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ endforeach ()
# on clang/msvc and isn't supported with GCC. If you need to use these fuzzers
# with a GCC based project you should consider looking into the LIB_FUZZING_ENGINE
# env variable defined in `test/fuzz/CMakeLists.txt`.
set(CMAKE_REQUIRED_LINK_OPTIONS "-fsanitize=fuzzer,address")
set(CMAKE_REQUIRED_FLAGS "-fsanitize=fuzzer-no-link,address")
set(CMAKE_REQUIRED_LINK_OPTIONS "-fsanitize=fuzzer")
set(CMAKE_REQUIRED_FLAGS "-fsanitize=fuzzer-no-link")
check_cxx_source_compiles([[
#include <cstdint>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, std::size_t Size) {
Expand All @@ -118,8 +118,8 @@ cmake_dependent_option(
)

if (WITH_TEST_FUZZ)
message(VERBOSE "Building fuzz tests enabled")
message(STATUS "Building fuzz tests enabled")
add_subdirectory(fuzz)
else ()
message(VERBOSE "Building fuzz tests disabled")
message(STATUS "Building fuzz tests disabled")
endif ()
9 changes: 9 additions & 0 deletions tests/fuzz/oss-fuzz-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set euxo pipefail

conan install . --build=missing --update -s build_type=Release -o curaengine:enable_testing=True
cmake --preset release -DWITH_TEST_FUZZ=ON
cmake --build --preset release -j$(nproc)

find . -name FuzzGcodeExport
#cp build/Release/tests/fuzz/Fuzz* $OUT

0 comments on commit 3119f19

Please sign in to comment.