[infra] setting current directory to src checkout (#87)

This commit is contained in:
Mike Aizatsky 2016-11-17 09:49:34 -08:00 committed by GitHub
parent 13fb627a94
commit 5dfb810427
47 changed files with 46 additions and 60 deletions

View File

@ -40,11 +40,12 @@ Create a fuzzer and add it to the *target_name/* directory as well.
This is the Docker image definition that build.sh will be executed in.
It is very simple for most libraries:
```docker
FROM ossfuzz/base-libfuzzer # base image with clang toolchain
MAINTAINER YOUR_EMAIL # each file should have a maintainer
RUN apt-get install -y ... # install required packages to build a project
RUN git checkout <git_url> # checkout all sources needed to build your target
COPY build.sh fuzzer.cc /src/ # install build script and other source files.
FROM ossfuzz/base-libfuzzer # base image with clang toolchain
MAINTAINER YOUR_EMAIL # each file should have a maintainer
RUN apt-get install -y ... # install required packages to build a project
RUN git checkout <git_url> <checkout_dir> # checkout all sources needed to build your target
WORKDIR <checkout_dir> # current directory for build script
COPY build.sh fuzzer.cc /src/ # install build script and other source files.
```
Expat example: [expat/Dockerfile](../targets/expat/Dockerfile)
@ -95,7 +96,6 @@ For expat, this looks like:
```bash
#!/bin/bash -eu
cd /src/expat/expat
./buildconf.sh
# configure scripts usually use correct environment variables.
./configure

View File

@ -17,6 +17,8 @@
echo "---------------------------------------------------------------"
pushd .
echo -n "Compiling libFuzzer into /usr/lib/libfuzzer.a ..."
mkdir -p /work/libfuzzer
cd /work/libfuzzer
@ -35,5 +37,5 @@ echo "FUZZER_LDFLAGS=$FUZZER_LDFLAGS"
echo "---------------------------------------------------------------"
cd /src
popd >/dev/null 2>&1
bash -x /src/build.sh

View File

@ -262,15 +262,18 @@ def generate(generate_args):
print('Writing new files to', dir)
template_args = {
'target_name' : args.target_name
}
with open(os.path.join(dir, 'Jenkinsfile'), 'w') as f:
f.write(templates.JENKINS_TEMPLATE)
f.write(templates.JENKINS_TEMPLATE % template_args)
with open(os.path.join(dir, 'Dockerfile'), 'w') as f:
f.write(templates.DOCKER_TEMPLATE)
f.write(templates.DOCKER_TEMPLATE % template_args)
build_sh_path = os.path.join(dir, 'build.sh')
with open(build_sh_path, 'w') as f:
f.write(templates.BUILD_TEMPLATE % args.target_name)
f.write(templates.BUILD_TEMPLATE % template_args)
targets_readme_path = os.path.join('targets', 'README.md')
update_targets_readme(targets_readme_path, args.target_name, dir)

View File

@ -59,7 +59,8 @@ DOCKER_TEMPLATE = """\
FROM ossfuzz/base-libfuzzer
MAINTAINER your@email.com
RUN apt-get install -y make autoconf automake libtool
RUN git clone <git_url> # or use other version control
RUN git clone <git_url> %(target_name)s # or use other version control
WORKDIR %(target_name)s
COPY build.sh /src/
"""
@ -81,8 +82,6 @@ BUILD_TEMPLATE = """\
#
################################################################################
cd /src/%s
# build the target.
# e.g.
#

View File

@ -18,4 +18,5 @@ FROM ossfuzz/base-libfuzzer
MAINTAINER mmoroz@chromium.org
RUN apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/c-ares/c-ares.git
WORKDIR c-ares
COPY build.sh *_fuzzer.cc /src/

View File

@ -15,8 +15,6 @@
#
################################################################################
cd /src/c-ares
export LDFLAGS="$FUZZER_LDFLAGS"
# Build the target.
@ -29,4 +27,4 @@ make CFLAGS= -j$(nproc) all
$CXX $CXXFLAGS -std=c++11 -I. \
/src/c_ares_ares_create_query_fuzzer.cc \
-o /out/c_ares_ares_create_query_fuzzer \
-lfuzzer /src/c-ares/.libs//libcares.a $FUZZER_LDFLAGS
-lfuzzer /src/c-ares/.libs/libcares.a $FUZZER_LDFLAGS

View File

@ -19,5 +19,6 @@ MAINTAINER dvyukov@google.com
RUN apt-get install -y make autoconf automake libtool libssl-dev zlib1g-dev
RUN git clone https://github.com/curl/curl.git
WORKDIR curl
COPY build.sh curl_fuzzer.cc *.options *.dict /src/

View File

@ -15,7 +15,6 @@
#
################################################################################
cd /src/curl
./buildconf
./configure --disable-shared --enable-debug --enable-maintainer-mode --disable-symbol-hiding --disable-threaded-resolver --enable-ipv6 --with-random=/dev/null
make -j$(nproc)

View File

@ -19,4 +19,5 @@ MAINTAINER mike.aizatsky@gmail.com
RUN apt-get install -y make autoconf automake libtool docbook2x
RUN git clone git://git.code.sf.net/p/expat/code_git expat
WORKDIR expat/expat
COPY build.sh parse_fuzzer.* xml.dict /src/

View File

@ -14,7 +14,6 @@
# limitations under the License.
#
################################################################################
cd /src/expat/expat
./buildconf.sh
./configure

View File

@ -18,4 +18,5 @@ FROM ossfuzz/base-libfuzzer
MAINTAINER mike.aizatsky@gmail.com
RUN apt-get install -y make autoconf automake libtool shtool
RUN git clone https://github.com/file/file.git
WORKDIR file
COPY build.sh magic_fuzzer.cc /src/

View File

@ -15,8 +15,6 @@
#
################################################################################
cd /src/file
autoreconf -i
./configure --enable-static
make V=1 all

View File

@ -19,4 +19,5 @@ MAINTAINER mike.aizatsky@gmail.com
RUN apt-get install -y make autoconf libtool libarchive-dev
RUN git clone git://git.sv.nongnu.org/freetype/freetype2.git
WORKDIR freetype2
COPY build.sh /src/

View File

@ -15,7 +15,6 @@
# limitations under the License.
#
################################################################################
cd /src/freetype2/
./autogen.sh
./configure

View File

@ -19,4 +19,5 @@ MAINTAINER mmoroz@chromium.org
RUN apt-get install -y make autoconf automake libtool ragel pkg-config
RUN git clone https://anongit.freedesktop.org/git/harfbuzz.git
WORKDIR harfbuzz
COPY build.sh harfbuzz_fuzzer.cc /src/

View File

@ -15,8 +15,6 @@
#
################################################################################
cd /src/harfbuzz
# Build the library.
./autogen.sh
export LDFLAGS=$FUZZER_LDFLAGS

View File

@ -19,4 +19,5 @@ MAINTAINER vitalybuka@gmail.com
RUN apt-get install -y binutils gcc
RUN git clone https://github.com/nlohmann/json.git
WORKDIR /src/json/
COPY build.sh parse_fuzzer.* /src/

View File

@ -15,9 +15,7 @@
#
################################################################################
cd /src/json
$CXX $CXXFLAGS -std=c++11 -I/src/json/src/ \
$CXX $CXXFLAGS -std=c++11 -Isrc/ \
/src/parse_fuzzer.cc -o /out/parse_fuzzer \
-lfuzzer $FUZZER_LDFLAGS

View File

@ -18,4 +18,5 @@ FROM ossfuzz/base-libfuzzer
MAINTAINER kcwu@google.com
RUN apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/mm2/Little-CMS.git lcms
WORKDIR lcms
COPY build.sh cmsIT8_load_fuzzer.* cms_transform_fuzzer.* icc.dict /src/

View File

@ -15,8 +15,6 @@
#
################################################################################
cd /src/lcms
# build the target.
./configure
make -j$(nproc) all

View File

@ -23,4 +23,5 @@ RUN apt-get install -y make autoconf automake libtool pkg-config \
libbz2-dev liblzo2-dev liblzma-dev liblz4-dev libz-dev \
libxml2-dev libssl-dev
RUN git clone https://github.com/libarchive/libarchive.git
WORKDIR libarchive
COPY build.sh libarchive_fuzzer.cc /src/

View File

@ -15,8 +15,6 @@
#
################################################################################
cd /src/libarchive
# build the target.
./build/autogen.sh
./configure

View File

@ -15,9 +15,7 @@
#
################################################################################
cd /src
cd fribidi
cd /src/fribidi
./bootstrap
./configure --enable-static=yes --enable-shared=no --with-pic=yes
# Don't run "make": it's broken. Run "make install".

View File

@ -19,4 +19,5 @@ MAINTAINER kcwu@csie.org
RUN apt-get install -y make autoconf automake libtool texinfo
RUN git clone https://github.com/chewing/libchewing.git
WORKDIR libchewing
COPY build.sh chewing_fuzzer_common.[ch] chewing_*_fuzzer.c /src/

View File

@ -15,8 +15,6 @@
#
################################################################################
cd /src/libchewing
# build the library.
./autogen.sh
./configure --disable-shared --enable-static --without-sqlite3

View File

@ -24,4 +24,5 @@ RUN curl -o afl-testcases/afl_testcases.tgz http://lcamtuf.coredump.cx/afl/demo/
RUN cd afl-testcases/ && tar -xf afl_testcases.tgz
RUN zip libjpeg_turbo_fuzzer_seed_corpus.zip afl-testcases/jpeg/full/images/*
WORKDIR libjpeg-turbo
COPY build.sh libjpeg_turbo_fuzzer.cc /src/

View File

@ -15,8 +15,6 @@
#
################################################################################
cd /src/libjpeg-turbo
autoreconf -fiv
./configure
make "-j$(nproc)"

View File

@ -19,4 +19,5 @@ MAINTAINER mmoroz@chromium.org
RUN apt-get install -y make autoconf automake libtool zlib1g-dev
RUN git clone git://git.code.sf.net/p/libpng/code libpng
WORKDIR libpng
COPY build.sh libpng_read_fuzzer.* png.dict /src/

View File

@ -15,8 +15,6 @@
#
################################################################################
cd /src/libpng
# Disable logging via library build configuration control.
cat scripts/pnglibconf.dfa | sed -e "s/option STDIO/option STDIO disabled/" \
> scripts/pnglibconf.dfa.temp
@ -32,4 +30,4 @@ $CXX $CXXFLAGS -std=c++11 -I. -lz \
/src/libpng_read_fuzzer.cc -o /out/libpng_read_fuzzer \
-lfuzzer .libs/libpng16.a $FUZZER_LDFLAGS
cp /src/*.dict /src/*.options /out/
cp /src/*.dict /src/*.options /out/

View File

@ -19,4 +19,5 @@ MAINTAINER kcwu@csie.org
RUN apt-get install -y make autoconf automake libtool pkg-config
RUN git clone git://people.freedesktop.org/~dvdhrm/libtsm
WORKDIR libtsm
COPY build.sh libtsm_fuzzer.c /src/

View File

@ -15,8 +15,6 @@
#
################################################################################
cd /src/libtsm
# build the library.
./autogen.sh
make -j$(nproc) clean all

View File

@ -19,6 +19,7 @@ MAINTAINER ochang@chromium.org
RUN apt-get install -y make autoconf automake libtool pkg-config
RUN git clone git://git.gnome.org/libxml2
WORKDIR libxml2
COPY build.sh /src/
COPY libxml2_xml_read_memory_fuzzer.* \

View File

@ -15,7 +15,6 @@
# limitations under the License.
#
################################################################################
cd /src/libxml2
./autogen.sh
./configure
@ -27,4 +26,4 @@ for fuzzer in libxml2_xml_read_memory_fuzzer libxml2_xml_regexp_compile_fuzzer;
-lfuzzer .libs/libxml2.a $FUZZER_LDFLAGS
done
cp /src/*.dict /src/*.options /out/
cp /src/*.dict /src/*.options /out/

View File

@ -22,4 +22,5 @@ RUN hg clone https://hg.mozilla.org/projects/nspr nspr
RUN hg clone https://hg.mozilla.org/projects/nss nss
RUN git clone https://github.com/mozilla/nss-fuzzing-corpus.git nss-corpus
WORKDIR nss
COPY build.sh fuzzers/* /src/

View File

@ -16,7 +16,6 @@
################################################################################
# Build the library.
cd /src/nss
make CCC="$CXX" XCFLAGS="$CXXFLAGS" SANITIZER_CFLAGS="$CXXFLAGS" \
BUILD_OPT=1 USE_64=1 NSS_DISABLE_GTESTS=1 ZDEFS_FLAG= \
nss_clean_all nss_build_all

View File

@ -18,4 +18,5 @@ FROM ossfuzz/base-libfuzzer
MAINTAINER kurt@roeckx.be
RUN apt-get install -y make
RUN git clone https://github.com/openssl/openssl.git
WORKDIR openssl
COPY build.sh /src/

View File

@ -15,8 +15,6 @@
#
################################################################################
cd /src/openssl
./config enable-fuzz-libfuzzer -DPEDANTIC no-shared --with-fuzzer-lib=/usr/lib/libfuzzer $CFLAGS
make -j$(nproc) EX_LIBS="-ldl $FUZZER_LDFLAGS"

View File

@ -18,5 +18,6 @@ FROM ossfuzz/base-libfuzzer
MAINTAINER mmoroz@chromium.org
RUN apt-get install -y make autoconf automake libtool pkg-config zlib1g-dev
RUN git clone https://github.com/khaledhosny/ots.git
WORKDIR /src/ots
COPY build.sh ots_fuzzer.* /src/
COPY seed_corpus /src/seed_corpus

View File

@ -15,8 +15,6 @@
#
################################################################################
cd /src/ots
# Build the target.
./autogen.sh
./configure

View File

@ -19,4 +19,5 @@ MAINTAINER wrengr@chromium.org
RUN apt-get install -y make autoconf automake libtool
RUN git clone https://code.googlesource.com/re2
COPY build.sh re2_fuzzer.* /src/
WORKDIR re2
COPY build.sh re2_fuzzer.* /src/

View File

@ -15,8 +15,6 @@
#
################################################################################
cd /src/re2
# First, build the re2 library.
# N.B., we don't follow the standard incantation for building re2
# (i.e., `make && make test && make install && make testinstall`),

View File

@ -27,4 +27,5 @@ RUN mkdir /src/sqlite3 && \
RUN find /src/sqlite3 -name "*.test" | xargs zip /src/ossfuzz_seed_corpus.zip
COPY build.sh *.dict *.options /src/
WORKDIR sqlite3
COPY build.sh *.dict *.options /src/

View File

@ -15,8 +15,6 @@
#
################################################################################
cd /src/sqlite3
mkdir bld
cd bld

View File

@ -19,4 +19,5 @@ MAINTAINER mmoroz@chromium.org
RUN apt-get install -y make autoconf automake libtool
RUN git clone --recursive https://github.com/google/woff2
WORKDIR woff2
COPY build.sh convert_woff2ttf_fuzzer.* /src/

View File

@ -15,8 +15,6 @@
#
################################################################################
cd /src/woff2
# Build the library. Actually there is no 'library' target, so we use .o files.
# '-no-canonical-prefixes' flag makes clang crazy. Need to avoid it.
cat brotli/shared.mk | sed -e "s/-no-canonical-prefixes//" \

View File

@ -19,4 +19,5 @@ MAINTAINER inferno@chromium.org
RUN apt-get install -y make autoconf automake libtool
RUN git clone https://github.com/madler/zlib.git
COPY build.sh zlib_uncompress_fuzzer.cc /src/
WORKDIR zlib
COPY build.sh zlib_uncompress_fuzzer.cc /src/

View File

@ -1,7 +1,5 @@
#!/bin/bash -eu
cd /src/zlib
./configure
make -j$(nproc) clean all