Fix fuzzer test script and add it to travis matrix (#606)

This commit is contained in:
Eugene Kliuchnikov 2017-09-26 13:49:30 +02:00 committed by GitHub
parent 5b4769990d
commit 4f8cd4c0f4
3 changed files with 29 additions and 8 deletions

View File

@ -45,6 +45,19 @@ matrix:
- gcc-4.4
- g++-4.4
###
## Test that fuzzer is compiling / working.
###
- os: linux
env: BUILD_SYSTEM=fuzz C_COMPILER=clang-4.0 CXX_COMPILER=clang++-4.0
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
packages:
- clang-4.0
###
## clang on Linux
###

View File

@ -1,6 +1,11 @@
#!/usr/bin/env bash
set -e
BROTLI="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
export CC=${CC:-cc}
export CXX=${CXX:-c++}
BROTLI="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )"
SRC=$BROTLI/c
cd $BROTLI
@ -8,16 +13,16 @@ rm -rf bin
mkdir bin
cd bin
cmake .. -B./ -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DENABLE_SANITIZER=address
make clean
make -j$(nproc) brotlidec
cmake $BROTLI -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" \
-DBUILD_TESTING=OFF -DENABLE_SANITIZER=address
make -j$(nproc) brotlidec-static
c++ -c -std=c++11 ../fuzz/decode_fuzzer.cc -I./include
ar rvs decode_fuzzer.a decode_fuzzer.o
c++ ../fuzz/run_decode_fuzzer.cc -o run_decode_fuzzer -lasan decode_fuzzer.a ./libbrotlidec.a ./libbrotlicommon.a
${CXX} -o run_decode_fuzzer -std=c++11 -fsanitize=address -I$SRC/include \
$SRC/fuzz/decode_fuzzer.cc $SRC/fuzz/run_decode_fuzzer.cc \
./libbrotlidec-static.a ./libbrotlicommon-static.a
mkdir decode_corpora
unzip ../java/org/brotli/integration/fuzz_data.zip -d decode_corpora
unzip $BROTLI/java/org/brotli/integration/fuzz_data.zip -d decode_corpora
for f in `ls decode_corpora`
do

View File

@ -51,6 +51,9 @@ case "$1" in
cd java/org/brotli
mvn install && cd integration && mvn verify
;;
"fuzz")
./c/fuzz/test_fuzzer.sh
;;
"bazel")
bazel test -c opt ...:all
;;