2011-04-30 13:42:48 +00:00
|
|
|
OPT = -O2
|
|
|
|
DEBUG = 2
|
2011-05-08 21:40:26 +00:00
|
|
|
CFLAGS = -I../include -I../src -Wall -std=c99 ${OPT}
|
2011-04-30 13:42:48 +00:00
|
|
|
LDFLAGS = -L../lib
|
2011-05-08 14:49:24 +00:00
|
|
|
LOADLIBES = -lpsyc -lm
|
|
|
|
LOADLIBES_NET = ${LOADLIBES}
|
2011-05-03 20:18:35 +00:00
|
|
|
TARGETS = testServer testParser testMatch testRender testText isRoutingVar getVarType
|
2011-04-30 13:42:48 +00:00
|
|
|
WRAPPER =
|
|
|
|
DIET = diet
|
|
|
|
PORT = 4440
|
2011-05-08 14:49:24 +00:00
|
|
|
NC = nc
|
|
|
|
DIFF = diff
|
2011-04-30 13:42:48 +00:00
|
|
|
|
2011-05-08 02:11:36 +00:00
|
|
|
ifeq ($(shell uname),SunOS)
|
2011-05-08 14:49:24 +00:00
|
|
|
LOADLIBES_NET := ${LOADLIBES_NET} -lsocket -lnsl
|
|
|
|
DIFF = gdiff
|
2011-05-08 02:11:36 +00:00
|
|
|
endif
|
|
|
|
|
2011-04-30 14:41:30 +00:00
|
|
|
all: ${TARGETS}
|
2011-05-08 02:11:36 +00:00
|
|
|
it: all
|
|
|
|
|
|
|
|
testServer: LOADLIBES := ${LOADLIBES_NET}
|
2011-04-30 13:42:48 +00:00
|
|
|
|
|
|
|
diet: WRAPPER = ${DIET}
|
|
|
|
diet: all
|
|
|
|
|
|
|
|
debug: CFLAGS += -DDEBUG=${DEBUG} -g
|
|
|
|
debug: CFLAGS := $(subst ${OPT},-O0,${CFLAGS})
|
|
|
|
debug: all
|
|
|
|
|
2011-05-05 22:15:37 +00:00
|
|
|
clean:
|
|
|
|
rm -f ${TARGETS}
|
|
|
|
|
2011-04-30 13:42:48 +00:00
|
|
|
test: ${TARGETS}
|
2011-04-25 21:58:07 +00:00
|
|
|
./testRender
|
|
|
|
./testMatch
|
2011-05-03 23:00:35 +00:00
|
|
|
./testText
|
2011-04-25 21:58:07 +00:00
|
|
|
./isRoutingVar
|
2011-04-29 21:11:48 +00:00
|
|
|
./getVarType
|
2011-05-08 18:17:56 +00:00
|
|
|
x=0; for f in packets/[0-9]*; do echo ">> $$f"; ./testParser $$f; x=$$((x+$$?)); done; exit $$x
|
|
|
|
x=0; for f in packets/[0-9]*; do echo ">> $$f"; ./testParser $$f -r; x=$$((x+$$?)); done; exit $$x
|
2011-04-27 17:18:17 +00:00
|
|
|
|
2011-05-08 21:08:00 +00:00
|
|
|
.NOTPARALLEL: nettestrun
|
|
|
|
|
2011-05-08 18:17:56 +00:00
|
|
|
nettest: nettestfull nettestsplit
|
2011-05-05 22:15:37 +00:00
|
|
|
|
2011-05-08 18:17:56 +00:00
|
|
|
nettestrun: srvstart pkt srvkill
|
|
|
|
|
|
|
|
nettestfull:
|
2011-05-08 20:53:45 +00:00
|
|
|
${MAKE} nettestrun; x=$$?; pkill -x testServer; exit $$x
|
|
|
|
${MAKE} nettestrun srv_args=r; x=$$?; pkill -x testServer; exit $$x
|
2011-05-08 18:17:56 +00:00
|
|
|
|
2011-05-08 20:53:45 +00:00
|
|
|
split_max = 10
|
2011-05-08 18:17:56 +00:00
|
|
|
nettestsplit:
|
2011-05-08 20:53:45 +00:00
|
|
|
x=0; for n in `seq 1 ${split_max}`; do ${MAKE} nettestrun srv_recvbuf=$$n && ${MAKE} nettestrun srv_args=r srv_recvbuf=$$n || break; done; x=$$?; pkill -x testServer; exit $$x
|
2011-05-06 11:32:12 +00:00
|
|
|
|
|
|
|
pkt:
|
2011-05-08 18:17:56 +00:00
|
|
|
x=0; for f in packets/[0-9]*; do echo ">> $$f"; cat $$f | nc localhost ${PORT} | ${DIFF} -u $$f -; x=$$((x+$$?)); done; exit $$x
|
2011-05-05 22:15:37 +00:00
|
|
|
|
2011-05-06 11:32:12 +00:00
|
|
|
pktsplit:
|
2011-05-08 18:17:56 +00:00
|
|
|
x=0; for f in packets/[0-9]*; do echo ">> $$f"; ./splittest.pl $$f ${PORT} | ${DIFF} -u $$f -; x=$$((x+$$?)); done; exit $$x
|
2011-05-05 22:15:37 +00:00
|
|
|
|
2011-05-06 11:32:12 +00:00
|
|
|
pkterr:
|
2011-05-05 22:15:37 +00:00
|
|
|
for f in packets/err-*; do echo ">> $$f"; cat $$f | nc localhost ${PORT}; done
|
2011-05-03 23:00:35 +00:00
|
|
|
|
2011-05-06 11:32:12 +00:00
|
|
|
srvstart:
|
2011-05-08 18:17:56 +00:00
|
|
|
pkill -x testServer; exit 0
|
|
|
|
./testServer ${PORT} -${srv_args} ${srv_recvbuf} &
|
2011-04-22 09:50:13 +00:00
|
|
|
|
2011-05-06 11:32:12 +00:00
|
|
|
srvkill:
|
2011-05-08 02:11:36 +00:00
|
|
|
pkill -x testServer
|