blob: f4c9e1f1649c2b511800fc666f4f30ac2e5185e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/usr/bin/env python
import glob
import os
import sys
import unittest
import common
if len(sys.argv) == 3:
buildDir = sys.argv[1]
srcDir = sys.argv[2]
else:
if len(sys.argv) == 2:
program = sys.argv[1]
if program.endswith('.py'):
program = program[:-3]
else:
program = None
buildDir = '..'
srcDir = '.'
common.importModules(buildDir=buildDir,
srcDir=srcDir)
SKIP_FILES = ['common', 'runtests']
dir = os.path.split(os.path.abspath(__file__))[0]
os.chdir(dir)
def gettestnames():
files = glob.glob('*.py')
names = map(lambda x: x[:-3], files)
map(names.remove, SKIP_FILES)
return names
suite = unittest.TestSuite()
loader = unittest.TestLoader()
for name in gettestnames():
if program and program not in name:
continue
suite.addTest(loader.loadTestsFromName(name))
testRunner = unittest.TextTestRunner()
testRunner.run(suite)
|