|
14 | 14 | declare -A mode_config=( ["halt"]="-max_total_time=120 -timeout=1 -rss_limit_mb=2048" ["recover"]="-time=120 -timeout=10 -rss_limit_mb=2048" )
|
15 | 15 | fi
|
16 | 16 |
|
17 |
| -run_fuzzer() { |
18 |
| - if [ "$#" -lt 2 ]; then |
19 |
| - echo "usage: $0 <language> <halt|recover> <libFuzzer args...>" |
20 |
| - exit 1 |
21 |
| - fi |
22 |
| - |
23 |
| - lang="$1" |
24 |
| - shift |
25 |
| - mode="$1" |
26 |
| - shift |
27 |
| - # Treat remainder of arguments as libFuzzer arguments |
28 |
| - |
29 |
| - # Fuzzing logs and testcases are always written to `pwd`, so `cd` there first |
30 |
| - results="${root}/test/fuzz/out/fuzz-results/${lang}" |
31 |
| - mkdir -p "${results}" |
32 |
| - cd "${results}" |
33 |
| - |
34 |
| - # Create a corpus directory, so new discoveries are stored on disk. These will |
35 |
| - # then be loaded on subsequent fuzzing runs |
36 |
| - mkdir -p corpus |
37 |
| - |
38 |
| - pwd |
39 |
| - "../../${lang}_fuzzer" "-dict=../../${lang}.dict" "-artifact_prefix=${lang}_" -max_len=2048 "${mode_config[$mode]}" "./corpus" "$@" |
40 |
| -} |
| 17 | +if [ "$#" -lt 2 ]; then |
| 18 | + echo "usage: $0 <language> <halt|recover> <libFuzzer args...>" |
| 19 | + exit 1 |
| 20 | +fi |
41 | 21 |
|
42 |
| -reproduce() { |
43 |
| - if [ "$#" -lt 3 ]; then |
44 |
| - echo "usage: $0 <language> (halt|recover) <testcase> <libFuzzer args...>" |
45 |
| - exit 1 |
46 |
| - fi |
| 22 | +lang="$1" |
| 23 | +shift |
| 24 | +mode="$1" |
| 25 | +shift |
| 26 | +# Treat remainder of arguments as libFuzzer arguments |
47 | 27 |
|
48 |
| - lang="$1" |
49 |
| - shift |
50 |
| - mode="$1" |
51 |
| - shift |
52 |
| - testcase="$1" |
53 |
| - shift |
54 |
| - # Treat remainder of arguments as libFuzzer arguments |
| 28 | +# Fuzzing logs and testcases are always written to `pwd`, so `cd` there first |
| 29 | +results="${root}/test/fuzz/out/fuzz-results/${lang}" |
| 30 | +mkdir -p "${results}" |
| 31 | +cd "${results}" |
55 | 32 |
|
56 |
| - "${root}/test/fuzz/out/${lang}_fuzzer" "${mode_config[$mode]}" -runs=1 "${testcase}" "$@" |
57 |
| -} |
| 33 | +# Create a corpus directory, so new discoveries are stored on disk. These will |
| 34 | +# then be loaded on subsequent fuzzing runs |
| 35 | +mkdir -p corpus |
58 | 36 |
|
59 |
| -script=$(basename "$0") |
60 |
| -if [ "$script" == "run-fuzzer" ]; then |
61 |
| - run_fuzzer "$@" |
62 |
| -elif [ "$script" == "reproduce" ]; then |
63 |
| - reproduce "$@" |
64 |
| -fi |
| 37 | +pwd |
| 38 | +"../../${lang}_fuzzer" "-dict=../../${lang}.dict" "-artifact_prefix=${lang}_" -max_len=2048 "${mode_config[$mode]}" "./corpus" "$@" |
0 commit comments