Skip to content

Commit 4c9a2a3

Browse files
committed
cfl: change base path to a seed corpus and dicts
The ClusterFuzzLite uses a Git repo for for storing corpora. The corpus have to be uploaded in the repository under the folder `/corpus/<fuzz_target>/` for each fuzzer, see [1]. But CTest and ClusterFuzzLite build script used seed corpus under the folder `/<fuzz_target>/`, and uploaded corpora was not used by following ClusterFuzzLite runs. The patch fixes location of the seed corpus used by CTest and ClusterFuzzLite build script. 1. https://google.github.io/clusterfuzzlite/running-clusterfuzzlite/github-actions/#storage-repo
1 parent 72fac0e commit 4c9a2a3

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

.clusterfuzzlite/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ git config --global --add safe.directory '*'
5454
cmake "${cmake_args[@]}" -S . -B build -G Ninja
5555
cmake --build build --parallel
5656

57-
cp corpus/*.dict corpus/*.options $OUT/
57+
cp corpus/corpus/*.dict corpus/corpus/*.options $OUT/
5858

5959
# Copy the fuzzer executables, zip-ed corpora, option and
6060
# dictionary files to $OUT.
@@ -70,7 +70,7 @@ for f in $(find build/tests/ -name '*_test' -type f);
7070
do
7171
name=$(basename $f);
7272
module=$(echo $name | sed 's/_test//')
73-
corpus_dir="corpus/$module"
73+
corpus_dir="corpus/corpus/$name"
7474
echo "Copying for $module";
7575
cp $f $OUT/
7676
if [ -e "$corpus_dir" ]; then

tests/capi/CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ string(JOIN " " LIBFUZZER_OPTS
6666
-use_value_profile=1
6767
)
6868

69+
set(CORPUS_BASE_PATH ${PROJECT_SOURCE_DIR}/corpus)
70+
if(USE_LUAJIT)
71+
set(CORPUS_BASE_PATH ${CORPUS_BASE_PATH}/corpus)
72+
endif()
73+
6974
function(create_test)
7075
cmake_parse_arguments(
7176
FUZZ
@@ -89,8 +94,11 @@ function(create_test)
8994
if (IS_LUAJIT AND (${test_name} STREQUAL "lua_load_test"))
9095
set(LIBFUZZER_OPTS "${LIBFUZZER_OPTS} -only_ascii=1")
9196
endif ()
92-
set(dict_path ${PROJECT_SOURCE_DIR}/corpus/${test_name}.dict)
93-
set(corpus_path ${PROJECT_SOURCE_DIR}/corpus/${test_prefix})
97+
set(dict_path ${CORPUS_BASE_PATH}/${test_name}.dict)
98+
set(corpus_path ${CORPUS_BASE_PATH}/${test_prefix})
99+
if(USE_LUAJIT)
100+
set(corpus_path ${CORPUS_BASE_PATH}/${test_name})
101+
endif()
94102
if (EXISTS ${dict_path})
95103
set(LIBFUZZER_OPTS "${LIBFUZZER_OPTS} -dict=${dict_path}")
96104
endif ()

0 commit comments

Comments
 (0)