1
0

Makefile.in.svn-base 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. MAKEFLAGS=-s -k
  2. PRINTF = @PRINTF@
  3. HOST = @host@
  4. TARGET = @target@
  5. BUILD = @build@
  6. nic1 = @nic1@
  7. nic2 = @nic2@
  8. ENABLE_DEBUG = @debug_flag@
  9. test: all
  10. all: clearlog check tcpprep tcpreplay
  11. clearlog:
  12. -rm test.log
  13. check:
  14. $(PRINTF) "%s\n" "NOTICE: Tests must be run as root"
  15. $(PRINTF) "%s\n" "Sending traffic on '$(nic1)' and '$(nic2)'"
  16. # the cache files to be used as the standard; be sure to do a cvs commit
  17. # afterwords!
  18. standard:
  19. ../tcpprep -i test.pcap -o test.auto_router -a -n router -N client
  20. ../tcpprep -i test.pcap -o test.auto_bridge -a -n bridge -N client
  21. ../tcpprep -i test.pcap -o test.auto_bridge -a -n bridge -N client
  22. ../tcpprep -i test.pcap -o test.auto_bridge -a -n bridge -N client
  23. ../tcpprep -i test.pcap -o test.port -p
  24. ../tcpprep -i test.pcap -o test.cidr -c '216.27.178.0/24' -N client
  25. ../tcpprep -i test.pcap -o test.regex -r '216.27.178.*' -N client
  26. ../tcpprep -i test.pcap -o test.comment -C "This is a comment" -p
  27. tcpprep: auto_router auto_bridge cidr regex port comment print_comment
  28. 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
  29. auto_router:
  30. $(PRINTF) "%s" "[tcpprep] Auto/Router mode test: "
  31. $(PRINTF) "%s\n" "*** [tcpprep] Auto/Router mode test: " >>test.log
  32. ../tcpprep $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -a -n router -N client 2>>test.log
  33. diff test.$@ test.$@1 >>test.log 2>&1
  34. if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi
  35. auto_bridge:
  36. $(PRINTF) "%s" "[tcpprep] Auto/Bridge mode test: "
  37. $(PRINTF) "%s\n" "*** [tcpprep] Auto/Bridge mode test: " >>test.log
  38. ../tcpprep $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -a -n bridge -N client 2>>test.log
  39. diff test.$@ test.$@1 >>test.log 2>&1
  40. if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi
  41. regex:
  42. $(PRINTF) "%s" "[tcpprep] Regex mode test: "
  43. $(PRINTF) "%s\n" "*** [tcpprep] Regex mode test: " >>test.log
  44. ../tcpprep $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -r '216.27.178.*' -N client 2>>test.log
  45. diff test.$@ test.$@1 >>test.log 2>&1
  46. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  47. cidr:
  48. $(PRINTF) "%s" "[tcpprep] CIDR mode test: "
  49. $(PRINTF) "%s\n" "*** [tcpprep] CIDR mode test: " >>test.log
  50. ../tcpprep $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -c '216.27.178.0/24' -N client 2>>test.log
  51. diff test.$@ test.$@1 >>test.log 2>&1
  52. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  53. port:
  54. $(PRINTF) "%s" "[tcpprep] Port mode test: "
  55. $(PRINTF) "%s\n" "*** [tcpprep] Port mode test: " >>test.log
  56. ../tcpprep $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -p 2>>test.log
  57. diff test.$@ test.$@1 >>test.log 2>&1
  58. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  59. comment:
  60. $(PRINTF) "%s" "[tcpprep] Comment mode test: "
  61. $(PRINTF) "%s\n" "*** [tcpprep] Comment mode test: " >>test.log
  62. ../tcpprep $(ENABLE_DEBUG) -i test.pcap -o test.$@1 -C "This is a comment" -p 2>>test.log
  63. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  64. print_comment:
  65. $(PRINTF) "%s" "[tcpprep] Print comment mode test: "
  66. $(PRINTF) "%s\n" "*** [tcpprep] Print comment mode test: " >>test.log
  67. ../tcpprep $(ENABLE_DEBUG) -P test.comment >test.$@1 2>>test.log
  68. if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi
  69. replay_basic:
  70. $(PRINTF) "%s" "[tcpreplay] Basic test: "
  71. $(PRINTF) "%s\n" "*** [tcpreplay] Basic test: " >>test.log
  72. ../tcpreplay $(ENABLE_DEBUG) -i $(nic1) -R test.pcap >>test.log 2>&1
  73. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  74. replay_cache:
  75. $(PRINTF) "%s" "[tcpreplay] Cache test: "
  76. $(PRINTF) "%s\n" "*** [tcpreplay] Cache test: " >>test.log
  77. ../tcpreplay $(ENABLE_DEBUG) -c test.cidr -i $(nic1) -j $(nic2) -R test.pcap >>test.log 2>&1
  78. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  79. replay_cidr:
  80. $(PRINTF) "%s" "[tcpreplay] CIDR test: "
  81. $(PRINTF) "%s\n" "*** [tcpreplay] CIDR test: " >>test.log
  82. ../tcpreplay $(ENABLE_DEBUG) -C 216.27.178.0/24 -i $(nic1) -j $(nic2) -R test.pcap >>test.log 2>&1
  83. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  84. replay_trunc:
  85. $(PRINTF) "%s" "[tcpreplay] Truncate test: "
  86. $(PRINTF) "%s\n" "*** [tcpreplay] Truncate test: " >>test.log
  87. ../tcpreplay $(ENABLE_DEBUG) -i $(nic1) -u trunc -R test.pcap >>test.log 2>&1
  88. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  89. replay_pad:
  90. $(PRINTF) "%s" "[tcpreplay] Pad test: "
  91. $(PRINTF) "%s\n" "*** [tcpreplay] Pad test: " >>test.log
  92. ../tcpreplay $(ENABLE_DEBUG) -i $(nic1) -u pad -R test.pcap >>test.log 2>&1
  93. if [ $? ] ; then $(PRINTF) "\t\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t\t%s\n" "OK"; fi
  94. replay_rand:
  95. $(PRINTF) "%s" "[tcpreplay] Random IP test: "
  96. $(PRINTF) "%s\n" "*** [tcpreplay] Random IP test: " >>test.log
  97. ../tcpreplay $(ENABLE_DEBUG) -i $(nic1) -s 666 -R test.pcap >>test.log 2>&1
  98. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  99. replay_include:
  100. $(PRINTF) "%s" "[tcpreplay] Include only test: "
  101. $(PRINTF) "%s\n" "*** [tcpreplay] Include only test: " >>test.log
  102. ../tcpreplay $(ENABLE_DEBUG) -i $(nic1) -x P:1,5,7-53,88,93-100 -R test.pcap >>test.log 2>&1
  103. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  104. replay_exclude:
  105. $(PRINTF) "%s" "[tcpreplay] Exclude test: "
  106. $(PRINTF) "%s\n" "*** [tcpreplay] Exclude test: " >>test.log
  107. ../tcpreplay $(ENABLE_DEBUG) -i $(nic1) -X P:1,5,7-53,88,93-100 -R test.pcap >>test.log 2>&1
  108. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  109. replay_layer2:
  110. $(PRINTF) "%s" "[tcpreplay] Layer2 test: "
  111. $(PRINTF) "%s\n" "*** [tcpreplay] Layer2 test: " >>test.log
  112. ../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
  113. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  114. replay_packetrate:
  115. $(PRINTF) "%s" "[tcpreplay] Packetrate test: "
  116. $(PRINTF) "%s\n" "*** [tcpreplay] Packetrate test: " >>test.log
  117. ../tcpreplay $(ENABLE_DEBUG) -i $(nic1) -p 25.0 test.pcap >>test.log 2>&1
  118. if [ $? ] ; then $(PRINTF) "\t\t%s\n" "FAILED"; else $(PRINTF) "\t\t%s\n" "OK"; fi
  119. datadump_mode:
  120. $(PRINTF) "%s" "[tcpreplay] Data dump mode test: "
  121. $(PRINTF) "%s\n" "*** [tcpreplay] Data dump mode test: " >>test.log
  122. ../tcpreplay $(ENABLE_DEBUG) -D -i $(nic1) -j $(nic2) -w primary.data -W secondary.data -c test.cidr -R test.pcap >>test.log 2>&1
  123. if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi
  124. config_mode:
  125. $(PRINTF) "%s" "[tcpreplay] Config file mode test: "
  126. $(PRINTF) "%s\n" "*** [tcpreplay] Config file mode test: " >>test.log
  127. ../tcpreplay $(ENABLE_DEBUG) -f config test.pcap >>test.log 2>&1
  128. if [ $? ] ; then $(PRINTF) "\t%s\n" "FAILED"; else $(PRINTF) "\t%s\n" "OK"; fi
  129. clean:
  130. rm -f *1 test.log core* *~ primary.data secondary.data
  131. distclean: clean
  132. rm -f Makefile config