The capture test suite currently fails on quiet networks. Try to fix
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 11 Dec 2006 18:24:27 +0000 (18:24 +0000)
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 11 Dec 2006 18:24:27 +0000 (18:24 +0000)
this by generating some ICMP packets before each test.  Add an "icmp"
capture filter to each test to better control the test conditions.
Fixup whitespace.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20115 f5534014-38df-0310-8fa8-9805f1628bb7

test/config.sh
test/suite-capture.sh

index 394c18c00bc3c099cdaf184584c6ed8d12b6c41b..0ee6d931158b768153b8cd9ab69ac46b56b60476 100644 (file)
@@ -51,7 +51,7 @@ TRAFFIC_CAPTURE_IFACE=${TRAFFIC_CAPTURE_IFACE:-3}
 
 # time to capture some traffic (in seconds)
 # (you may increase this if you get errors caused by very low traffic)
-TRAFFIC_CAPTURE_DURATION=3
+TRAFFIC_CAPTURE_DURATION=20
 
 # the default is to not capture in promiscuous mode
 # (this makes known trouble with some Windows WLAN adapters)
index 454e62055cda3518b97268f996aad0a509651aa3..b8d80c04df13b1a89a036f1c915f422ab87db063 100644 (file)
@@ -19,7 +19,7 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
+# along with this program; if not, writeto the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 
@@ -29,15 +29,26 @@ EXIT_OK=0
 EXIT_COMMAND_LINE=1
 EXIT_ERROR=2
 
+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 &
+}
 
 # capture exactly 10 packets
 capture_step_10packets() {
-        if [ "$WS_SYSTEM" != "Windows" ] ; then
-                test_step_skipped
-                return
-        fi
+       if [ "$WS_SYSTEM" != "Windows" ] ; then
+               test_step_skipped
+               return
+       fi
 
-       $DUT -i $TRAFFIC_CAPTURE_IFACE $TRAFFIC_CAPTURE_PROMISC -w ./testout.pcap -c 10  -a duration:$TRAFFIC_CAPTURE_DURATION > ./testout.txt 2>&1
+       traffic_gen_ping
+       $DUT -i $TRAFFIC_CAPTURE_IFACE $TRAFFIC_CAPTURE_PROMISC \
+               -w ./testout.pcap \
+               -c 10  \
+               -a duration:$TRAFFIC_CAPTURE_DURATION \
+               icmp \
+               > ./testout.txt 2>&1
        RETURNVALUE=$?
        if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
                test_step_failed "exit status of $DUT: $RETURNVALUE"
@@ -75,7 +86,13 @@ capture_step_10packets_stdout() {
                 return
         fi
 
-       $DUT -i $TRAFFIC_CAPTURE_IFACE $TRAFFIC_CAPTURE_PROMISC -c 10 -a duration:$TRAFFIC_CAPTURE_DURATION -w - > ./testout.pcap 2>./testout.txt
+       traffic_gen_ping
+       $DUT -i $TRAFFIC_CAPTURE_IFACE $TRAFFIC_CAPTURE_PROMISC \
+               -c 10 \
+               -a duration:$TRAFFIC_CAPTURE_DURATION \
+               -w - \
+               icmp \
+               > ./testout.pcap 2>./testout.txt
        RETURNVALUE=$?
        if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
                test_step_failed "exit status of $DUT: $RETURNVALUE"
@@ -107,7 +124,10 @@ capture_step_10packets_stdout() {
 capture_step_fifo() {
        mkfifo 'fifo'
        (cat $CAPFILE; sleep 1; tail -c +25 $CAPFILE) > fifo &
-       $DUT -i fifo $TRAFFIC_CAPTURE_PROMISC -w ./testout.pcap -a duration:$TRAFFIC_CAPTURE_DURATION > ./testout.txt 2>&1
+       $DUT -i fifo $TRAFFIC_CAPTURE_PROMISC \
+               -w ./testout.pcap \
+               -a duration:$TRAFFIC_CAPTURE_DURATION \
+               > ./testout.txt 2>&1
        RETURNVALUE=$?
        rm 'fifo'
        if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
@@ -140,7 +160,14 @@ capture_step_2multi_10packets() {
                 return
         fi
 
-       $DUT -i $TRAFFIC_CAPTURE_IFACE $TRAFFIC_CAPTURE_PROMISC -w ./testout.pcap -c 10  -a duration:$TRAFFIC_CAPTURE_DURATION > ./testout.txt 2>&1
+       traffic_gen_ping
+       $DUT -i $TRAFFIC_CAPTURE_IFACE $TRAFFIC_CAPTURE_PROMISC \
+               -w ./testout.pcap \
+               -c 10 \
+               -a duration:$TRAFFIC_CAPTURE_DURATION \
+               icmp
+               > ./testout.txt 2>&1
+
        RETURNVALUE=$?
        if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
                test_step_failed "exit status of $DUT: $RETURNVALUE"
@@ -175,8 +202,15 @@ capture_step_read_filter() {
                 return
         fi
 
+       traffic_gen_ping
        # valid, but very unlikely filter
-       $DUT -i $TRAFFIC_CAPTURE_IFACE $TRAFFIC_CAPTURE_PROMISC -w ./testout.pcap -a duration:$TRAFFIC_CAPTURE_DURATION -R 'dcerpc.cn_call_id==123456' -c 10 > ./testout.txt 2>&1
+       $DUT -i $TRAFFIC_CAPTURE_IFACE $TRAFFIC_CAPTURE_PROMISC \
+               -w ./testout.pcap \
+               -a duration:$TRAFFIC_CAPTURE_DURATION \
+               -R 'dcerpc.cn_call_id==123456' \
+               -c 10 \
+               icmp
+               > ./testout.txt 2>&1
        RETURNVALUE=$?
        if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
                test_step_failed "exit status: $RETURNVALUE"
@@ -209,9 +243,16 @@ capture_step_snapshot() {
                 return
         fi
 
+       traffic_gen_ping
+
        # capture with a snapshot length of 68 bytes for $TRAFFIC_CAPTURE_DURATION seconds
        # this should result in no packets
-       $DUT -i $TRAFFIC_CAPTURE_IFACE $TRAFFIC_CAPTURE_PROMISC -w ./testout.pcap -s 68 -a duration:$TRAFFIC_CAPTURE_DURATION > ./testout.txt 2>&1
+       $DUT -i $TRAFFIC_CAPTURE_IFACE $TRAFFIC_CAPTURE_PROMISC \
+               -w ./testout.pcap \
+               -s 68 \
+               -a duration:$TRAFFIC_CAPTURE_DURATION
+               icmp \
+               > ./testout.txt 2>&1
        RETURNVALUE=$?
        if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
                test_step_failed "exit status: $RETURNVALUE"