Author: gnichols
Date: 2011-03-31 12:33:36 +0000 (Thu, 31 Mar 2011)
New Revision: 854
Modified:
trunk/tests/network/network.py
Log:
677752 - FEAT: network test ICMP/ping test improvements
Modified: trunk/tests/network/network.py
===================================================================
--- trunk/tests/network/network.py 2011-03-31 12:30:48 UTC (rev 853)
+++ trunk/tests/network/network.py 2011-03-31 12:33:36 UTC (rev 854)
@@ -352,26 +352,30 @@
# icmpTest uses ping with various packet sizes
def icmpTest(self):
# (<bytes in packet>, <percent lost for warning>)
- packetSizes = [(0, 0), (1, 0), (240, 10), (256, 15), (1024, 20), (2000, 30), (10000, 40), (40000, 60), (65507, 80)]
- try:
- for (size, warnLoss) in packetSizes:
- sizeParam = ""
- if size > 0:
- sizeParam = "-s %s" % size
- ping = Command("/bin/ping -i 0 -q -c 1000 %s %s" % (sizeParam, self.getTestServer()))
+ # prior release packed sizes, with some margins
+ # packetSizes = [(0, 0), (1, 0), (240, 10), (256, 15), (1024, 20), (2000, 30), (10000, 40), (40000, 60), (65507, 80)]
+ # We now use default packet size, 100% margin, allowing 5 retries (see BZ 677752 )
+ retries = 5
+ packetCount = 5000
+ lossMargin = 0
+ while retries > 0:
+ try:
+ ping = Command("/bin/ping -i 0 -q -c %u %s" % (packetCount, self.getTestServer()))
print ping.command
packetLoss = ping.getString(regex="^.*, (?P<packetLoss>[0-9]+)% packet loss.*$", regexGroup="packetLoss", singleLine=False)
ping.printOutput()
- if int(packetLoss) > warnLoss:
- print "Warning: packet loss of %s%% is greater than %s%% expected" % (packetLoss, warnLoss)
- except V7CommandException, exception:
- print "Error:"
- print exception
- ping.printErrors()
- return False
+ if int(packetLoss) <= lossMargin:
+ return True
+ # otherwise
+ print "Note: packet loss of %s%% is greater than %s%% expected" % (packetLoss, lossMargin)
+ except V7CommandException, exception:
+ print "Warning:"
+ print exception
+ ping.printErrors()
+ retries = retries -1
# otherwise
- return True
+ return False
def tcpTest(self):
# lat_tcp and bw_tcp report results on stderr, so