bug 1041347 - Package and provide path to fake GMP plugin for Mochitests. r=jmaher a=sylvestre
authorTed Mielczarek <ted@mielczarek.org>
Fri, 25 Jul 2014 07:01:13 -0400
changeset 216183 debfa7a18dff47f37570de6cd239ccec7030ecaa
parent 216182 9730317edd1a4947ee67f059815a2e2691a43ea3
child 216184 3fb159eeaad747ec7e2b1722e91117625240e335
push id3857
push userraliiev@mozilla.com
push dateTue, 02 Sep 2014 16:39:23 +0000
treeherdermozilla-beta@5638b907b505 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher, sylvestre
bugs1041347
milestone33.0a2
bug 1041347 - Package and provide path to fake GMP plugin for Mochitests. r=jmaher a=sylvestre
dom/media/tests/mochitest/mochitest.ini
testing/mochitest/Makefile.in
testing/mochitest/runtests.py
testing/mochitest/runtestsb2g.py
testing/mochitest/runtestsremote.py
--- a/dom/media/tests/mochitest/mochitest.ini
+++ b/dom/media/tests/mochitest/mochitest.ini
@@ -59,18 +59,17 @@ skip-if = toolkit == 'gonk' # b2g(Bug 96
 skip-if = toolkit == 'gonk' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
 [test_peerConnection_basicVideo.html]
 skip-if = toolkit == 'gonk' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
 [test_peerConnection_basicScreenshare.html]
 skip-if = toolkit == 'gonk' || toolkit == 'android' # no screenshare on b2g/android
 [test_peerConnection_basicWindowshare.html]
 skip-if = toolkit == 'gonk' || toolkit == 'android' # no windowshare on b2g/android
 [test_peerConnection_basicH264Video.html]
-skip-if = true # disabled until we can resolve plugin installation issues
-#skip-if = toolkit == 'gonk' || toolkit == 'android' # no openh264 on b2g/android
+skip-if = buildapp == 'b2g' || os == 'android' # bug 1043403
 [test_peerConnection_bug822674.html]
 [test_peerConnection_bug825703.html]
 [test_peerConnection_bug827843.html]
 skip-if = toolkit == 'gonk' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
 [test_peerConnection_bug834153.html]
 [test_peerConnection_bug835370.html]
 [test_peerConnection_bug1013809.html]
 skip-if = (toolkit == 'gonk' && debug) # b2g emulator seems to be too slow (Bug 1016498 and 1008080)
--- a/testing/mochitest/Makefile.in
+++ b/testing/mochitest/Makefile.in
@@ -159,24 +159,29 @@ TEST_HARNESS_PLUGINS := \
   JavaTest.plugin/
 else
 TEST_HARNESS_PLUGINS := \
   $(DLL_PREFIX)nptest$(DLL_SUFFIX) \
   $(DLL_PREFIX)npsecondtest$(DLL_SUFFIX) \
   $(DLL_PREFIX)nptestjava$(DLL_SUFFIX)
 endif
 
+GMP_TEST_FILES := \
+  $(topsrcdir)/dom/media/gmp-plugin/fake.info \
+  $(DEPTH)/dom/media/gmp-plugin/$(DLL_PREFIX)fake$(DLL_SUFFIX)
+
 # Rules for staging the necessary harness bits for a test package
 PKG_STAGE = $(DIST)/test-stage
 DIST_BIN = $(DIST)/bin
 
 $(_DEST_DIR):
 	$(NSINSTALL) -D $@
 
 stage-package:
-	$(NSINSTALL) -D $(PKG_STAGE)/mochitest && $(NSINSTALL) -D $(PKG_STAGE)/bin/plugins && $(NSINSTALL) -D $(DIST)/plugins
+	$(NSINSTALL) -D $(PKG_STAGE)/mochitest && $(NSINSTALL) -D $(PKG_STAGE)/bin/plugins && $(NSINSTALL) -D $(DIST)/plugins && $(NSINSTALL) -D $(PKG_STAGE)/bin/plugins/gmp-fake
 	cp $(DEPTH)/mozinfo.json $(PKG_STAGE)/mochitest
 	(cd $(DEPTH)/_tests/testing && tar $(TAR_CREATE_FLAGS) - mochitest) | (cd $(PKG_STAGE) && tar -xf -)
 	@cp $(DEPTH)/mozinfo.json $(PKG_STAGE)/mochitest
 	@(cd $(DIST_BIN) && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_BINS)) | (cd $(PKG_STAGE)/bin && tar -xf -)
 	@(cd $(DIST_BIN)/components && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_COMPONENTS)) | (cd $(PKG_STAGE)/bin/components && tar -xf -)
 	(cd $(topsrcdir)/build/pgo && tar $(TAR_CREATE_FLAGS) - certs) | (cd $(PKG_STAGE) && tar -xf -)
 	@(cd $(DIST)/plugins && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_PLUGINS)) | (cd $(PKG_STAGE)/bin/plugins && tar -xf -)
