Skip to content

Commit

Permalink
build: remove symbolic links from repository
Browse files Browse the repository at this point in the history
This will reduce cross-platform differences between windows and linux.

Closes #627.
  • Loading branch information
dundargoc committed Feb 11, 2024
1 parent 77d7843 commit 82ad636
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 46 deletions.
1 change: 0 additions & 1 deletion CONTRIBUTING.md

This file was deleted.

1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See docs/section-6-contributing.md.
1 change: 0 additions & 1 deletion script/reproduce

This file was deleted.

30 changes: 30 additions & 0 deletions script/reproduce
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -eux

root=$(dirname "$0")/..
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

if [ "$#" -lt 3 ]; then
echo "usage: $0 <language> (halt|recover) <testcase> <libFuzzer args...>"
exit 1
fi

lang="$1"
shift
mode="$1"
shift
testcase="$1"
shift
# Treat remainder of arguments as libFuzzer arguments

"${root}/test/fuzz/out/${lang}_fuzzer" "${mode_config[$mode]}" -runs=1 "${testcase}" "$@"
62 changes: 18 additions & 44 deletions script/run-fuzzer
Original file line number Diff line number Diff line change
Expand Up @@ -14,51 +14,25 @@ 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

run_fuzzer() {
if [ "$#" -lt 2 ]; then
echo "usage: $0 <language> <halt|recover> <libFuzzer args...>"
exit 1
fi

lang="$1"
shift
mode="$1"
shift
# Treat remainder of arguments as libFuzzer arguments

# Fuzzing logs and testcases are always written to `pwd`, so `cd` there first
results="${root}/test/fuzz/out/fuzz-results/${lang}"
mkdir -p "${results}"
cd "${results}"

# Create a corpus directory, so new discoveries are stored on disk. These will
# then be loaded on subsequent fuzzing runs
mkdir -p corpus

pwd
"../../${lang}_fuzzer" "-dict=../../${lang}.dict" "-artifact_prefix=${lang}_" -max_len=2048 "${mode_config[$mode]}" "./corpus" "$@"
}
if [ "$#" -lt 2 ]; then
echo "usage: $0 <language> <halt|recover> <libFuzzer args...>"
exit 1
fi

reproduce() {
if [ "$#" -lt 3 ]; then
echo "usage: $0 <language> (halt|recover) <testcase> <libFuzzer args...>"
exit 1
fi
lang="$1"
shift
mode="$1"
shift
# Treat remainder of arguments as libFuzzer arguments

lang="$1"
shift
mode="$1"
shift
testcase="$1"
shift
# Treat remainder of arguments as libFuzzer arguments
# Fuzzing logs and testcases are always written to `pwd`, so `cd` there first
results="${root}/test/fuzz/out/fuzz-results/${lang}"
mkdir -p "${results}"
cd "${results}"

"${root}/test/fuzz/out/${lang}_fuzzer" "${mode_config[$mode]}" -runs=1 "${testcase}" "$@"
}
# Create a corpus directory, so new discoveries are stored on disk. These will
# then be loaded on subsequent fuzzing runs
mkdir -p corpus

script=$(basename "$0")
if [ "$script" == "run-fuzzer" ]; then
run_fuzzer "$@"
elif [ "$script" == "reproduce" ]; then
reproduce "$@"
fi
pwd
"../../${lang}_fuzzer" "-dict=../../${lang}.dict" "-artifact_prefix=${lang}_" -max_len=2048 "${mode_config[$mode]}" "./corpus" "$@"

0 comments on commit 82ad636

Please sign in to comment.