8 from mininet.util import pexpect
11 class testLimit( unittest.TestCase ):
13 @unittest.skipIf( '-quick' in sys.argv, 'long test' )
14 def testLimit( self ):
15 "Verify that CPU limits are within a 2% tolerance of limit for each scheduler"
16 p = pexpect.spawn( 'python -m mininet.examples.limit' )
17 opts = [ '\*\*\* Testing network ([\d\.]+) Mbps',
18 '\*\*\* Results: \[([\d\., ]+)\]',
24 index = p.expect( opts )
26 bw = float( p.match.group( 1 ) )
29 results = p.match.group( 1 )
30 for x in results.split( ',' ):
32 self.assertTrue( result < bw + tolerance )
33 self.assertTrue( result > bw - tolerance )
37 self.assertTrue( count > 0 )
39 if __name__ == '__main__':