File: run_single.sh

package info (click to toggle)
glaze 6.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 7,312 kB
  • sloc: cpp: 109,539; sh: 99; ansic: 26; makefile: 13
file content (35 lines) | stat: -rwxr-xr-x 718 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
#
# invoked from run_all.sh
#
# runs a single fuzzer a limited time.
# if no problems are found, the results are removed.
# problems are found, logs and artifacts are left and the exit
# status is nonzero.

set -eu

fuzzer="$1"

if [ ! -x "$fuzzer" ] ; then
 exit 1
fi

shortname=$(basename "$fuzzer")

ARTIFACTS=artifacts/$shortname
CORPUS=$ARTIFACTS/corpus
LOG=$ARTIFACTS/$shortname.log

mkdir -p $ARTIFACTS $CORPUS

export UBSAN_OPTIONS=halt_on_error=1
export ASAN_OPTS=halt_on_error=1

if ! $fuzzer -max_total_time=40 -artifact_prefix=$ARTIFACTS/ $CORPUS >$LOG 2>&1 ; then
  echo FAIL - fuzzer $shortname failed - see $LOG
  exit 1
fi

echo OK - fuzzer $shortname ran without problems
rm -rf $ARTIFACTS/