Skip to content

Commit 1a6f3d3

Browse files
committed
build: remove symbolic links from repository
This will reduce cross-platform differences between windows and linux. Closes tree-sitter#627.
1 parent 39df8e2 commit 1a6f3d3

File tree

3 files changed

+49
-46
lines changed

3 files changed

+49
-46
lines changed

CONTRIBUTING.md

-1
This file was deleted.

CONTRIBUTING.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
See [section-6-contributing.md](./docs/section-6-contributing.md)

script/reproduce

-1
This file was deleted.

script/reproduce

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
set -eux
4+
5+
root=$(dirname "$0")/..
6+
export ASAN_OPTIONS="quarantine_size_mb=10:detect_leaks=1:symbolize=1"
7+
export UBSAN="print_stacktrace=1:halt_on_error=1:symbolize=1"
8+
9+
# check if CI env var exists
10+
11+
if [ -z "${CI:-}" ]; then
12+
declare -A mode_config=( ["halt"]="-timeout=1 -rss_limit_mb=2048" ["recover"]="-timeout=10 -rss_limit_mb=2048" )
13+
else
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+
fi
16+
17+
if [ "$#" -lt 3 ]; then
18+
echo "usage: $0 <language> (halt|recover) <testcase> <libFuzzer args...>"
19+
exit 1
20+
fi
21+
22+
lang="$1"
23+
shift
24+
mode="$1"
25+
shift
26+
testcase="$1"
27+
shift
28+
# Treat remainder of arguments as libFuzzer arguments
29+
30+
"${root}/test/fuzz/out/${lang}_fuzzer" "${mode_config[$mode]}" -runs=1 "${testcase}" "$@"

script/run-fuzzer

+18-44
Original file line numberDiff line numberDiff line change
@@ -14,51 +14,25 @@ else
1414
declare -A mode_config=( ["halt"]="-max_total_time=120 -timeout=1 -rss_limit_mb=2048" ["recover"]="-time=120 -timeout=10 -rss_limit_mb=2048" )
1515
fi
1616

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
4121

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
4727

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}"
5532

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
5836

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

Comments
 (0)