Bug 479352 - Hide mochitest results table if MOZ_HIDE_RESULTS_TABLE=1 is set. (v4) r=jmaher, a=testonly
authorCameron McCormack <cam@mcc.id.au>
Tue, 26 Jul 2011 16:13:20 -0700
changeset 74314 e9be8677a7ae094706eb0fb598f7ca3bc3bb78f8
parent 74313 60617a76c65c144d6fb251b152a28941343b5d49
child 74315 6845d4b46d7ac8d8ee8d9663ab460bd60c091486
push id235
push userbzbarsky@mozilla.com
push dateTue, 27 Sep 2011 17:13:04 +0000
treeherdermozilla-beta@2d1e082d176a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher, testonly
bugs479352
milestone8.0a1
first release with
nightly linux32
e9be8677a7ae / 8.0a1 / 20110730030836 / files
nightly linux64
e9be8677a7ae / 8.0a1 / 20110730030836 / files
nightly mac
e9be8677a7ae / 8.0a1 / 20110730030836 / files
nightly win32
e9be8677a7ae / 8.0a1 / 20110730030836 / files
nightly win64
e9be8677a7ae / 8.0a1 / 20110730030836 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 479352 - Hide mochitest results table if MOZ_HIDE_RESULTS_TABLE=1 is set. (v4) r=jmaher, a=testonly
build/mobile/remoteautomation.py
testing/mochitest/runtests.py
testing/mochitest/runtestsremote.py
testing/mochitest/server.js
testing/testsuite-targets.mk
--- a/build/mobile/remoteautomation.py
+++ b/build/mobile/remoteautomation.py
@@ -74,16 +74,22 @@ class RemoteAutomation(Automation):
 
     # Set up what we need for the remote environment
     def environment(self, env = None, xrePath = None, crashreporter = True):
         # Because we are running remote, we don't want to mimic the local env
         # so no copying of os.environ
         if env is None:
             env = {}
 
+        # Except for the mochitest results table hiding option, which isn't
+        # passed to runtestsremote.py as an actual option, but through the
+        # MOZ_CRASHREPORTER_DISABLE environment variable.
+        if 'MOZ_HIDE_RESULTS_TABLE' in os.environ:
+            env['MOZ_HIDE_RESULTS_TABLE'] = os.environ['MOZ_HIDE_RESULTS_TABLE']
+
         if crashreporter:
             env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
             env['MOZ_CRASHREPORTER'] = '1'
         else:
             env['MOZ_CRASHREPORTER_DISABLE'] = '1'
 
         return env
 
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -531,23 +531,24 @@ class Mochitest(object):
 
     browserEnv["XPCOM_MEM_BLOAT_LOG"] = self.leak_report_file
 
     if options.fatalAssertions:
       browserEnv["XPCOM_DEBUG_BREAK"] = "stack-and-abort"
 
     return browserEnv
 
-  def buildURLOptions(self, options):
+  def buildURLOptions(self, options, env):
     """ Add test control options from the command line to the url 
 
         URL parameters to test URL:
 
         autorun -- kick off tests automatically
         closeWhenDone -- runs quit.js after tests
+        hideResultsTable -- hides the table of individual test results
         logFile -- logs test run to an absolute path
         totalChunks -- how many chunks to split tests into
         thisChunk -- which chunk to run
         timeout -- per-test timeout in seconds
         loops -- How many times to run the test
     """
   
     # allow relative paths for logFile
@@ -569,16 +570,18 @@ class Mochitest(object):
         self.urlOpts.append("consoleLevel=" + encodeURIComponent(options.consoleLevel))
       if options.totalChunks:
         self.urlOpts.append("totalChunks=%d" % options.totalChunks)
         self.urlOpts.append("thisChunk=%d" % options.thisChunk)
       if options.chunkByDir:
         self.urlOpts.append("chunkByDir=%d" % options.chunkByDir)
       if options.shuffle:
         self.urlOpts.append("shuffle=1")
+      if "MOZ_HIDE_RESULTS_TABLE" in env and env["MOZ_HIDE_RESULTS_TABLE"] == "1":
+        self.urlOpts.append("hideResultsTable=1")
       if options.loops:
         self.urlOpts.append("loops=%d" % options.loops)
       if os.path.isfile(self.oldcwd + self.TEST_PATH + options.testPath) and options.loops > 0:
         self.urlOpts.append("testname=%s" % (self.TEST_PATH + options.testPath))
 
   def cleanup(self, manifest, options):
     """ remove temporary files and profile """
     os.remove(manifest)
@@ -628,17 +631,17 @@ class Mochitest(object):
     manifest = self.buildProfile(options)
     if manifest is None:
       return 1
 
     self.startWebServer(options)
     self.startWebSocketServer(options, debuggerInfo)
 
     testURL = self.buildTestPath(options)
-    self.buildURLOptions(options)
+    self.buildURLOptions(options, browserEnv)
     if len(self.urlOpts) > 0:
       testURL += "?" + "&".join(self.urlOpts)
 
     # Remove the leak detection file so it can't "leak" to the tests run.
     # The file is not there if leak logging was not enabled in the application build.
     if os.path.exists(self.leak_report_file):
       os.remove(self.leak_report_file)
 
