Bug 915245 - Add manifest support to cpp unittest harness; r=ted
authorDan Minor <dminor@mozilla.com>
Tue, 24 Sep 2013 07:18:58 -0400
changeset 148428 3934868da81ee715c9cb357ad2288199bc8c92dd
parent 148427 008ba688cd5a66be5fec65a3332aab7632bdc436
child 148429 5815d18461a2cc60cce4931265148a7da9500e02
push id34215
push userdminor@mozilla.com
push dateTue, 24 Sep 2013 11:38:33 +0000
treeherdermozilla-inbound@3934868da81e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs915245
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 915245 - Add manifest support to cpp unittest harness; r=ted
testing/android_cppunittest_manifest.txt
testing/remotecppunittests.py
testing/runcppunittests.py
testing/testsuite-targets.mk
new file mode 100644
--- /dev/null
+++ b/testing/android_cppunittest_manifest.txt
@@ -0,0 +1,5 @@
+# This is just a list of tests to skip, one test per line
+TestTXMgr                       # Bug 919595
+TestPlainTextSerializer         # Bug 919599
+TestNativeXMLHttpRequest        # Bug 919642
+mediapipeline_unittest          # Bug 919646
--- a/testing/remotecppunittests.py
+++ b/testing/remotecppunittests.py
@@ -222,17 +222,17 @@ def main():
         else:
             dm = devicemanagerADB.DeviceManagerADB(packageName=None, deviceRoot=options.remote_test_root)
     else:
         dm = devicemanagerSUT.DeviceManagerSUT(options.device_ip, options.device_port, deviceRoot=options.remote_test_root)
         if not options.device_ip:
             print "Error: you must provide a device IP to connect to via the --deviceIP option"
             sys.exit(1)
     options.xre_path = os.path.abspath(options.xre_path)
-    progs = cppunittests.extract_unittests_from_args(args)
+    progs = cppunittests.extract_unittests_from_args(args, options.manifest_file)
     tester = RemoteCPPUnitTests(dm, options, progs)
     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)
 
--- a/testing/runcppunittests.py
+++ b/testing/runcppunittests.py
@@ -132,40 +132,55 @@ class CPPUnittestOptions(OptionParser):
         self.add_option("--xre-path",
                         action = "store", type = "string", dest = "xre_path",
                         default = None,
                         help = "absolute path to directory containing XRE (probably xulrunner)")
         self.add_option("--symbols-path",
                         action = "store", type = "string", dest = "symbols_path",
                         default = None,
                         help = "absolute path to directory containing breakpad symbols, or the URL of a zip file containing symbols")
+        self.add_option("--skip-manifest",
+                        action = "store", type = "string", dest = "manifest_file",
+                        default = None,
+                        help = "absolute path to a manifest file")
 
-def extract_unittests_from_args(args):
+def extract_unittests_from_args(args, manifest_file):
     """Extract unittests from args, expanding directories as needed"""
     progs = []
+    skipped_progs = set()
+
+    if manifest_file:
+        skipped_progs.add(os.path.basename(manifest_file))
+        with open(manifest_file) as f:
+            for line in f:
+                # strip out comment, if any
+                prog = line.split('#')[0]
+                if prog:
+                    skipped_progs.add(prog.strip())
 
     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.extend([os.path.abspath(os.path.join(p, x)) for x in os.listdir(p) if not x in skipped_progs])
+        elif p not in skipped_progs:
             progs.append(os.path.abspath(p))
 
-    return progs
+    #filter out python files packaged with the unit tests
+    return filter(lambda x: not x.endswith('.py') and not x.endswith('.pyc'), progs)
 
 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 = extract_unittests_from_args(args)
+        
+    progs = extract_unittests_from_args(args, options.manifest_file)
     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)
--- a/testing/testsuite-targets.mk
+++ b/testing/testsuite-targets.mk
@@ -499,16 +499,17 @@ stage-cppunittests:
 	$(NSINSTALL) -D $(PKG_STAGE)/cppunittests
 ifdef OBJCOPY
 	$(foreach bin,$(CPP_UNIT_TEST_BINS),$(OBJCOPY) --strip-unneeded $(bin) $(bin:$(DIST)/%=$(PKG_STAGE)/%);)
 else
 	cp -RL $(DIST)/cppunittests $(PKG_STAGE)
 endif
 	$(NSINSTALL) $(topsrcdir)/testing/runcppunittests.py $(PKG_STAGE)/cppunittests
 	$(NSINSTALL) $(topsrcdir)/testing/remotecppunittests.py $(PKG_STAGE)/cppunittests
+	$(NSINSTALL) $(topsrcdir)/testing/android_cppunittest_manifest.txt $(PKG_STAGE)/cppunittests
 
 stage-jittest:
 	$(NSINSTALL) -D $(PKG_STAGE)/jit-test/tests
 	cp -RL $(topsrcdir)/js/src/jsapi.h $(PKG_STAGE)/jit-test
 	cp -RL $(topsrcdir)/js/src/jit-test $(PKG_STAGE)/jit-test/jit-test
 	cp -RL $(topsrcdir)/js/src/tests/ecma_6 $(PKG_STAGE)/jit-test/tests/ecma_6
 	cp -RL $(topsrcdir)/js/src/tests/lib $(PKG_STAGE)/jit-test/tests/lib