Author: gnichols
Date: 2012-03-16 16:30:54 +0000 (Fri, 16 Mar 2012)
New Revision: 1224
Modified:
trunk/tests/network/network.py
Log:
799897 - v7 server starts/stops returns 1
Modified: trunk/tests/network/network.py
===================================================================
--- trunk/tests/network/network.py 2012-03-16 16:30:06 UTC (rev 1223)
+++ trunk/tests/network/network.py 2012-03-16 16:30:54 UTC (rev 1224)
@@ -463,19 +463,31 @@
def startServer(self):
- self.checkSELinux()
+ result = self.checkSELinux()
# start the bandwidth test server
sys.stdout.write("Starting lmbench services...")
sys.stdout.flush()
if not os.system("bw_tcp -s") is 0:
print " FAILED"
+ result = False
elif not os.system("lat_udp -s") is 0:
print " FAILED"
+ result = False
else:
print " done."
# httpd
- os.system("service httpd start")
+ try:
+ start = Command("service httpd start")
+ start.echo()
+ if "[FAILED]" in "".join(start.output):
+ result = False
+ except Exception, e:
+ print "Error: could not start httpd"
+ print e
+ result = False
+
+ return result
def checkSELinux(self):
try:
@@ -493,12 +505,28 @@
def stopServer(self):
sys.stdout.write("Stopping lmbench services...")
sys.stdout.flush()
- os.system("bw_tcp -S localhost")
- os.system("lat_udp -S localhost")
+ result = True
+ for service in ["bw_tcp", "lat_udp"]:
+ try:
+ Command("%s -S localhost" % service).echo()
+ except Exception, e:
+ print "Error: could not stop %s" % service
+ print e
+ result = False
print " done."
# httpd
- os.system("service httpd stop")
+ try:
+ stop = Command("service httpd stop")
+ stop.echo()
+ if "[FAILED]" in "".join(stop.output):
+ result = False
+ except Exception, e:
+ print "Error: could not stop httpd."
+ print e
+ result = False
+
+ return result
# YK: added statusServer
def statusServer(self):
Show replies by date