mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
libFuzzer infrastructure
This commit is contained in:
parent
b7a17bf8dd
commit
0847889db6
@ -588,6 +588,7 @@ if (FUZZER)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
add_custom_command(TARGET fuzzers POST_BUILD COMMAND SRC=${CMAKE_SOURCE_DIR} BIN=${CMAKE_BINARY_DIR} OUT=${CMAKE_BINARY_DIR}/programs ${CMAKE_SOURCE_DIR}/tests/fuzz/build.sh VERBATIM)
|
||||
endif()
|
||||
|
||||
include (cmake/sanitize_targets.cmake)
|
||||
|
@ -100,6 +100,7 @@ fi
|
||||
mv ./programs/clickhouse* /output || mv ./programs/*_fuzzer /output
|
||||
[ -x ./programs/self-extracting/clickhouse ] && mv ./programs/self-extracting/clickhouse /output
|
||||
mv ./src/unit_tests_dbms /output ||: # may not exist for some binary builds
|
||||
mv ./programs/*.dict ./programs/*.options ./programs/*_seed_corpus.zip /output ||: # libFuzzer oss-fuzz compatible infrastructure
|
||||
|
||||
prepare_combined_output () {
|
||||
local OUTPUT
|
||||
|
@ -330,25 +330,15 @@ def main():
|
||||
image_name, Path("../../docker/test/libfuzzer/")
|
||||
) # get_image_with_version(reports_path, image_name)
|
||||
|
||||
fuzzers_tmp_path = os.path.join(temp_path, "fuzzers_tmp")
|
||||
if not os.path.exists(fuzzers_tmp_path):
|
||||
os.makedirs(fuzzers_tmp_path)
|
||||
fuzzers_path = os.path.join(temp_path, "fuzzers")
|
||||
if not os.path.exists(fuzzers_path):
|
||||
os.makedirs(fuzzers_path)
|
||||
|
||||
# if validate_bugfix_check:
|
||||
# download_last_release(packages_path)
|
||||
# else:
|
||||
# download_all_deb_packages(check_name, reports_path, packages_path)
|
||||
download_fuzzers(check_name, reports_path, fuzzers_tmp_path)
|
||||
|
||||
fuzzers_path = os.path.join(temp_path, "fuzzers")
|
||||
for fuzzer in os.listdir(fuzzers_tmp_path):
|
||||
fuzzer_path = os.path.join(fuzzers_path, fuzzer)
|
||||
os.makedirs(fuzzer_path)
|
||||
os.rename(
|
||||
os.path.join(fuzzers_tmp_path, fuzzer), os.path.join(fuzzer_path, fuzzer)
|
||||
)
|
||||
|
||||
os.rmdir(fuzzers_tmp_path)
|
||||
download_fuzzers(check_name, reports_path, fuzzers_path)
|
||||
|
||||
# server_log_path = os.path.join(temp_path, "server_log")
|
||||
# if not os.path.exists(server_log_path):
|
||||
|
28
tests/fuzz/build.sh
Executable file
28
tests/fuzz/build.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash -eu
|
||||
|
||||
# copy fuzzer options and dictionaries
|
||||
cp $SRC/tests/fuzz/*.dict $OUT/
|
||||
cp $SRC/tests/fuzz/*.options $OUT/
|
||||
|
||||
# prepare corpus dirs
|
||||
mkdir -p $BIN/tests/fuzz/lexer_fuzzer.in/
|
||||
mkdir -p $BIN/tests/fuzz/select_parser_fuzzer.in/
|
||||
mkdir -p $BIN/tests/fuzz/create_parser_fuzzer.in/
|
||||
mkdir -p $BIN/tests/fuzz/execute_query_fuzzer.in/
|
||||
|
||||
# prepare corpus
|
||||
cp $SRC/tests/queries/0_stateless/*.sql $BIN/tests/fuzz/lexer_fuzzer.in/
|
||||
cp $SRC/tests/queries/0_stateless/*.sql $BIN/tests/fuzz/select_parser_fuzzer.in/
|
||||
cp $SRC/tests/queries/0_stateless/*.sql $BIN/tests/fuzz/create_parser_fuzzer.in/
|
||||
cp $SRC/tests/queries/0_stateless/*.sql $BIN/tests/fuzz/execute_query_fuzzer.in/
|
||||
cp $SRC/tests/queries/1_stateful/*.sql $BIN/tests/fuzz/lexer_fuzzer.in/
|
||||
cp $SRC/tests/queries/1_stateful/*.sql $BIN/tests/fuzz/select_parser_fuzzer.in/
|
||||
cp $SRC/tests/queries/1_stateful/*.sql $BIN/tests/fuzz/create_parser_fuzzer.in/
|
||||
cp $SRC/tests/queries/1_stateful/*.sql $BIN/tests/fuzz/execute_query_fuzzer.in/
|
||||
|
||||
# build corpus archives
|
||||
cd $BIN/tests/fuzz
|
||||
for dir in *_fuzzer.in; do
|
||||
fuzzer=$(basename $dir .in)
|
||||
zip -rj "$OUT/${fuzzer}_seed_corpus.zip" "${dir}/"
|
||||
done
|
Loading…
Reference in New Issue
Block a user