Skip to content
Snippets Groups Projects
Commit 94abeeab authored by Brian O'Connor's avatar Brian O'Connor
Browse files

cleaned up and commented test_cpu.py

parent b7e50634
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python #!/usr/bin/env python
"""TEST""" """
Test for cpu.py
"""
import unittest import unittest
import pexpect import pexpect
from mininet.log import setLogLevel
class testCPU( unittest.TestCase ): class testCPU( unittest.TestCase ):
"Test ping with single switch topology (common code)."
prompt = 'mininet>' prompt = 'mininet>'
def testCPU( self ): def testCPU( self ):
opts = [ '([a-z]+)\t([\d\.]+)%\t([\d\.]+)', pexpect.EOF ] "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' )
opts = [ '([a-z]+)\t([\d\.]+)%\t([\d\.]+)', pexpect.EOF ]
scheds = [] scheds = []
while True: while True:
index = p.expect( opts, timeout=600 ) index = p.expect( opts, timeout=600 )
...@@ -32,5 +33,4 @@ def testCPU( self ): ...@@ -32,5 +33,4 @@ def testCPU( self ):
self.assertTrue( len( scheds ) > 0 ) self.assertTrue( len( scheds ) > 0 )
if __name__ == '__main__': if __name__ == '__main__':
setLogLevel( 'warning' )
unittest.main() unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment