Bug 1248711 - Make Mochitest NSPR upload work with --run-by-dir, r=jmaher

This commit is contained in:
Honza Bambas 2016-02-17 10:30:00 +01:00
Родитель e91daadfb4
Коммит 6867ecf8e7
1 изменённых файлов: 12 добавлений и 10 удалений

Просмотреть файл

@ -31,6 +31,7 @@ import tempfile
import time import time
import traceback import traceback
import urllib2 import urllib2
import uuid
import zipfile import zipfile
import bisection import bisection
@ -1210,8 +1211,6 @@ toolbar#nav-bar {
self.nsprLogs = NSPR_LOG_MODULES and "MOZ_UPLOAD_DIR" in os.environ self.nsprLogs = NSPR_LOG_MODULES and "MOZ_UPLOAD_DIR" in os.environ
if self.nsprLogs: if self.nsprLogs:
browserEnv["NSPR_LOG_MODULES"] = NSPR_LOG_MODULES browserEnv["NSPR_LOG_MODULES"] = NSPR_LOG_MODULES
browserEnv["NSPR_LOG_FILE"] = "%s/nspr.log" % tempfile.gettempdir()
browserEnv["GECKO_SEPARATE_NSPR_LOGS"] = "1" browserEnv["GECKO_SEPARATE_NSPR_LOGS"] = "1"
if debugger and not options.slowscript: if debugger and not options.slowscript:
@ -2288,6 +2287,9 @@ class MochitestDesktop(MochitestBase):
if self.browserEnv is None: if self.browserEnv is None:
return 1 return 1
if self.nsprLogs:
self.browserEnv["NSPR_LOG_FILE"] = "{}/nspr-pid=%PID-uid={}.log".format(self.browserEnv["MOZ_UPLOAD_DIR"], str(uuid.uuid4()))
try: try:
self.startServers(options, debuggerInfo) self.startServers(options, debuggerInfo)
@ -2400,14 +2402,6 @@ class MochitestDesktop(MochitestBase):
options.symbolsPath), options.symbolsPath),
) )
if self.nsprLogs:
with zipfile.ZipFile("%s/nsprlog.zip" % self.browserEnv["MOZ_UPLOAD_DIR"], "w", zipfile.ZIP_DEFLATED) as logzip:
for logfile in glob.glob(
"%s/nspr*.log*" %
tempfile.gettempdir()):
logzip.write(logfile)
os.remove(logfile)
self.log.info("runtests.py | Running tests: end.") self.log.info("runtests.py | Running tests: end.")
if self.manifest is not None: if self.manifest is not None:
@ -2654,6 +2648,14 @@ def run_test_harness(options):
result = runner.runTests(options) result = runner.runTests(options)
if runner.nsprLogs:
with zipfile.ZipFile("{}/nsprlogs.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"])):
logzip.write(logfile)
os.remove(logfile)
logzip.close()
# don't dump failures if running from automation as treeherder already displays them # don't dump failures if running from automation as treeherder already displays them
if build_obj: if build_obj:
if runner.message_logger.errors: if runner.message_logger.errors: