From: Douglas Bagnall Date: Wed, 20 Nov 2019 20:59:24 +0000 (+1300) Subject: lib/fuzzing/oss-fuzz: Add build_image.sh using Samba's bootstrap tools X-Git-Tag: ldb-2.1.0~646 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbb2377d51f00617e9065a8a3daecc8f5c340ca0;p=thirdparty%2Fsamba.git lib/fuzzing/oss-fuzz: Add build_image.sh using Samba's bootstrap tools Google's oss-fuzz environment is Ubuntu 16.04 based so we can just use the maintained bootstrap system rather than a manual package list here that will get out of date. Signed-off-by: Andrew Bartlett Signed-off-by: Douglas Bagnall Reviewed-by: Uri Simchoni Pair-programmed-by: Andrew Bartlett --- diff --git a/lib/fuzzing/oss-fuzz/build_image.sh b/lib/fuzzing/oss-fuzz/build_image.sh new file mode 100755 index 00000000000..6525c16fafe --- /dev/null +++ b/lib/fuzzing/oss-fuzz/build_image.sh @@ -0,0 +1,9 @@ +#!/bin/sh -e + +DIST=ubuntu1604 +SCRIPT_DIR=`dirname $0` + +$SCRIPT_DIR/../../../bootstrap/generated-dists/$DIST/bootstrap.sh +$SCRIPT_DIR/../../../bootstrap/generated-dists/$DIST/locale.sh + +cp $SCRIPT_DIR/build.sh $SRC/ diff --git a/lib/fuzzing/oss-fuzz/build_samba.sh b/lib/fuzzing/oss-fuzz/build_samba.sh index e5d85f7ba34..481af28f9ed 100755 --- a/lib/fuzzing/oss-fuzz/build_samba.sh +++ b/lib/fuzzing/oss-fuzz/build_samba.sh @@ -1,20 +1,32 @@ #!/bin/sh -e - +# +# This is not a general-purpose build script, but instead one specific to the Google oss-fuzz compile environment. +# +# https://google.github.io/oss-fuzz/getting-started/new-project-guide/#Requirements +# +# https://github.com/google/oss-fuzz/blob/master/infra/base-images/base-builder/README.md#provided-environment-variables +# # We have to push to oss-fuzz CFLAGS into the waf ADDITIONAL_CFLAGS # as otherwise waf's configure fails linking the first test binary -ADDITIONAL_CFLAGS=$CFLAGS +# +# CFLAGS are supplied by the caller, eg the oss-fuzz compile command +# +ADDITIONAL_CFLAGS="$CFLAGS" export ADDITIONAL_CFLAGS CFLAGS="" export CFLAGS -LD=$CXX +LD="$CXX" export LD +# $LIB_FUZZING_ENGINE is provided by the oss-fuzz "compile" command +# + ./configure -C --without-gettext --enable-debug --enable-developer \ --address-sanitizer --enable-libfuzzer \ --disable-warnings-as-errors \ --abi-check-disable \ - --fuzz-target-ldflags=$LIB_FUZZING_ENGINE \ - --nonshared-binary=ALL LINK_CC=$CXX + --fuzz-target-ldflags="$LIB_FUZZING_ENGINE" \ + --nonshared-binary=ALL LINK_CC="$CXX" make -j