Bug 1248565 - Make test infra use MOZ_LOG_FILE and MOZ_LOG_MODULES. r=jmaher
authorHonza Bambas <honzab.moz@firemni.cz>
Fri, 11 Mar 2016 08:27:00 -0500
changeset 289422 deba80c525f09dd47c93be1f8fa7bc34c6dbb3d0
parent 289421 fc3daa3b3aefa9436f7672a8d6ae9c4f9f0cd855
child 289423 e627a445ff01f28fb49c32f2e28e91c034420574
push id30102
push userryanvm@gmail.com
push dateSat, 19 Mar 2016 15:23:17 +0000
treeherdermozilla-central@720fb3d55e28 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1248565
milestone48.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 1248565 - Make test infra use MOZ_LOG_FILE and MOZ_LOG_MODULES. r=jmaher
testing/mochitest/runrobocop.py
testing/mochitest/runtests.py
testing/mochitest/runtestsremote.py
--- a/testing/mochitest/runrobocop.py
+++ b/testing/mochitest/runrobocop.py
@@ -55,17 +55,17 @@ class RobocopTestRunner(MochitestDesktop
         self.remoteProfile = options.remoteTestRoot + "/profile"
         self.remoteProfileCopy = options.remoteTestRoot + "/profile-copy"
         self.auto.setRemoteProfile(self.remoteProfile)
         self.remoteConfigFile = os.path.join(
             self.deviceRoot, "robotium.config")
         self.remoteLog = options.remoteLogFile
         self.auto.setRemoteLog(self.remoteLog)
         self.remoteScreenshots = "/mnt/sdcard/Robotium-Screenshots"
-        self.remoteNSPR = os.path.join(options.remoteTestRoot, "nspr")
+        self.remoteMozLog = os.path.join(options.remoteTestRoot, "mozlog")
         self.auto.setServerInfo(
             self.options.webServer, self.options.httpPort, self.options.sslPort)
         self.localLog = options.logFile
         self.localProfile = None
         productPieces = self.options.remoteProductName.split('.')
         if (productPieces is not None):
             self.auto.setProduct(productPieces[0])
         else:
@@ -87,18 +87,18 @@ class RobocopTestRunner(MochitestDesktop
         # Try to avoid those failures by checking for and killing orphan servers before
         # trying to start new ones.
         self.killNamedOrphans('ssltunnel')
         self.killNamedOrphans('xpcshell')
         self.auto.deleteANRs()
         self.auto.deleteTombstones()
         self.dm.killProcess(self.options.app.split('/')[-1])
         self.dm.removeDir(self.remoteScreenshots)
-        self.dm.removeDir(self.remoteNSPR)
-        self.dm.mkDir(self.remoteNSPR)
+        self.dm.removeDir(self.remoteMozLog)
+        self.dm.mkDir(self.remoteMozLog)
         self.dm.mkDir(os.path.dirname(self.options.remoteLogFile))
         # Add Android version (SDK level) to mozinfo so that manifest entries
         # can be conditional on android_version.
         androidVersion = self.dm.shellCheckOutput(
             ['getprop', 'ro.build.version.sdk'])
         self.log.info(
             "Android sdk version '%s'; will use this to filter manifests" %
             str(androidVersion))
@@ -123,27 +123,27 @@ class RobocopTestRunner(MochitestDesktop
         """
            Cleanup at end of job run.
         """
         self.log.debug("Cleaning up...")
         self.stopServers()
         self.dm.killProcess(self.options.app.split('/')[-1])
         blobberUploadDir = os.environ.get('MOZ_UPLOAD_DIR', None)
         if blobberUploadDir:
-            self.log.debug("Pulling any remote nspr logs and screenshots to %s." %
+            self.log.debug("Pulling any remote moz logs and screenshots to %s." %
                            blobberUploadDir)
-            self.dm.getDirectory(self.remoteNSPR, blobberUploadDir)
+            self.dm.getDirectory(self.remoteMozLog, blobberUploadDir)
             self.dm.getDirectory(self.remoteScreenshots, blobberUploadDir)
         MochitestDesktop.cleanup(self, self.options)
         if self.localProfile:
             os.system("rm -Rf %s" % self.localProfile)
         self.dm.removeDir(self.remoteProfile)
         self.dm.removeDir(self.remoteProfileCopy)
         self.dm.removeDir(self.remoteScreenshots)
-        self.dm.removeDir(self.remoteNSPR)
+        self.dm.removeDir(self.remoteMozLog)
         self.dm.removeFile(self.remoteConfigFile)
         if self.dm.fileExists(self.remoteLog):
             self.dm.removeFile(self.remoteLog)
         self.log.debug("Cleanup complete.")
 
     def findPath(self, paths, filename=None):
         for path in paths:
             p = path
@@ -395,27 +395,27 @@ class RobocopTestRunner(MochitestDesktop
         browserEnv = self.environment(
             xrePath=None,
             debugger=None)
         # remove desktop environment not used on device
         if "MOZ_WIN_INHERIT_STD_HANDLES_PRE_VISTA" in browserEnv:
             del browserEnv["MOZ_WIN_INHERIT_STD_HANDLES_PRE_VISTA"]
         if "XPCOM_MEM_BLOAT_LOG" in browserEnv:
             del browserEnv["XPCOM_MEM_BLOAT_LOG"]
-        browserEnv["NSPR_LOG_FILE"] = os.path.join(
-            self.remoteNSPR,
-            self.nsprLogName)
+        browserEnv["MOZ_LOG_FILE"] = os.path.join(
+            self.remoteMozLog,
+            self.mozLogName)
         return browserEnv
 
     def runSingleTest(self, test):
         """
            Run the specified test.
         """
         self.log.debug("Running test %s" % test['name'])
-        self.nsprLogName = "nspr-%s.log" % test['name']
+        self.mozLogName = "moz-%s.log" % test['name']
         browserEnv = self.buildBrowserEnv()
         self.setupRobotiumConfig(browserEnv)
         self.setupRemoteProfile()
         self.options.app = "am"
         if self.options.autorun:
             # This launches a test (using "am instrument") and instructs
             # Fennec to /quit/ the browser (using Robocop:Quit) and to
             # /finish/ all opened activities.
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -72,29 +72,29 @@ try:
     import psutil
     HAVE_PSUTIL = True
 except ImportError:
     pass
 
 here = os.path.abspath(os.path.dirname(__file__))
 
 
-###########################
-# Option for NSPR logging #
-###########################
-
-# Set the desired log modules you want an NSPR log be produced by a try run for, or leave blank to disable the feature.
-# This will be passed to NSPR_LOG_MODULES environment variable. Try run will then put a download link for the log file
+########################################
+# Option for MOZ (former NSPR) logging #
+########################################
+
+# Set the desired log modules you want a log be produced by a try run for, or leave blank to disable the feature.
+# This will be passed to MOZ_LOG_MODULES environment variable. Try run will then put a download link for all log files
 # on tbpl.mozilla.org.
 
-NSPR_LOG_MODULES = ""
-
-####################
-# LOG HANDLING     #
-####################
+MOZ_LOG_MODULES = ""
+
+#####################
+# Test log handling #
+#####################
 
 # output processing
 
 
 class MochitestFormatter(TbplFormatter):
 
     """
     The purpose of this class is to maintain compatibility with legacy users.
@@ -528,17 +528,17 @@ class MochitestBase(object):
         self.server = None
         self.wsserver = None
         self.sslTunnel = None
         self._active_tests = None
         self._locations = None
 
         self.marionette = None
         self.start_script = None
-        self.nsprLogs = None
+        self.mozLogs = None
         self.start_script_args = []
 
         if self.log is None:
             commandline.log_formatters["tbpl"] = (
                 MochitestFormatter,
                 "Mochitest specific tbpl formatter")
             self.log = commandline.setup_logging("mochitest",
                                                  logger_options,
@@ -1185,22 +1185,21 @@ toolbar#nav-bar {
                 browserEnv["MOZ_GMP_PATH"] = gmp_path
         except EnvironmentError:
             self.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
+        # Produce a mozlog, if setup (see MOZ_LOG_MODULES global at the top of
         # this script).
-        self.nsprLogs = NSPR_LOG_MODULES and "MOZ_UPLOAD_DIR" in os.environ
-        if self.nsprLogs:
-            browserEnv["NSPR_LOG_MODULES"] = NSPR_LOG_MODULES
-            browserEnv["GECKO_SEPARATE_NSPR_LOGS"] = "1"
+        self.mozLogs = MOZ_LOG_MODULES and "MOZ_UPLOAD_DIR" in os.environ
+        if self.mozLogs:
+            browserEnv["MOZ_LOG_MODULES"] = MOZ_LOG_MODULES
 
         if debugger and not options.slowscript:
             browserEnv["JS_DISABLE_SLOW_SCRIPT_SIGNALS"] = "1"
 
         # For e10s, our tests default to suppressing the "unsafe CPOW usage"
         # warnings that can plague test logs.
         if not options.enableCPOWWarnings:
             browserEnv["DISABLE_UNSAFE_CPOW_WARNINGS"] = "1"
@@ -2270,18 +2269,18 @@ class MochitestDesktop(MochitestBase):
         if 'MOZ_DISABLE_NONLOCAL_CONNECTIONS' in self.browserEnv:
             if mozinfo.info.get('buildapp') == 'mulet' or options.subsuite == 'push':
                 del self.browserEnv['MOZ_DISABLE_NONLOCAL_CONNECTIONS']
                 os.environ["MOZ_DISABLE_NONLOCAL_CONNECTIONS"] = "0"
 
         if self.browserEnv is None:
             return 1
 
-        if self.nsprLogs:
-            self.browserEnv["NSPR_LOG_FILE"] = "{}/nspr-pid=%PID-uid={}.log".format(self.browserEnv["MOZ_UPLOAD_DIR"], str(uuid.uuid4()))
+        if self.mozLogs:
+            self.browserEnv["MOZ_LOG_FILE"] = "{}/moz-pid=%PID-uid={}.log".format(self.browserEnv["MOZ_UPLOAD_DIR"], str(uuid.uuid4()))
 
         try:
             self.startServers(options, debuggerInfo)
 
             # testsToFilter parameter is used to filter out the test list that
             # is sent to buildTestPath
             testURL = self.buildTestPath(options, testsToFilter)
 
@@ -2622,20 +2621,20 @@ def run_test_harness(options):
     if runner.getTestFlavor(options) == 'chrome':
         options.runByDir = True
 
     if mozinfo.info.get('buildapp') == 'mulet':
         options.runByDir = False
 
     result = runner.runTests(options)
 
-    if runner.nsprLogs:
-        with zipfile.ZipFile("{}/nsprlogs.zip".format(runner.browserEnv["MOZ_UPLOAD_DIR"]),
+    if runner.mozLogs:
+        with zipfile.ZipFile("{}/mozLogs.zip".format(runner.browserEnv["MOZ_UPLOAD_DIR"]),
                              "w", zipfile.ZIP_DEFLATED) as logzip:
-            for logfile in glob.glob("{}/nspr*.log*".format(runner.browserEnv["MOZ_UPLOAD_DIR"])):
+            for logfile in glob.glob("{}/moz*.log*".format(runner.browserEnv["MOZ_UPLOAD_DIR"])):
                 logzip.write(logfile)
                 os.remove(logfile)
             logzip.close()
 
     # don't dump failures if running from automation as treeherder already displays them
     if build_obj:
         if runner.message_logger.errors:
             result = 1
--- a/testing/mochitest/runtestsremote.py
+++ b/testing/mochitest/runtestsremote.py
@@ -38,19 +38,19 @@ class MochiRemote(MochitestDesktop):
         self.remoteProfile = os.path.join(options.remoteTestRoot, "profile/")
         self.remoteModulesDir = os.path.join(options.remoteTestRoot, "modules/")
         self._automation.setRemoteProfile(self.remoteProfile)
         self.remoteLog = options.remoteLogFile
         self.localLog = options.logFile
         self._automation.deleteANRs()
         self._automation.deleteTombstones()
         self.certdbNew = True
-        self.remoteNSPR = os.path.join(options.remoteTestRoot, "nspr")
-        self._dm.removeDir(self.remoteNSPR)
-        self._dm.mkDir(self.remoteNSPR)
+        self.remoteMozLog = os.path.join(options.remoteTestRoot, "mozlog")
+        self._dm.removeDir(self.remoteMozLog)
+        self._dm.mkDir(self.remoteMozLog)
         self.remoteChromeTestDir = os.path.join(
             options.remoteTestRoot,
             "chrome")
         self._dm.removeDir(self.remoteChromeTestDir)
         self._dm.mkDir(self.remoteChromeTestDir)
 
     def cleanup(self, options):
         if self._dm.fileExists(self.remoteLog):
@@ -59,17 +59,17 @@ class MochiRemote(MochitestDesktop):
         else:
             self.log.warning(
                 "Unable to retrieve log file (%s) from remote device" %
                 self.remoteLog)
         self._dm.removeDir(self.remoteProfile)
         self._dm.removeDir(self.remoteChromeTestDir)
         blobberUploadDir = os.environ.get('MOZ_UPLOAD_DIR', None)
         if blobberUploadDir:
-            self._dm.getDirectory(self.remoteNSPR, blobberUploadDir)
+            self._dm.getDirectory(self.remoteMozLog, blobberUploadDir)
         MochitestDesktop.cleanup(self, options)
 
     def findPath(self, paths, filename=None):
         for path in paths:
             p = path
             if filename:
                 p = os.path.join(p, filename)
             if os.path.exists(self.getFullPath(p)):
@@ -275,21 +275,21 @@ class MochiRemote(MochitestDesktop):
             self,
             options,
             debugger=debugger)
         # remove desktop environment not used on device
         if "MOZ_WIN_INHERIT_STD_HANDLES_PRE_VISTA" in browserEnv:
             del browserEnv["MOZ_WIN_INHERIT_STD_HANDLES_PRE_VISTA"]
         if "XPCOM_MEM_BLOAT_LOG" in browserEnv:
             del browserEnv["XPCOM_MEM_BLOAT_LOG"]
-        # override nsprLogs to avoid processing in MochitestDesktop base class
-        self.nsprLogs = None
-        browserEnv["NSPR_LOG_FILE"] = os.path.join(
-            self.remoteNSPR,
-            self.nsprLogName)
+        # override mozLogs to avoid processing in MochitestDesktop base class
+        self.mozLogs = None
+        browserEnv["MOZ_LOG_FILE"] = os.path.join(
+            self.remoteMozLog,
+            self.mozLogName)
         return browserEnv
 
     def runApp(self, *args, **kwargs):
         """front-end automation.py's `runApp` functionality until FennecRunner is written"""
 
         # automation.py/remoteautomation `runApp` takes the profile path,
         # whereas runtest.py's `runApp` takes a mozprofile object.
         if 'profileDir' not in kwargs and 'profile' in kwargs:
@@ -362,17 +362,17 @@ def run_test_harness(options):
         dm.pushFile(os.path.join(options.dmdPath, dmdLibrary), dmdPathOnDevice)
         options.dmdPath = deviceRoot
 
     options.dumpOutputDirectory = deviceRoot
 
     procName = options.app.split('/')[-1]
     dm.killProcess(procName)
 
-    mochitest.nsprLogName = "nspr.log"
+    mochitest.mozLogName = "moz.log"
     try:
         dm.recordLogcat()
         retVal = mochitest.runTests(options)
     except:
         log.error("Automation Error: Exception caught while running tests")
         traceback.print_exc()
         mochitest.stopServers()
         try: