1 #!/bin/bash 2 3 # Copyright (C) 2018 The Android Open Source Project 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 set -euo pipefail 18 19 OUTDIR=out/linux_fuzzer_run 20 21 tools/gn gen "$OUTDIR" \ 22 --args="is_clang=true is_debug=false is_fuzzer=true is_asan=true" \ 23 --check 24 25 tools/ninja -C $OUTDIR 26 27 FUZZERS=$(cd $OUTDIR && ls *fuzzer) 28 29 for fuzzer in $FUZZERS; do 30 mkdir -p "fuzz_out/$fuzzer/corpus" 31 mkdir -p "fuzz_out/$fuzzer/artifacts" 32 for crash in $(ls fuzz_out/$fuzzer/artifacts/crash-* 2> /dev/null); do 33 if "$OUTDIR/$fuzzer" "$crash"; then 34 rm $crash; 35 else 36 echo "$crash still exists" 37 fi 38 done; 39 40 "$OUTDIR/$fuzzer" -artifact_prefix="fuzz_out/$fuzzer/artifacts/" \ 41 "fuzz_out/$fuzzer/corpus" 2> "fuzz_out/$fuzzer/log.err" & 42 done 43 44 for job in `jobs -p` 45 do 46 wait $job 47 done 48