diff options
| author | Randy Palamar <randy@rnpnr.xyz> | 2024-05-21 19:53:22 -0600 |
|---|---|---|
| committer | Randy Palamar <randy@rnpnr.xyz> | 2024-05-21 19:53:22 -0600 |
| commit | b7074021b7bfb0932b889b9560dd22df31cef818 (patch) | |
| tree | 0295b18de8fb8ea5289cbda95675687ae06025ff /test/fuzz/Makefile | |
| parent | b7f8018a00be930e3f2b864949aec1f91291309c (diff) | |
| parent | efafa3c178268a4149fc3e432bc1174a013c16de (diff) | |
| download | vis-b7074021b7bfb0932b889b9560dd22df31cef818.tar.gz vis-b7074021b7bfb0932b889b9560dd22df31cef818.tar.xz | |
Merge vis-tests into test directory
Going forward all tests should be submitted here directly.
Diffstat (limited to 'test/fuzz/Makefile')
| -rw-r--r-- | test/fuzz/Makefile | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/fuzz/Makefile b/test/fuzz/Makefile new file mode 100644 index 0000000..9aade50 --- /dev/null +++ b/test/fuzz/Makefile @@ -0,0 +1,47 @@ +-include ../../config.mk + +ALL = text-fuzzer text-libfuzzer buffer-fuzzer +CC = afl-gcc +CFLAGS += -I. -I../.. -DBUFFER_SIZE=4 -DBLOCK_SIZE=4 + +TEXT_SRC = ../../text.c ../../text-common.c ../../text-io.c ../../text-iterator.c ../../text-util.c ../../text-motions.c ../../text-objects.c ../../text-regex.c ../../array.c + +test: $(ALL) + +text-fuzzer: text-fuzzer.c fuzzer.h $(TEXT_SRC) + @echo Compiling $@ binary + @${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_LIBC} ${CFLAGS_EXTRA} ${filter %.c, $^} ${LDFLAGS} -o $@ + +text-libfuzzer: text-fuzzer.c fuzzer.h $(TEXT_SRC) + @echo Compiling $@ binary + @${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_LIBC} ${CFLAGS_EXTRA} -DLIBFUZZER ${filter %.c, $^} -fsanitize=fuzzer,address,undefined ${LDFLAGS} -o $@ + +buffer-fuzzer: buffer-fuzzer.c fuzzer.h ../../buffer.c + @echo Compiling $@ binary + @${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_LIBC} ${CFLAGS_EXTRA} ${filter %.c, $^} ${LDFLAGS} -o $@ + +debug: clean + $(MAKE) CFLAGS_EXTRA='${CFLAGS_EXTRA} ${CFLAGS_DEBUG}' + +afl-fuzz-text: text-fuzzer + @mkdir -p "results/$<" + @afl-fuzz -i - -x "dictionaries/$<.dict" -o "results/$<" -- "./$<" || \ + afl-fuzz -i "inputs/$<" -x "dictionaries/$<.dict" -o "results/$<" -- "./$<" + +libfuzzer-text: text-libfuzzer + @mkdir -p "results/$<" + @./$< -close_fd_mask=1 -only_ascii=1 -print_final_stats=1 "-dict=dictionaries/$<.dict" "inputs/$<" "results/$<" + +afl-fuzz-buffer: buffer-fuzzer + @mkdir -p "results/$<" + @afl-fuzz -i - -x "dictionaries/$<.dict" -o "results/$<" -- "./$<" || \ + afl-fuzz -i "inputs/$<" -x "dictionaries/$<.dict" -o "results/$<" -- "./$<" + +clean: + @echo cleaning + @rm -f $(ALL) + +distclean: clean + @rm -rf results/ + +.PHONY: clean distclean debug afl-fuzz-text libfuzzer-text afl-fuzz-buffer |
