adding first draft of tests for all examples, they need comments and clean up, some could be made more rebust

This commit is contained in:
Brian O'Connor
2013-09-11 14:45:46 -07:00
parent 5a646a0d20
commit a46fae0687
20 changed files with 914 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env python
"""TEST"""
import unittest
import pexpect
from mininet.log import setLogLevel
class testScratchNet( unittest.TestCase ):
"Test ping with single switch topology (common code)."
results = [ "1 packets transmitted, 1 received, 0% packet loss", pexpect.EOF ]
def pingTest( self, name ):
p = pexpect.spawn( 'python -m %s' % name )
index = p.expect( self.results )
self.assertEqual( index, 0 )
def testPingKernel( self ):
self.pingTest( 'mininet.examples.scratchnet' )
def testPingUser( self ):
self.pingTest( 'mininet.examples.scratchnetuser' )
if __name__ == '__main__':
setLogLevel( 'warning' )
unittest.main()