Bug 892439: runcppunittests.py should accept either test files or test directories from the command line; r=ted
authorDan Minor <dminor@mozilla.com>
Fri, 12 Jul 2013 07:42:14 -0400
changeset 138299 1eb8567e0743cb0c1252721ead67493e976d5fa6
parent 138298 8ef0e9fa1f16874abbf282d212be14452ed31747
child 138300 d218deb5ac962653a92bd415f13639ee12042edf
push idunknown
push userunknown
push dateunknown
reviewersted
bugs892439
milestone25.0a1
Bug 892439: runcppunittests.py should accept either test files or test directories from the command line; r=ted
testing/runcppunittests.py
--- a/testing/runcppunittests.py
+++ b/testing/runcppunittests.py
@@ -134,17 +134,23 @@ def main():
     parser = CPPUnittestOptions()
     options, args = parser.parse_args()
     if not args:
         print >>sys.stderr, """Usage: %s <test binary> [<test binary>...]""" % sys.argv[0]
         sys.exit(1)
     if not options.xre_path:
         print >>sys.stderr, """Error: --xre-path is required"""
         sys.exit(1)
-    progs = [os.path.abspath(p) for p in args]
+    progs = []
+    for p in args:
+        if os.path.isdir(p):
+            #filter out .py files packaged with the unit tests
+            progs.extend([os.path.abspath(os.path.join(p, x)) for x in os.listdir(p) if not x.endswith('.py')])
+        else:
+            progs.append(os.path.abspath(p))
     options.xre_path = os.path.abspath(options.xre_path)
     tester = CPPUnitTests()
     try:
         result = tester.run_tests(progs, options.xre_path, options.symbols_path)
     except Exception, e:
         log.error(str(e))
         result = False
     sys.exit(0 if result else 1)