Revision 5365831d examples/test/test_simpleperf.py

View differences:

examples/test/test_simpleperf.py
16 16
    @unittest.skipIf( '-quick' in sys.argv, 'long test' )
17 17
    def testE2E( self ):
18 18
        "Run the example and verify iperf results"
19
        # 10 Mb/s, plus or minus 20% tolerance
19 20
        BW = 10
20
        TOLERANCE = .8
21
        expectedBw = BW * TOLERANCE
22
        p = pexpect.spawn( 'python -m mininet.examples.simpleperf' )
21
	TOLERANCE = .2 
22
        p = pexpect.spawn( 'python -m mininet.examples.simpleperf testmode' )
23 23
        # check iperf results
24 24
        p.expect( "Results: \['10M', '([\d\.]+) .bits/sec", timeout=480 )
25 25
        measuredBw = float( p.match.group( 1 ) )
26
        lowerBound = expectedBw * TOLERANCE
27
        upperBound = expectedBw + expectedBw * ( 1 - TOLERANCE )
26
        lowerBound = BW * ( 1 - TOLERANCE )
27
        upperBound = BW + ( 1 + TOLERANCE )
28 28
        self.assertGreaterEqual( measuredBw, lowerBound )
29 29
        self.assertLessEqual( measuredBw, upperBound )
30 30
        p.wait()

Also available in: Unified diff