aboutsummaryrefslogtreecommitdiffstats
path: root/capstone/suite/regress/regress.py
blob: 2e4f2536bc2126409a70baf1203d53c1cd43c6a2 (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
#!/usr/bin/python

import unittest

from os.path import dirname, basename, isfile
import glob

# Find all unittest type in this directory and run it.

class RegressTest(unittest.TestCase):
    pass

def main():
    unittest.main()

if __name__ == '__main__':
    directory = dirname(__file__)
    if directory == '':
        directory = '.'
    modules = glob.glob(directory+"/*.py")
    __all__ = [ basename(f)[:-3] for f in modules if isfile(f)]
    suite = unittest.TestSuite()

    for module in __all__:
        m = __import__(module)
        for cl in dir(m):
            try:
                realcl = getattr(m,cl)
                if issubclass(realcl, unittest.TestCase):
                    suite.addTest(realcl())
            except Exception as e:
                pass

    unittest.TextTestRunner().run(suite)