Skip to content

Commit 6ac4773

Browse files
authored
Only build fuzzers when fuzzing. (simdjson#822)
1 parent 0e6ea76 commit 6ac4773

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

fuzz/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,14 @@ if(ENABLE_FUZZING)
4242
endif ()
4343
target_link_libraries(simdjson-fuzzer INTERFACE simdjson-flags)
4444
target_link_libraries(simdjson-fuzzer INTERFACE ${SIMDJSON_FUZZ_LDFLAGS})
45-
45+
46+
# Define the fuzzers
47+
add_custom_target(all_fuzzers)
48+
4649
function(implement_fuzzer name)
4750
add_executable(${name} ${name}.cpp)
4851
target_link_libraries(${name} PRIVATE simdjson-fuzzer)
52+
add_dependencies(all_fuzzers ${name})
4953
add_test(${name} ${name})
5054
set_property(TEST ${name} APPEND PROPERTY LABELS fuzz)
5155
endfunction()

fuzz/build_fuzzer_variants.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if [ ! -d build-$variant ] ; then
2727
-DSIMDJSON_FUZZ_LINKMAIN=On \
2828
-DSIMDJSON_IMPLEMENTATION_HASWELL=0
2929

30-
ninja
30+
ninja all_fuzzers
3131
cd ..
3232
fi
3333

@@ -45,7 +45,7 @@ if [ ! -d build-$variant ] ; then
4545
-DENABLE_FUZZING=On \
4646
-DSIMDJSON_FUZZ_LINKMAIN=On
4747

48-
ninja
48+
ninja all_fuzzers
4949
cd ..
5050
fi
5151

@@ -71,7 +71,7 @@ if [ ! -d build-$variant ] ; then
7171
-DSIMDJSON_FUZZ_LDFLAGS=$LIB_FUZZING_ENGINE \
7272
-DSIMDJSON_IMPLEMENTATION_HASWELL=0
7373

74-
ninja
74+
ninja all_fuzzers
7575
cd ..
7676
fi
7777

@@ -99,7 +99,7 @@ if which clang++-9 >/dev/null 2>&1 ; then
9999
-DSIMDJSON_FUZZ_LDFLAGS=$LIB_FUZZING_ENGINE \
100100
-DSIMDJSON_IMPLEMENTATION_HASWELL=0
101101

102-
ninja
102+
ninja all_fuzzers
103103
cd ..
104104
fi
105105
else
@@ -127,7 +127,7 @@ if [ ! -d build-$variant ] ; then
127127
-DSIMDJSON_FUZZ_LINKMAIN=Off \
128128
-DSIMDJSON_FUZZ_LDFLAGS=$LIB_FUZZING_ENGINE
129129

130-
ninja
130+
ninja all_fuzzers
131131
cd ..
132132
fi
133133

@@ -152,7 +152,7 @@ if which clang++-9 >/dev/null 2>&1 ; then
152152
-DSIMDJSON_FUZZ_LINKMAIN=Off \
153153
-DSIMDJSON_FUZZ_LDFLAGS=$LIB_FUZZING_ENGINE
154154

155-
ninja
155+
ninja all_fuzzers
156156

157157
cd ..
158158
fi

fuzz/measure_coverage.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if [ ! -d $bdir ] ; then
2626
-DSIMDJSON_BUILD_STATIC=On \
2727
-DENABLE_FUZZING=On \
2828
-DSIMDJSON_FUZZ_LINKMAIN=On
29-
ninja
29+
ninja all_fuzzers
3030
cd ..
3131
fi
3232

fuzz/ossfuzz.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ cmake .. \
3434
-DSIMDJSON_FUZZ_LINKMAIN=Off \
3535
-DSIMDJSON_FUZZ_LDFLAGS=$LIB_FUZZING_ENGINE
3636

37-
cmake --build .
37+
cmake --build . --target all_fuzzers
3838

3939
cp fuzz/fuzz_* $OUT
4040

0 commit comments

Comments
 (0)