mbligh | fa29a2a | 2008-05-16 22:48:09 +0000 | [diff] [blame] | 1 | #!/usr/bin/python |
mbligh | f975133 | 2008-04-08 18:25:33 +0000 | [diff] [blame] | 2 | |
| 3 | import os, sys |
| 4 | import unittest |
| 5 | |
| 6 | # ensure the root is where it should be |
mbligh | 3c9c93d | 2008-05-21 18:19:38 +0000 | [diff] [blame] | 7 | root = os.path.abspath(os.path.dirname(__file__)) |
| 8 | from client import setup_modules |
| 9 | setup_modules.setup(base_path=root, root_module_name="autotest_lib") |
mbligh | f975133 | 2008-04-08 18:25:33 +0000 | [diff] [blame] | 10 | |
| 11 | |
| 12 | suites = [] |
| 13 | def lister(dummy, dirname, files): |
| 14 | loader = unittest.TestLoader() |
| 15 | for f in files: |
| 16 | if f.endswith('_unittest.py'): |
| 17 | temp = os.path.join(dirname, f).strip('.py') |
mbligh | 3c9c93d | 2008-05-21 18:19:38 +0000 | [diff] [blame] | 18 | mod = ('autotest_lib' |
| 19 | + temp[len(root):].replace('/', '.')) |
mbligh | f975133 | 2008-04-08 18:25:33 +0000 | [diff] [blame] | 20 | suite = loader.loadTestsFromName(mod) |
| 21 | suites.append(suite) |
| 22 | |
| 23 | |
| 24 | if __name__ == "__main__": |
| 25 | os.path.walk(root, lister, None) |
| 26 | alltests = unittest.TestSuite(suites) |
| 27 | runner = unittest.TextTestRunner(verbosity=2) |
mbligh | fa29a2a | 2008-05-16 22:48:09 +0000 | [diff] [blame] | 28 | runner.run(alltests) |