+	$(foreach x,$(GMP_TEST_FILES),cp $(x) $(PKG_STAGE)/bin/plugins/gmp-fake;)
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -1130,16 +1130,29 @@ class Mochitest(MochitestUtilsMixin):
     # TODO: this should really be upstreamed somewhere, maybe mozprofile
     certificateStatus = self.fillCertificateDB(options)
     if certificateStatus:
       log.error("TEST-UNEXPECTED-FAIL | runtests.py | Certificate integration failed")
       return None
 
     return manifest
 
+  def getGMPPluginPath(self, options):
+    # For local builds, gmp-fake will be under dist/bin.
+    gmp_path = os.path.join(options.xrePath, 'gmp-fake')
+    if os.path.isdir(gmp_path):
+      return gmp_path
+
+    # For packaged builds, gmp-fake will get copied under $profile/plugins.
+    gmp_path = os.path.join(self.profile.profile, 'plugins', 'gmp-fake')
+    if os.path.isdir(gmp_path):
+      return gmp_path
+    # This is fatal for desktop environments.
+    raise EnvironmentError('Could not find gmp-fake')
+
   def buildBrowserEnv(self, options, debugger=False):
     """build the environment variables for the specific test and operating system"""
     if mozinfo.info["asan"]:
       lsanPath = SCRIPT_DIR
     else:
       lsanPath = None
 
     browserEnv = self.environment(xrePath=options.xrePath, debugger=debugger,
@@ -1149,23 +1162,27 @@ class Mochitest(MochitestUtilsMixin):
     # via the commandline at your own risk.
     browserEnv["XPCOM_DEBUG_BREAK"] = "stack"
 
     # interpolate environment passed with options
     try:
       browserEnv.update(dict(parseKeyValue(options.environment, context='--setenv')))
     except KeyValueParseError, e:
       log.error(str(e))
-      return
+      return None
 
     browserEnv["XPCOM_MEM_BLOAT_LOG"] = self.leak_report_file
 
-    # GMP fake plugin
-    # XXX should find a better solution
-    browserEnv["MOZ_GMP_PATH"] = options.xrePath + "/gmp-fake"
+    try:
+      gmp_path = self.getGMPPluginPath(options)
+      if gmp_path is not None:
+          browserEnv["MOZ_GMP_PATH"] = gmp_path
+    except EnvironmentError:
+      log.error('Could not find path to gmp-fake plugin!')
+      return None
 
     if options.fatalAssertions:
       browserEnv["XPCOM_DEBUG_BREAK"] = "stack-and-abort"
 
     # Produce an NSPR log, is setup (see NSPR_LOG_MODULES global at the top of
     # this script).
     self.nsprLogs = NSPR_LOG_MODULES and "MOZ_UPLOAD_DIR" in os.environ
     if self.nsprLogs:
--- a/testing/mochitest/runtestsb2g.py
+++ b/testing/mochitest/runtestsb2g.py
@@ -207,16 +207,20 @@ class B2GMochitest(MochitestUtilsMixin):
 
         log.info("runtestsb2g.py | Running tests: end.")
         self.message_logger.finish()
 
         if manifest is not None:
             self.cleanup(manifest, options)
         return status
 
+    def getGMPPluginPath(self, options):
+        # TODO: bug 1043403
+        return None
+
 
 class B2GDeviceMochitest(B2GMochitest, Mochitest):
     remote_log = None
 
     def __init__(self, marionette_args, profile_data_dir,
                  local_binary_dir, remote_test_root=None, remote_log_file=None):
         B2GMochitest.__init__(self, marionette_args, out_of_process=True, profile_data_dir=profile_data_dir)
         self.local_log = None
--- a/testing/mochitest/runtestsremote.py
+++ b/testing/mochitest/runtestsremote.py
@@ -546,16 +546,20 @@ class MochiRemote(Mochitest):
 
             fHandle.write("envvars=%s\n" % envstr)
         fHandle.close()
 
         self._dm.removeFile(os.path.join(deviceRoot, "robotium.config"))
         self._dm.pushFile(fHandle.name, os.path.join(deviceRoot, "robotium.config"))
         os.unlink(fHandle.name)
 
+    def getGMPPluginPath(self, options):
+        # TODO: bug 1043403
+        return None
+
     def buildBrowserEnv(self, options, debugger=False):
         browserEnv = Mochitest.buildBrowserEnv(self, options, debugger=debugger)
         self.buildRobotiumConfig(options, browserEnv)
         return browserEnv
 
     def runApp(self, *args, **kwargs):
         """front-end automation.py's `runApp` functionality until FennecRunner is written"""