Author: gnichols
Date: 2012-08-28 12:44:45 +0000 (Tue, 28 Aug 2012)
New Revision: 1370
Removed:
trunk/tests/network/runtest.sh
Modified:
trunk/tests/network/Makefile
trunk/tests/network/network.py
Log:
843609 - network test should not use HAL
Modified: trunk/tests/network/Makefile
===================================================================
--- trunk/tests/network/Makefile 2012-08-27 18:46:20 UTC (rev 1369)
+++ trunk/tests/network/Makefile 2012-08-28 12:44:45 UTC (rev 1370)
@@ -15,20 +15,18 @@
.PHONY: all install download clean
-FILES=runtest.sh network.py
+FILES=network.py
run: $(FILES) build
- ./runtest.sh
build: $(BUILT_FILES)
- chmod a+x ./runtest.sh ./network.py
+ chmod a+x ./network.py
clean:
rm -f $(BUILT_FILES)
-
+
server:
python network.py server $(RUNMODE)
# Include Common Makefile
include $(DESTDIR)/usr/share/v7/lib/v7-make.include
-
Modified: trunk/tests/network/network.py
===================================================================
--- trunk/tests/network/network.py 2012-08-27 18:46:20 UTC (rev 1369)
+++ trunk/tests/network/network.py 2012-08-28 12:44:45 UTC (rev 1370)
@@ -1,9 +1,9 @@
#!/usr/bin/python
-# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
-# is made available to anyone wishing to use, modify, copy, or
-# redistribute it subject to the terms and conditions of the GNU General
+# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
+# is made available to anyone wishing to use, modify, copy, or
+# redistribute it subject to the terms and conditions of the GNU General
# Public License v.2.
-#
+#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
@@ -25,7 +25,6 @@
# sys.path.append("/home/gnichols/devel/v7")
from v7.tags import Constants, DeviceClass
-from v7.hal import Hal
from v7.test import Test, TestTag
from v7.command import Command, V7CommandException
from v7.environment import Environment
@@ -35,7 +34,7 @@
FAILED = 1
PASSED = 0
-class NetworkTest(Test):
+class NetworkTest(Test):
def __init__(self):
Test.__init__(self, name="network")
@@ -44,18 +43,6 @@
self.allOtherInterfaces = list()
self.interfaceSpeed = 100 # speed in Mb/sec
self.oldHandler = None
-
- self.owner = "Greg Nichols <gnichols(a)redhat.com>"
- self.nameSpace = "V7"
- self.testPackage = "v7"
- self.spaceName = ""
- self.path = "v7/tests/network"
- self.version = "1.1"
- self.description = "Network IF test for tcp, udp, icmp and nfs"
- self.testTime = "5m"
- self.runFor = ""
- self.runOn = "\'net\' in info.capabilities"
- self.requires = "lmbench"
self.serverMode = True
self.priority = 2 # set priority high so it runs before longer tests
self.isNFSRootSystem = False
@@ -68,13 +55,13 @@
def plan(self, planner):
tests = dict()
- devices = planner.getHalDeviceDetector().getDevices()
+ devices = planner.getUdevDeviceDetector().getDevices()
for device in devices:
logicalDevice = None
- if "net" in device.getProperty("info.capabilities") and not "xen" in device.getProperty("net.physical_device"):
- logicalDevice = device.getProperty('net.interface')
+ if "net" in device.getProperty("SUBSYSTEM"):
+ logicalDevice = device.getProperty("INTERFACE")
- """ if network logical device was found, and not already planned,
+ """ if network logical device was found, and not already planned,
and it's not in the ignore list, add it"""
if logicalDevice and logicalDevice != "" and not logicalDevice in tests and not self.ignoreInterfaces.search(logicalDevice):
test = self.makeCopy()
@@ -100,7 +87,7 @@
errors.append("Could not determine IP Address.")
if self.getTestServer() == None or self.getTestServer() == "unknown":
- errors.append("No test server was set.")
+ errors.append("No test server was set.")
else:
self.checkTestServer(errors)
@@ -118,9 +105,9 @@
def checkTestServer(self, errors):
result = True
try:
- request = urllib2.Request('http://%s/v7/cgi/v7web.py?command=status' % self.getTestServer())
- opener = urllib2.build_opener()
- response = opener.open(request).readlines()
+ request = urllib2.Request('http://%s/v7/cgi/v7web.py?command=status' % self.getTestServer())
+ opener = urllib2.build_opener()
+ response = opener.open(request).readlines()
nvrPattern = re.compile("%s[^0-9]+(?P<version>[0-9]+\.[0-9]+)[^0-9]+(?P<release>[0-9]+)" % Constants.V7)
statusPattern = re.compile("%s=(?P<status>[a-zA-Z]+)" % Constants.v7serverstatus)
serverRunning = False
@@ -144,16 +131,16 @@
if "Error:" in line:
errors.append("%s says: %s" % (self.getTestServer(), line))
return False
- else:
+ else:
errors.append("Error: The V7 server %s is not running" % self.getTestServer())
return False
- except urllib2.URLError, exception:
+ except urllib2.URLError, exception:
errors.append("Error: Could not contact the V7 server on %s" % self.getTestServer())
errors.append("Error: %s" % exception)
return False
- return result
+ return result
@@ -183,7 +170,7 @@
interface = line.strip()
if not self.ignoreInterfaces.search(interface):
if interface != self.interface:
- self.allOtherInterfaces.append(interface)
+ self.allOtherInterfaces.append(interface)
elif self.debug != Constants.off:
print "ignoring interface %s" % interface
else:
@@ -352,7 +339,7 @@
return self.regenerateTestFile()
- def regenerateTestFile(self):
+ def regenerateTestFile(self):
try:
os.remove(self.testFile)
except OSError:
@@ -372,7 +359,7 @@
return True
- def getInterfaceSpeed(self):
+ def getInterfaceSpeed(self):
# default to 100 Mb/s
self.interfaceSpeed = 0
for interfaceString in (self.interface, "p%s" % self.interface):
@@ -424,12 +411,12 @@
# lat_tcp and bw_tcp report results on stderr, so
# we have to catch the V7CommandException and print the results
# for each of these tests. Also
- print "tcp test:"
+ print "tcp test:"
sys.stdout.flush()
cycles = 5
for p in range(cycles):
- print "test cycle %u of %u" % (p+1, cycles)
- try:
+ print "test cycle %u of %u" % (p+1, cycles)
+ try:
print "testing latency..."
Command("lat_tcp %s" % self.getTestServer()).echo()
except V7CommandException, exception:
@@ -440,7 +427,7 @@
else:
print exception.command.errors[0]
try:
- # bw_tcp is not consistent about return values.
+ # bw_tcp is not consistent about return values.
# it also produces output on stderr in all cases
# this test expects output like "0.0324 0.40 MB/sec"
# on stderr and fails otherwise
@@ -493,8 +480,8 @@
selinuxParams = Command("/usr/sbin/sestatus")
selinuxMode = selinuxParams.getString(regex="Current mode:[ \t]+(?P<selinuxMode>[a-zA-Z]+)", regexGroup="selinuxMode", singleLine=False)
if selinuxMode != "permissive":
- print "Warning: SELinux is in %s mode - it must be set to \"permissive\" for certification testing." % selinuxMode
- return False
+ print "Warning: SELinux is in %s mode - it must be set to \"permissive\" for certification testing." % selinuxMode
+ return False
except V7CommandException, exception:
print "Warning: could not determine selinux parameters"
return False
@@ -512,7 +499,7 @@
print "Error: could not stop %s" % service
print e
result = False
- print " done."
+ print " done."
# httpd
try:
@@ -587,8 +574,8 @@
print "Copying %s x %u mbit files to/from %s" % (files, self.interfaceSpeed, self.getTestServer())
- txtime=0
- rxtime=0
+ txtime=0
+ rxtime=0
t=0
mbit=files*self.interfaceSpeed # where does speed come from?
@@ -611,7 +598,7 @@
txtime = 0
for n in range(files):
print "copy from %s to %s/%s/%u" % (
- self.testFile,
+ self.testFile,
self.nfsdir, self.ipAddress, n)
(start_utime, start_stime, start_cutime, start_cstime, start_elapsed_time) = os.times()
@@ -633,7 +620,7 @@
try:
Command("mount -o %s %s:/var/v7/export %s" % (nfsopts, self.getTestServer(), self.nfsdir)).run()
except V7CommandException, e:
- print "Error: Mount command FAILED"
+ print "Error: Mount command FAILED"
print e
return False
@@ -644,7 +631,7 @@
for n in range(files):
print "copy from %s/%s/%u to %s" % (
self.nfsdir, self.ipAddress, n,
- self.testFile)
+ self.testFile)
(start_utime, start_stime, start_cutime, start_cstime, start_elapsed_time) = os.times()
Command("cp %s/%s/%u datafile.tmp" % (self.nfsdir, self.ipAddress, n)).run()
(stop_utime, stop_stime, stop_cutime, stop_cstime, stop_elapsed_time) = os.times()
@@ -666,7 +653,7 @@
def httpTransferTest(self):
""" transfer a file to the server via POST, then pull it back via GET and compare the files """
errorCount = 0
- for count in range(1,5):
+ for count in range(1,5):
self.regenerateTestFile()
(sentFileCheckSum, uploadIPAddress) = self.httpUpload()
if not uploadIPAddress:
@@ -720,12 +707,12 @@
def httpDownload(self, uploadIPAddress):
# GET the file back
fileURL = 'http://%s/v7/transfer/%s/%s' % (self.getTestServer(), uploadIPAddress, os.path.basename(self.testFile))
- print "getting file %s " % fileURL
+ print "getting file %s " % fileURL
sys.stdout.flush()
request = urllib2.Request(fileURL)
- opener = urllib2.build_opener()
+ opener = urllib2.build_opener()
- startTime = time.time()
+ startTime = time.time()
response = opener.open(request).read()
stopTime = time.time()
print "Download took %.2f seconds, %.2f MB/sec" % (stopTime-startTime, len(response)/((stopTime-startTime)*1000000))
@@ -775,7 +762,7 @@
print "Error: could not add route for testing"
return False
self.setSignalHandler(self.removeRoute)
- else:
+ else:
if not self.downAllOtherInterfaces():
print "Error: could not shutdown all other interfaces"
return False
@@ -791,7 +778,7 @@
return self.prepareForRun()
- def run(self):
+ def run(self):
if not self.runSubTest(self.prepareForRun, "Setup", "prepare for network testing"):
return FAILED
@@ -831,7 +818,3 @@
networkTest = NetworkTest()
returnValue = networkTest.do(sys.argv)
sys.exit(returnValue)
-
-
-
-
Deleted: trunk/tests/network/runtest.sh
===================================================================
--- trunk/tests/network/runtest.sh 2012-08-27 18:46:20 UTC (rev 1369)
+++ trunk/tests/network/runtest.sh 2012-08-28 12:44:45 UTC (rev 1370)
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-v7-run-simple-test ${TEST:-$(basename $PWD)} ./network.py