35 lines
812 B
Bash
Executable file
35 lines
812 B
Bash
Executable file
#!/bin/bash
|
|
|
|
if (($# < 3)); then
|
|
echo "usage: $0 <language> <halt|recover> <testcase> [libFuzzer args...]" >&2
|
|
exit 1
|
|
fi
|
|
|
|
set -eu
|
|
|
|
export ASAN_OPTIONS=quarantine_size_mb=10:detect_leaks=1:symbolize=1
|
|
export UBSAN=print_stacktrace=1:halt_on_error=1:symbolize=1
|
|
|
|
# check if CI env var exists
|
|
if [[ -z ${CI:-} ]]; then
|
|
declare -A mode_config=(
|
|
[halt]='-timeout=1 -rss_limit_mb=2048'
|
|
[recover]='-timeout=10 -rss_limit_mb=2048'
|
|
)
|
|
else
|
|
declare -A mode_config=(
|
|
[halt]='-max_total_time=120 -timeout=1 -rss_limit_mb=2048'
|
|
[recover]='-time=120 -timeout=10 -rss_limit_mb=2048'
|
|
)
|
|
fi
|
|
|
|
lang="$1"
|
|
shift
|
|
mode="$1"
|
|
shift
|
|
testcase="$1"
|
|
shift
|
|
# Treat remainder of arguments as libFuzzer arguments
|
|
|
|
# shellcheck disable=SC2086
|
|
test/fuzz/out/${lang}_fuzzer ${mode_config[$mode]} -runs=1 "$testcase" "$@"
|