Try specifying timeout in pexpect.spawn() + adjust error msg
Unfortunately pexpect() seems to be timing out with a 30 second timeout rather than the 600 seconds we are passing in. How could this even be working normally? It is puzzling. We are going to try specifying the timeout in the spawn() call. Also if the test fails, we use %e format for readability.
This commit is contained in:
@@ -25,13 +25,13 @@ class testCPU( unittest.TestCase ):
|
||||
@unittest.skipIf( '-quick' in sys.argv, 'long test' )
|
||||
def testCPU( self ):
|
||||
"Verify that CPU utilization is monotonically decreasing for each scheduler"
|
||||
p = pexpect.spawn( 'python -m mininet.examples.cpu' )
|
||||
p = pexpect.spawn( 'python -m mininet.examples.cpu', timeout=300 )
|
||||
# matches each line from results( shown above )
|
||||
opts = [ '([a-z]+)\t([\d\.]+)%\t([\d\.e\+]+)',
|
||||
pexpect.EOF ]
|
||||
scheds = []
|
||||
while True:
|
||||
index = p.expect( opts, timeout=600 )
|
||||
index = p.expect( opts )
|
||||
if index == 0:
|
||||
sched = p.match.group( 1 )
|
||||
cpu = float( p.match.group( 2 ) )
|
||||
@@ -40,7 +40,7 @@ class testCPU( unittest.TestCase ):
|
||||
scheds.append( sched )
|
||||
else:
|
||||
self.assertTrue( bw < previous_bw,
|
||||
"%f should be less than %f\n" %
|
||||
"%e should be less than %e\n" %
|
||||
( bw, previous_bw ) )
|
||||
previous_bw = bw
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user