1#!/bin/bash -eu 2# Copyright 2019 Google Inc. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16################################################################################ 17 18# Build pcre dependency to be linked statically. 19pushd $SRC/pcre 20./autogen.sh 21CFLAGS="$CFLAGS -fno-use-cxa-atexit" CXXFLAGS="$CXXFLAGS -fno-use-cxa-atexit" ./configure 22make -j$(nproc) clean 23make -j$(nproc) all 24popd 25 26# build project 27rm -rf build 28 29./configure 30make njs_fuzzer 31 32cp ./build/njs_process_script_fuzzer $OUT/ 33 34SEED_CORPUS_PATH=$OUT/njs_process_script_fuzzer_seed_corpus 35mkdir -p $SEED_CORPUS_PATH 36 37set +x 38cat src/test/njs_interactive_test.c src/test/njs_unit_test.c \ 39 | egrep -o '".*"' | awk '{print substr($0,2,length($0)-2)}' | sort | uniq \ 40 | while IFS= read -r line; do 41 echo $line > $SEED_CORPUS_PATH/$(echo $line | sha1sum | awk '{ print $1 }'); 42 done 43set -x 44 45cp -r test/fs test/module $SEED_CORPUS_PATH 46 47zip -q $SEED_CORPUS_PATH.zip $SEED_CORPUS_PATH 48rm -rf $SEED_CORPUS_PATH 49