blob: a3193dd06483d0372d0a300f69a3dd221272a066 [file] [log] [blame]
Florian Mayerfc724152018-12-06 16:58:24 +00001#!/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
17set -euo pipefail
18
19OUTDIR=out/linux_fuzzer_run
20
Florian Mayer2e480712018-12-07 16:25:41 +000021tools/gn gen "$OUTDIR" \
22 --args="is_clang=true is_debug=false is_fuzzer=true is_asan=true" \
Florian Mayerfc724152018-12-06 16:58:24 +000023 --check
24
Florian Mayer2d82f142018-12-06 17:13:13 +000025tools/ninja -C $OUTDIR
Florian Mayerfc724152018-12-06 16:58:24 +000026
27FUZZERS=$(cd $OUTDIR && ls *fuzzer)
28
29for 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" &
42done
43
44for job in `jobs -p`
45do
46 wait $job
47done