MAKEFLAGS=-s -k PRINTF = @PRINTF@ HOST = @host@ TARGET = @target@ BUILD = @build@ nic1 = @nic1@ nic2 = @nic2@ ENABLE_DEBUG = @debug_flag@ test: all all: clearlog check tcpprep tcpreplay clearlog: -rm test.log check: $(PRINTF) "%s\n" "NOTICE: Tests must be run as root" $(PRINTF) "%s\n" "Sending traffic on '$(nic1)' and '$(nic2)'" # the cache files to be used as the standard; be sure to do a cvs commit # afterwords! standard: ../tcpprep -i test.pcap -o test.auto_router -a -n router -N client ../tcpprep -i test.pcap -o test.auto_bridge -a -n bridge -N client ../tcpprep -i test.pcap -o test.auto_bridge -a -n bridge -N client ../tcpprep -i test.pcap -o test.auto_bridge -a -n bridge -N client ../tcpprep -i test.pcap -o test.port -p ../tcpprep -i test.pcap -o test.cidr -c '216.27.178.0/24' -N client ../tcpprep -i test.pcap -o test.regex -r '216.27.178.*' -N client ../tcpprep -i test.pcap -o test.comment -C "This is a comment" -p tcpprep: auto_router auto_bridge cidr regex port comment print_comment tcpreplay: replay_basic replay_cache replay_cidr replay_trunc replay_pad replay_rand replay_include replay_exclude replay_layer2 replay_packetrate datadump_mode config_mode auto_router: $(PRINTF) "%s" "[tcpprep] Auto/Router mode test: " $(PRINTF) "%s\n" "*** [tcpprep] Auto/Router mode test: " >>test.log ../tcpprep $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -a -n router -N client 2>>test.log diff test.$@ test.$@1 >>test.log 2>&1 if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi auto_bridge: $(PRINTF) "%s" "[tcpprep] Auto/Bridge mode test: " $(PRINTF) "%s\n" "*** [tcpprep] Auto/Bridge mode test: " >>test.log ../tcpprep $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -a -n bridge -N client 2>>test.log diff test.$@ test.$@1 >>test.log 2>&1 if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi regex: $(PRINTF) "%s" "[tcpprep] Regex mode test: " $(PRINTF) "%s\n" "*** [tcpprep] Regex mode test: " >>test.log ../tcpprep $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -r '216.27.178.*' -N client 2>>test.log diff test.$@ test.$@1 >>test.log 2>&1 if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi cidr: $(PRINTF) "%s" "[tcpprep] CIDR mode test: " $(PRINTF) "%s\n" "*** [tcpprep] CIDR mode test: " >>test.log ../tcpprep $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -c '216.27.178.0/24' -N client 2>>test.log diff test.$@ test.$@1 >>test.log 2>&1 if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi port: $(PRINTF) "%s" "[tcpprep] Port mode test: " $(PRINTF) "%s\n" "*** [tcpprep] Port mode test: " >>test.log ../tcpprep $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -p 2>>test.log diff test.$@ test.$@1 >>test.log 2>&1 if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi comment: $(PRINTF) "%s" "[tcpprep] Comment mode test: " $(PRINTF) "%s\n" "*** [tcpprep] Comment mode test: " >>test.log ../tcpprep $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -C "This is a comment" -p 2>>test.log if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi print_comment: $(PRINTF) "%s" "[tcpprep] Print comment mode test: " $(PRINTF) "%s\n" "*** [tcpprep] Print comment mode test: " >>test.log ../tcpprep $(ENABLE_DEBUG) -P test.comment >test.$@1 2>>test.log if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi replay_basic: $(PRINTF) "%s" "[tcpreplay] Basic test: " $(PRINTF) "%s\n" "*** [tcpreplay] Basic test: " >>test.log ../tcpreplay $(ENABLE_DEBUG) -i $(nic1) -R test.pcap >>test.log 2>&1 if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi replay_cache: $(PRINTF) "%s" "[tcpreplay] Cache test: " $(PRINTF) "%s\n" "*** [tcpreplay] Cache test: " >>test.log ../tcpreplay $(ENABLE_DEBUG) -c test.cidr -i $(nic1) -j $(nic2) -R test.pcap >>test.log 2>&1 if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi replay_cidr: $(PRINTF) "%s" "[tcpreplay] CIDR test: " $(PRINTF) "%s\n" "*** [tcpreplay] CIDR test: " >>test.log ../tcpreplay $(ENABLE_DEBUG) -C 216.27.178.0/24 -i $(nic1) -j $(nic2) -R test.pcap >>test.log 2>&1 if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi replay_trunc: $(PRINTF) "%s" "[tcpreplay] Truncate test: " $(PRINTF) "%s\n" "*** [tcpreplay] Truncate test: " >>test.log ../tcpreplay $(ENABLE_DEBUG) -i $(nic1) -u trunc -R test.pcap >>test.log 2>&1 if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi replay_pad: $(PRINTF) "%s" "[tcpreplay] Pad test: " $(PRINTF) "%s\n" "*** [tcpreplay] Pad test: " >>test.log ../tcpreplay $(ENABLE_DEBUG) -i $(nic1) -u pad -R test.pcap >>test.log 2>&1 if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi replay_rand: $(PRINTF) "%s" "[tcpreplay] Random IP test: " $(PRINTF) "%s\n" "*** [tcpreplay] Random IP test: " >>test.log ../tcpreplay $(ENABLE_DEBUG) -i $(nic1) -s 666 -R test.pcap >>test.log 2>&1 if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi replay_include: $(PRINTF) "%s" "[tcpreplay] Include only test: " $(PRINTF) "%s\n" "*** [tcpreplay] Include only test: " >>test.log ../tcpreplay $(ENABLE_DEBUG) -i $(nic1) -x P:1,5,7-53,88,93-100 -R test.pcap >>test.log 2>&1 if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi replay_exclude: $(PRINTF) "%s" "[tcpreplay] Exclude test: " $(PRINTF) "%s\n" "*** [tcpreplay] Exclude test: " >>test.log ../tcpreplay $(ENABLE_DEBUG) -i $(nic1) -X P:1,5,7-53,88,93-100 -R test.pcap >>test.log 2>&1 if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi replay_layer2: $(PRINTF) "%s" "[tcpreplay] Layer2 test: " $(PRINTF) "%s\n" "*** [tcpreplay] Layer2 test: " >>test.log ../tcpreplay $(ENABLE_DEBUG) -i $(nic1) -2 00,50,da,5d,46,55,0,7,eb,30,a4,c3,08,0 -R test.pcap >>test.log 2>&1 if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi replay_packetrate: $(PRINTF) "%s" "[tcpreplay] Packetrate test: " $(PRINTF) "%s\n" "*** [tcpreplay] Packetrate test: " >>test.log ../tcpreplay $(ENABLE_DEBUG) -i $(nic1) -p 25.0 test.pcap >>test.log 2>&1 if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi datadump_mode: $(PRINTF) "%s" "[tcpreplay] Data dump mode test: " $(PRINTF) "%s\n" "*** [tcpreplay] Data dump mode test: " >>test.log ../tcpreplay $(ENABLE_DEBUG) -D -i $(nic1) -j $(nic2) -w primary.data -W secondary.data -c test.cidr -R test.pcap >>test.log 2>&1 if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi config_mode: $(PRINTF) "%s" "[tcpreplay] Config file mode test: " $(PRINTF) "%s\n" "*** [tcpreplay] Config file mode test: " >>test.log ../tcpreplay $(ENABLE_DEBUG) -f config test.pcap >>test.log 2>&1 if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi clean: rm -f *1 test.log core* *~ primary.data secondary.data distclean: clean rm -f Makefile config