EXIT_COMMAND_LINE=1
EXIT_ERROR=2
+case $WS_SYSTEM in
+ Windows|SunOS) SKIP_CAPTURE=0 ;;
+ *) SKIP_CAPTURE=1 ;;
+esac
+
capture_test_output_print() {
wait
for f in "$@"; do
traffic_gen_ping() {
# Generate some traffic for quiet networks.
# This will have to be adjusted for non-Windows systems.
-## ping -n 20 www.wireshark.org > /dev/null 2>&1 &
-
- { date; ping -n 20 www.wireshark.org; date; } > ./testout_ping.txt 2>&1 &
+ {
+ date
+ for (( x=20; x<=50; x++ )) # in effect: number the packets
+ do
+ # How does ping _not_ have a standard set of arguments?
+ case $WS_SYSTEM in
+ Windows)
+ ping -n 1 -l $x www.wireshark.org ;;
+ SunOS)
+ ping www.wireshark.org $x 1 ;;
+ *) # *BSD, Linux
+ ping -c 1 -s $x www.wireshark.org ;;
+ esac
+ sleep 1
+ done
+ date
+ } > ./testout_ping.txt 2>&1 &
}
ping_cleanup() {
# capture exactly 10 packets
capture_step_10packets() {
- if [ "$WS_SYSTEM" != "Windows" ] ; then
+ if [ $SKIP_CAPTURE -ne 0 ] ; then
test_step_skipped
return
fi
test_step_ok
else
echo
+ $TSHARK -ta -r ./testout.pcap >> ./testout2.txt
capture_test_output_print ./testout_ping.txt ./testout.txt ./testout2.txt
# part of the Prerequisite checks
# probably wrong interface, output the possible interfaces
# capture exactly 10 packets using "-w -" (piping to stdout)
capture_step_10packets_stdout() {
- if [ "$WS_SYSTEM" != "Windows" ] ; then
+ if [ $SKIP_CAPTURE -ne 0 ] ; then
test_step_skipped
return
fi
# capture exactly 2 times 10 packets (multiple files)
capture_step_2multi_10packets() {
- if [ "$WS_SYSTEM" != "Windows" ] ; then
+ if [ $SKIP_CAPTURE -ne 0 ] ; then
test_step_skipped
return
fi
# capture with a very unlikely read filter, packets must be zero afterwards
capture_step_read_filter() {
- if [ "$WS_SYSTEM" != "Windows" ] ; then
+ if [ $SKIP_CAPTURE -ne 0 ] ; then
test_step_skipped
return
fi
# capture with a snapshot length
capture_step_snapshot() {
- if [ "$WS_SYSTEM" != "Windows" ] ; then
+ if [ $SKIP_CAPTURE -ne 0 ] ; then
test_step_skipped
return
fi
traffic_gen_ping
# capture with a snapshot length of 68 bytes for $TRAFFIC_CAPTURE_DURATION seconds
- # this should result in no packets
+ # this should result in no packets greater than 68 bytes
date > ./testout.txt
$DUT -i $TRAFFIC_CAPTURE_IFACE $TRAFFIC_CAPTURE_PROMISC \
-w ./testout.pcap \
tshark_capture_suite() {
DUT=$TSHARK
test_step_add "Capture 10 packets" capture_step_10packets
- test_step_add "Capture 10 packets using stdout: -w -" capture_step_10packets_stdout
+ #test_step_add "Capture 10 packets using stdout: -w -" capture_step_10packets_stdout
if [ $TEST_FIFO ]; then
test_step_add "Capture via fifo" capture_step_fifo
fi
test_step_set_pre capture_cleanup_step
test_step_set_post capture_cleanup_step
test_remark_add "Capture - need some traffic on interface: \"$TRAFFIC_CAPTURE_IFACE\""
+ test_suite_add "Dumpcap capture" dumpcap_capture_suite
test_suite_add "TShark capture" tshark_capture_suite
test_suite_add "Wireshark capture" wireshark_capture_suite
- test_suite_add "Dumpcap capture" dumpcap_capture_suite
}