blob: ca531e869154ca6038130d323f690e0501fa0c1c [file] [log] [blame]
mblighfa29a2a2008-05-16 22:48:09 +00001#!/usr/bin/python
mblighf9751332008-04-08 18:25:33 +00002
mbligh8c435fe2008-06-12 19:39:14 +00003import os, sys
mblighf9751332008-04-08 18:25:33 +00004import unittest
mblighdc906012008-06-27 19:29:11 +00005import common
mblighf9751332008-04-08 18:25:33 +00006
mbligh3c9c93d2008-05-21 18:19:38 +00007root = os.path.abspath(os.path.dirname(__file__))
mblighf9751332008-04-08 18:25:33 +00008suites = []
9def lister(dummy, dirname, files):
jadmanski0afbb632008-06-06 21:10:57 +000010 loader = unittest.TestLoader()
11 for f in files:
12 if f.endswith('_unittest.py'):
13 temp = os.path.join(dirname, f).strip('.py')
mblighaadd0832008-06-11 15:40:19 +000014 mod = 'autotest_lib' + temp[len(root):].replace('/', '.')
15 try:
16 suite = loader.loadTestsFromName(mod)
17 suites.append(suite)
mbligh27d0cb92008-06-12 20:49:09 +000018 except Exception, err:
19 print "module failed to load: %s: %s" % (mod, err)
mblighf9751332008-04-08 18:25:33 +000020
21
22if __name__ == "__main__":
mbligh8c435fe2008-06-12 19:39:14 +000023 if len(sys.argv) == 2:
24 start = os.path.join(root, sys.argv[1])
25 else:
26 start = root
27 os.path.walk(start, lister, None)
jadmanski0afbb632008-06-06 21:10:57 +000028 alltests = unittest.TestSuite(suites)
29 runner = unittest.TextTestRunner(verbosity=2)
30 runner.run(alltests)