Statistics
| Branch: | Tag: | Revision:

mininet / mininet / test / runner.py @ ca5b0c56

History | View | Annotate | Download (873 Bytes)

1 895ff6f4 Brian O'Connor
#!/usr/bin/env python
2
3
"""
4
Run all mininet core tests
5
 -v : verbose output
6
 -quick : skip tests that take more than ~30 seconds
7
"""
8
9
import unittest
10
import os
11
import sys
12
from mininet.util import ensureRoot
13
from mininet.clean import cleanup
14 ca5b0c56 Bob Lantz
from mininet.log import setLogLevel
15 895ff6f4 Brian O'Connor
16
def runTests( testDir, verbosity=1 ):
17
    "discover and run all tests in testDir"
18
    # ensure root and cleanup before starting tests
19
    ensureRoot()
20
    cleanup()
21
    # discover all tests in testDir
22
    testSuite = unittest.defaultTestLoader.discover( testDir )
23
    # run tests
24
    unittest.TextTestRunner( verbosity=verbosity ).run( testSuite )
25
26
if __name__ == '__main__':
27 ca5b0c56 Bob Lantz
    setLogLevel( 'warning' )
28 895ff6f4 Brian O'Connor
    # get the directory containing example tests
29
    testDir = os.path.dirname( os.path.realpath( __file__ ) )
30
    verbosity = 2 if '-v' in sys.argv else 1
31
    runTests( testDir, verbosity )