aboutsummaryrefslogtreecommitdiff
path: root/src/test/fuzz/fuzz_multi.sh
blob: 406ab498d9236b69bca6dc028672837146eef800 (plain)
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
36
#!/bin/sh

MEMLIMIT_BYTES=21990500990976

N_CPUS=1
if [ $# -ge 1 ]; then
    N_CPUS="$1"
    shift
fi

FILTER="echo"

for i in $(seq -w "$N_CPUS"); do
    if [ "$i" -eq 1 ]; then
        if [ "$N_CPUS" -eq 1 ]; then
            INSTANCE=""
            NUMBER=""
        else
            INSTANCE="-M"
            NUMBER="$i"
        fi
    else
        INSTANCE="-S"
        NUMBER="$i"
    fi
    # use whatever remains on the command-line to prefix the fuzzer command
    # you have to copy and paste and run these commands yourself
    "$FILTER" "$@" \
        ../afl/afl-fuzz \
        -i src/test/fuzz/fuzz_dir_testcase \
        -o src/test/fuzz/fuzz_dir_findings \
        -x src/test/fuzz/fuzz_dir_dictionary/fuzz_dir_http_header.dct \
        -m "$MEMLIMIT_BYTES" \
        "$INSTANCE" "$NUMBER" \
        -- src/test/fuzz_dir
done