From: Evgeny Vereshchagin Date: Mon, 26 Apr 2021 21:41:54 +0000 (+0000) Subject: tests: run the fuzzers along with the other tests X-Git-Tag: lxc-5.0.0~189^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=aa96786737b534c9549429eb1eb39fdd9a3c9187;p=thirdparty%2Flxc.git tests: run the fuzzers along with the other tests Signed-off-by: Evgeny Vereshchagin --- diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index 638d19607..fa1cdebfb 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -811,6 +811,8 @@ fuzz_lxc_define_load_LDADD = $(LDADD) $(LIB_FUZZING_ENGINE) bin_PROGRAMS += fuzz-lxc-config-read \ fuzz-lxc-define-load + +bin_SCRIPTS += lxc-test-fuzzers endif endif diff --git a/src/tests/lxc-test-fuzzers b/src/tests/lxc-test-fuzzers new file mode 100755 index 000000000..29fdb5bb2 --- /dev/null +++ b/src/tests/lxc-test-fuzzers @@ -0,0 +1,25 @@ +#!/bin/bash + +set -eux +set -o pipefail + +TMP_DIR=`mktemp -d` +export ASAN_OPTIONS=${ASAN_OPTIONS:-detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1:strict_string_checks=1} +export UBSAN_OPTIONS=${UBSAN_OPTIONS:-print_stacktrace=1:print_summary=1:halt_on_error=1} + +cleanup() { + rm -rf "$TMP_DIR" +} + +trap cleanup exit + +for fuzzer in /usr/bin/fuzz-lxc-*; do + name=$(basename "$fuzzer") + corpus_dir="$TMP_DIR/$name" + + mkdir -p "$corpus_dir" + if wget --directory-prefix="$TMP_DIR" https://storage.googleapis.com/lxc-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/lxc_$name/public.zip; then + unzip -q -d "$corpus_dir" "$TMP_DIR/public.zip" + fi + "$fuzzer" -max_total_time=120 "$corpus_dir" +done