From f2745e19c908a4c420badb440b9025cfc29e5984 Mon Sep 17 00:00:00 2001 From: Oscar Mira Date: Thu, 14 Mar 2019 16:30:05 +0100 Subject: [PATCH] add check script for regression testing Run the fuzz targets over the seed corpus with the standalone driver as part of the test suite. --- fuzz/Makefile.am | 7 ++++++- fuzz/jpegsave_buffer_fuzzer_corpus/.keep | 0 fuzz/pngsave_buffer_fuzzer_corpus/.keep | 0 fuzz/sharpen_fuzzer_corpus/.keep | 0 fuzz/test_fuzz.sh | 20 ++++++++++++++++++++ fuzz/thumbnail_fuzzer_corpus/.keep | 0 fuzz/webpsave_buffer_fuzzer_corpus/.keep | 0 7 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 fuzz/jpegsave_buffer_fuzzer_corpus/.keep create mode 100644 fuzz/pngsave_buffer_fuzzer_corpus/.keep create mode 100644 fuzz/sharpen_fuzzer_corpus/.keep create mode 100755 fuzz/test_fuzz.sh create mode 100644 fuzz/thumbnail_fuzzer_corpus/.keep create mode 100644 fuzz/webpsave_buffer_fuzzer_corpus/.keep diff --git a/fuzz/Makefile.am b/fuzz/Makefile.am index 8ad6d5cf..6169da14 100644 --- a/fuzz/Makefile.am +++ b/fuzz/Makefile.am @@ -1,3 +1,6 @@ +TESTS = \ + test_fuzz.sh + FUZZPROGS = \ jpegsave_buffer_fuzzer \ pngsave_buffer_fuzzer \ @@ -16,5 +19,7 @@ LDADD = ${top_builddir}/libvips/libvips.la @VIPS_LIBS@ @LIB_FUZZING_ENGINE@ libstandaloneengine_a_SOURCES = StandaloneFuzzTargetMain.c -noinst_PROGRAMS = $(FUZZPROGS) +check_PROGRAMS = $(FUZZPROGS) noinst_LIBRARIES = $(FUZZLIBS) + +EXTRA_DIST = $(TESTS) diff --git a/fuzz/jpegsave_buffer_fuzzer_corpus/.keep b/fuzz/jpegsave_buffer_fuzzer_corpus/.keep new file mode 100644 index 00000000..e69de29b diff --git a/fuzz/pngsave_buffer_fuzzer_corpus/.keep b/fuzz/pngsave_buffer_fuzzer_corpus/.keep new file mode 100644 index 00000000..e69de29b diff --git a/fuzz/sharpen_fuzzer_corpus/.keep b/fuzz/sharpen_fuzzer_corpus/.keep new file mode 100644 index 00000000..e69de29b diff --git a/fuzz/test_fuzz.sh b/fuzz/test_fuzz.sh new file mode 100755 index 00000000..02af3c48 --- /dev/null +++ b/fuzz/test_fuzz.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +#set -x +set -e + +# Glib is build without -fno-omit-frame-pointer. We need +# to disable the fast unwinder to get full stacktraces. +export ASAN_OPTIONS="fast_unwind_on_malloc=0:allocator_may_return_null=1" + +# Hide all warning messages from vips. +export VIPS_WARNING=0 + +ret=0 + +for fuzzer in *_fuzzer; do + find "${fuzzer}_corpus" -type f -not -empty -print0 \ + | xargs -0 -n1 "./$fuzzer" || ret=1 +done + +exit $ret diff --git a/fuzz/thumbnail_fuzzer_corpus/.keep b/fuzz/thumbnail_fuzzer_corpus/.keep new file mode 100644 index 00000000..e69de29b diff --git a/fuzz/webpsave_buffer_fuzzer_corpus/.keep b/fuzz/webpsave_buffer_fuzzer_corpus/.keep new file mode 100644 index 00000000..e69de29b