Bug 479352 - Hide mochitest results table if MOZ_HIDE_RESULTS_TABLE=1 is set. (v4) r=jmaher, a=testonly

This commit is contained in:
Cameron McCormack 2011-07-26 16:13:20 -07:00
parent 139ba0f07c
commit 3eafd18eb4
5 changed files with 21 additions and 7 deletions

View File

@ -79,6 +79,12 @@ class RemoteAutomation(Automation):
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'

View File

@ -536,13 +536,14 @@ class Mochitest(object):
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
@ -574,6 +575,8 @@ class Mochitest(object):
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:
@ -633,7 +636,7 @@ class Mochitest(object):
self.startWebSocketServer(options, debuggerInfo)
testURL = self.buildTestPath(options)
self.buildURLOptions(options)
self.buildURLOptions(options, browserEnv)
if len(self.urlOpts) > 0:
testURL += "?" + "&".join(self.urlOpts)
@ -716,6 +719,9 @@ class Mochitest(object):
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)

View File

@ -279,11 +279,11 @@ class MochiRemote(Mochitest):
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.")

View File

@ -604,6 +604,8 @@ 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(
@ -658,7 +660,7 @@ function testListing(metadata, response)
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)
),

View File

@ -83,10 +83,10 @@ 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: