Statistics
| Branch: | Tag: | Revision:

mininet / mininet / test / runner.py @ 18aab5b7

History | View | Annotate | Download (906 Bytes)

1
#!/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
from unittest import defaultTestLoader, TextTestRunner
10
import os
11
import sys
12
from mininet.util import ensureRoot
13
from mininet.clean import cleanup
14
from mininet.log import setLogLevel
15

    
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 = defaultTestLoader.discover( testDir )
23
    # run tests
24
    TextTestRunner( verbosity=verbosity ).run( testSuite )
25

    
26
if __name__ == '__main__':
27
    setLogLevel( 'warning' )
28
    # get the directory containing example tests
29
    thisdir = os.path.dirname( os.path.realpath( __file__ ) )
30
    vlevel = 2 if '-v' in sys.argv else 1
31
    runTests( testDir=thisdir, verbosity=vlevel )