aboutsummaryrefslogtreecommitdiff
path: root/regress/fuzz/Makefile
blob: 88bffcaf6d2bc5e513bd72c81516167f6f286880 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
DISTFILES =	Makefile \
		iri.c

include ../../config.mk

CC = afl-clang

COBJS =		${COMPATS:.c=.o}
REG_COMPATS =	${COBJS:%=../../%}

IRI_SRCS =	iri.c ../../iri.c ../../utf8.c ../../log.c
IRI_OBJS =	${IRI_SRCS:.c=.o} ${REG_COMPATS}

.PHONY: all data clean dist

all: fuzz

fuzz: iri
	mkdir -p in out
	echo 'gemini://omarpolo.com/'		> in/simple
	echo 'https://op:123@omarpolo.com/'	> in/auth
	echo 'ftp://op@omarpolo.com/a/bb/c'	> in/path
	echo 'gemini://omarpolo.com/?some=val'	> in/query
	echo 'gemini://omarpolo.com/b/#xyz'	> in/fragment
	echo 'gemini://omarpolo.com/b/?x=y#xyz'	> in/qf
	echo 'ssh://omarpolo.com/%2F/'		> in/enc
	echo 'http://omarpolo.com/foo/.././'	> in/dots
	echo 'http://omarpolo.com/////././'	> in/slash
	afl-fuzz -i in -o out -- ./iri

iri: ${IRI_OBJS}
	${CC} ${IRI_OBJS} -o $@ ${LIBS} ${LDFLAGS}

.c.o:
	${CC} -I../.. ${CFLAGS} -c $< -o $@

clean:
	rm -f *.o iri