@@ -711,16 +714,19 @@ class Mochitest(object):
     options.logFile = options.logFile.replace("\\", "\\\\")
     options.testPath = options.testPath.replace("\\", "\\\\")
     testRoot = 'chrome'
     if (options.browserChrome):
       testRoot = 'browser'
     elif (options.a11y):
       testRoot = 'a11y'
  
+    if "MOZ_HIDE_RESULTS_TABLE" in os.environ and os.environ["MOZ_HIDE_RESULTS_TABLE"] == "1":
+      options.hideResultsTable = True
+
     #TODO: when we upgrade to python 2.6, just use json.dumps(options.__dict__)
     content = "{"
     content += '"testRoot": "%s", ' % (testRoot) 
     first = True
     for opt in options.__dict__.keys():
       val = options.__dict__[opt]
       if first:
         first = False
--- a/testing/mochitest/runtestsremote.py
+++ b/testing/mochitest/runtestsremote.py
@@ -274,21 +274,21 @@ class MochiRemote(Mochitest):
         manifest = Mochitest.buildProfile(self, options)
         self.localProfile = options.profilePath
         if self._dm.pushDir(options.profilePath, self.remoteProfile) == None:
             raise devicemanager.FileError("Unable to copy profile to device.")
 
         options.profilePath = self.remoteProfile
         return manifest
     
-    def buildURLOptions(self, options):
+    def buildURLOptions(self, options, env):
         self.localLog = options.logFile
         options.logFile = self.remoteLog
         options.profilePath = self.localProfile
-        retVal = Mochitest.buildURLOptions(self, options)
+        retVal = Mochitest.buildURLOptions(self, options, env)
         #we really need testConfig.js (for browser chrome)
         if self._dm.pushDir(options.profilePath, self.remoteProfile) == None:
             raise devicemanager.FileError("Unable to copy profile to device.")
 
         options.profilePath = self.remoteProfile
         options.logFile = self.localLog
         return retVal
 
--- a/testing/mochitest/server.js
+++ b/testing/mochitest/server.js
@@ -599,16 +599,18 @@ function regularListing(metadata, respon
  * Produce a test harness page containing all the test cases
  * below it, recursively.
  */
 function testListing(metadata, response)
 {
   var [links, count] = list(metadata.path,
                             metadata.getProperty("directory"),
                             true);
+  var table_class = metadata.queryString.indexOf("hideResultsTable=1") > -1 ? "invisible": "";
+
   dumpn("count: " + count);
   var tests = jsonArrayOfTestFiles(links);
   response.write(
     HTML(
       HEAD(
         TITLE("MochiTest | ", metadata.path),
         LINK({rel: "stylesheet",
               type: "text/css", href: "/static/harness.css"}
@@ -653,17 +655,17 @@ function testListing(metadata, response)
             IFRAME({scrolling: "no", id: "testframe", width: "500", height: "300"})
           ),
           DIV({class: "clear"}),
           DIV({class: "toggle"},
             A({href: "#", id: "toggleNonTests"}, "Show Non-Tests"),
             BR()
           ),
     
-          TABLE({cellpadding: 0, cellspacing: 0, id: "test-table"},
+          TABLE({cellpadding: 0, cellspacing: 0, class: table_class, id: "test-table"},
             TR(TD("Passed"), TD("Failed"), TD("Todo"), TD("Test Files")),
             linksToTableRows(links, 0)
           ),
 
           BR(),
           TABLE({cellpadding: 0, cellspacing: 0, border: 1, bordercolor: "red", id: "fail-table"}
           ),
 
--- a/testing/testsuite-targets.mk
+++ b/testing/testsuite-targets.mk
@@ -78,20 +78,20 @@ define CHECK_TEST_ERROR
   else \
 	  echo "$@ passed"; \
   fi
 endef
 endif
 
 mochitest-remote: DM_TRANS?=adb
 mochitest-remote:
-	if test -f ${MOZ_HOST_BIN}/xpcshell && [ "${TEST_DEVICE}" != "usb" -o "$(DM_TRANS)" = "adb" ]; \
+	@if test -f ${MOZ_HOST_BIN}/xpcshell && [ "${TEST_DEVICE}" != "usb" -o "$(DM_TRANS)" = "adb" ]; \
           then $(RUN_MOCHITEST_REMOTE); \
         else \
-          @echo "please prepare your host with environment variables for TEST_DEVICE and MOZ_HOST_BIN"; \
+          echo "please prepare your host with environment variables for TEST_DEVICE and MOZ_HOST_BIN"; \
         fi
 
 mochitest-plain:
 	$(RUN_MOCHITEST)
 	$(CHECK_TEST_ERROR)
 
 # Allow mochitest-1 ... mochitest-5 for developer ease
 mochitest-1 mochitest-2 mochitest-3 mochitest-4 mochitest-5: mochitest-%: