Update and rename MantenerFIFO to MantenerFIFO.md
[vsorcdistro/.git] / mininet / examples / test / test_treeping64.py
1 #!/usr/bin/env python
2
3 """
4 Test for treeping64.py
5 """
6
7 import unittest
8 from mininet.util import pexpect
9 import sys
10
11 class testTreePing64( unittest.TestCase ):
12
13     prompt = 'mininet>'
14
15     @unittest.skipIf( '-quick' in sys.argv, 'long test' )
16     def testTreePing64( self ):
17         "Run the example and verify ping results"
18         p = pexpect.spawn( 'python -m mininet.examples.treeping64' )
19         p.expect( 'Tree network ping results:', timeout=6000 )
20         count = 0
21         while True:
22             index = p.expect( [ '(\d+)% packet loss', pexpect.EOF ] )
23             if index == 0:
24                 percent = int( p.match.group( 1 ) ) if p.match else -1
25                 self.assertEqual( percent, 0 )
26                 count += 1
27             else:
28                 break
29         self.assertTrue( count > 0 )
30
31 if __name__ == '__main__':
32     unittest.main()