add compile workflow

add fuzzing instrumentation
This commit is contained in:
mhoffm
2021-07-01 00:22:20 +02:00
parent 0e7d8ddb4b
commit 808b2de94f
626 changed files with 5686 additions and 6 deletions

30
fuzz/Makefile Normal file
View File

@@ -0,0 +1,30 @@
FUZZFLAGS=-fsanitize=fuzzer,address,undefined
JOBS=4
WORKERS=4
.PHONY: fuzz
fuzz: fuzzer hcl.dict
UBSAN="print_stacktrace=1:halt_on_error=1:symbolize=1" ASAN_OPTIONS="quarantine_size_mb=10:detect_leaks=1:symbolize=1" ./fuzzer -jobs=${JOBS} -workers=${WORKERS} -dict=hcl.dict corpus/
.PHONY: clean
clean:
rm -rf tree-sitter
rm fuzzer parser.o scanner.o libtree-sitter.a
fuzzer: parser.o scanner.o libtree-sitter.a
clang++ -o fuzzer ${FUZZFLAGS} -std=c++11 tree-sitter/test/fuzz/fuzzer.cc -Itree-sitter/lib scanner.o parser.o libtree-sitter.a
scanner.o: ../src/scanner.cc
clang++ -o scanner.o ${FUZZFLAGS} -std=c++11 -I../src -c ../src/scanner.cc
parser.o: ../src/parser.c
clang -o parser.o ${FUZZFLAGS} -std=c99 -I../src -c ../src/parser.c
hcl.dict:
tree-sitter/scripts
libtree-sitter.a:
make -C tree-sitter
cp tree-sitter/libtree-sitter.a .