From 4127803d46581006a458ea0c1d428b160f346f53 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 7 May 2013 18:33:49 -0400 Subject: [PATCH] Backed out changeset da02b1166a5c (bug 597064) because of mochitest failures on a CLOSED TREE --- build/automation.py.in | 20 ++++---------------- config/makefiles/xpcshell.mk | 8 +------- js/src/config/makefiles/xpcshell.mk | 8 +------- netwerk/test/unit/test_head.js | 2 +- testing/testsuite-targets.mk | 5 +---- testing/xpcshell/Makefile.in | 6 +----- testing/xpcshell/mach_commands.py | 4 ---- testing/xpcshell/runxpcshelltests.py | 25 ++++++------------------- 8 files changed, 15 insertions(+), 63 deletions(-) diff --git a/build/automation.py.in b/build/automation.py.in index 9b77f7fe186e..150e5cab8c85 100644 --- a/build/automation.py.in +++ b/build/automation.py.in @@ -83,21 +83,13 @@ else: import errno -def getGlobalLog(): - return _log - -def resetGlobalLog(log): - while _log.handlers: - _log.removeHandler(_log.handlers[0]) - handler = logging.StreamHandler(log) - _log.setLevel(logging.INFO) - _log.addHandler(handler) - # We use the logging system here primarily because it'll handle multiple # threads, which is needed to process the output of the server and application # processes simultaneously. _log = logging.getLogger() -resetGlobalLog(sys.stdout) +handler = logging.StreamHandler(sys.stdout) +_log.setLevel(logging.INFO) +_log.addHandler(handler) ################# @@ -912,14 +904,10 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t self.log.info("SCREENSHOT: data:image/png;base64,%s", encoded) def killAndGetStack(self, processPID, utilityPath, debuggerInfo): - """Kill the process, preferrably in a way that gets us a stack trace. - Also attempts to obtain a screenshot before killing the process.""" + """Kill the process, preferrably in a way that gets us a stack trace.""" if not debuggerInfo: self.dumpScreen(utilityPath) - self.killAndGetStackNoScreenshot(self, processPID, utilityPath, debuggerInfo) - def killAndGetStackNoScreenshot(self, processPID, utilityPath, debuggerInfo): - """Kill the process, preferrably in a way that gets us a stack trace.""" if self.CRASHREPORTER and not debuggerInfo: if self.UNIXISH: # ABRT will get picked up by Breakpad's signal handler diff --git a/config/makefiles/xpcshell.mk b/config/makefiles/xpcshell.mk index be1133e6d445..f45300578ea7 100644 --- a/config/makefiles/xpcshell.mk +++ b/config/makefiles/xpcshell.mk @@ -40,7 +40,6 @@ endif #} NO_XPCSHELL_MANIFEST_CHECK # See also testsuite-targets.mk 'xpcshell-tests' target for global execution. xpcshell-tests: $(PYTHON) -u $(topsrcdir)/config/pythonpath.py \ - -I$(testxpcobjdir) \ -I$(topsrcdir)/build \ -I$(DEPTH)/_tests/mozbase/mozinfo \ $(testxpcsrcdir)/runxpcshelltests.py \ @@ -57,9 +56,7 @@ xpcshell-tests: xpcshell-tests-remote: DM_TRANS?=adb xpcshell-tests-remote: - $(PYTHON) -u $(topsrcdir)/config/pythonpath.py \ - -I$(testxpcobjdir) \ - $(topsrcdir)/testing/xpcshell/remotexpcshelltests.py \ + $(PYTHON) -u $(topsrcdir)/testing/xpcshell/remotexpcshelltests.py \ --symbols-path=$(DIST)/crashreporter-symbols \ --build-info-json=$(DEPTH)/mozinfo.json \ --testing-modules-dir=$(DEPTH)/_tests/modules \ @@ -75,7 +72,6 @@ xpcshell-tests-remote: # attach a debugger and then start the test. check-interactive: $(PYTHON) -u $(topsrcdir)/config/pythonpath.py \ - -I$(testxpcobjdir) \ -I$(topsrcdir)/build \ -I$(DEPTH)/_tests/mozbase/mozinfo \ $(testxpcsrcdir)/runxpcshelltests.py \ @@ -92,7 +88,6 @@ check-interactive: # Execute a single test, specified in $(SOLO_FILE) check-one: $(PYTHON) -u $(topsrcdir)/config/pythonpath.py \ - -I$(testxpcobjdir) \ -I$(topsrcdir)/build \ -I$(DEPTH)/_tests/mozbase/mozinfo \ $(testxpcsrcdir)/runxpcshelltests.py \ @@ -110,7 +105,6 @@ check-one: check-one-remote: DM_TRANS?=adb check-one-remote: $(PYTHON) -u $(topsrcdir)/config/pythonpath.py \ - -I$(testxpcobjdir) \ -I$(topsrcdir)/build \ -I$(topsrcdir)/build/mobile \ -I$(topsrcdir)/testing/mozbase/mozdevice/mozdevice \ diff --git a/js/src/config/makefiles/xpcshell.mk b/js/src/config/makefiles/xpcshell.mk index be1133e6d445..f45300578ea7 100644 --- a/js/src/config/makefiles/xpcshell.mk +++ b/js/src/config/makefiles/xpcshell.mk @@ -40,7 +40,6 @@ endif #} NO_XPCSHELL_MANIFEST_CHECK # See also testsuite-targets.mk 'xpcshell-tests' target for global execution. xpcshell-tests: $(PYTHON) -u $(topsrcdir)/config/pythonpath.py \ - -I$(testxpcobjdir) \ -I$(topsrcdir)/build \ -I$(DEPTH)/_tests/mozbase/mozinfo \ $(testxpcsrcdir)/runxpcshelltests.py \ @@ -57,9 +56,7 @@ xpcshell-tests: xpcshell-tests-remote: DM_TRANS?=adb xpcshell-tests-remote: - $(PYTHON) -u $(topsrcdir)/config/pythonpath.py \ - -I$(testxpcobjdir) \ - $(topsrcdir)/testing/xpcshell/remotexpcshelltests.py \ + $(PYTHON) -u $(topsrcdir)/testing/xpcshell/remotexpcshelltests.py \ --symbols-path=$(DIST)/crashreporter-symbols \ --build-info-json=$(DEPTH)/mozinfo.json \ --testing-modules-dir=$(DEPTH)/_tests/modules \ @@ -75,7 +72,6 @@ xpcshell-tests-remote: # attach a debugger and then start the test. check-interactive: $(PYTHON) -u $(topsrcdir)/config/pythonpath.py \ - -I$(testxpcobjdir) \ -I$(topsrcdir)/build \ -I$(DEPTH)/_tests/mozbase/mozinfo \ $(testxpcsrcdir)/runxpcshelltests.py \ @@ -92,7 +88,6 @@ check-interactive: # Execute a single test, specified in $(SOLO_FILE) check-one: $(PYTHON) -u $(topsrcdir)/config/pythonpath.py \ - -I$(testxpcobjdir) \ -I$(topsrcdir)/build \ -I$(DEPTH)/_tests/mozbase/mozinfo \ $(testxpcsrcdir)/runxpcshelltests.py \ @@ -110,7 +105,6 @@ check-one: check-one-remote: DM_TRANS?=adb check-one-remote: $(PYTHON) -u $(topsrcdir)/config/pythonpath.py \ - -I$(testxpcobjdir) \ -I$(topsrcdir)/build \ -I$(topsrcdir)/build/mobile \ -I$(topsrcdir)/testing/mozbase/mozdevice/mozdevice \ diff --git a/netwerk/test/unit/test_head.js b/netwerk/test/unit/test_head.js index eaaf2e04a23a..232c35dff1ee 100644 --- a/netwerk/test/unit/test_head.js +++ b/netwerk/test/unit/test_head.js @@ -111,7 +111,7 @@ function checkRequestResponse(request, data, context) { response = channel.getResponseHeader("Proxy-Authenticate"); do_check_eq(response, "line 1\nline 2\nline 3"); - + channel.contentCharset = "UTF-8"; do_check_eq(channel.contentCharset, "UTF-8"); do_check_eq(channel.contentType, "text/plain"); diff --git a/testing/testsuite-targets.mk b/testing/testsuite-targets.mk index 6301e289541c..cb7c965ff2b7 100644 --- a/testing/testsuite-targets.mk +++ b/testing/testsuite-targets.mk @@ -271,9 +271,7 @@ GARBAGE += $(addsuffix .log,$(MOCHITESTS) reftest crashtest jstestbrowser) # Usage: |make [TEST_PATH=...] [EXTRA_TEST_ARGS=...] xpcshell-tests|. xpcshell-tests: $(PYTHON) -u $(topsrcdir)/config/pythonpath.py \ - -I$(DEPTH)/_tests/xpcshell \ - -I$(topsrcdir)/build \ - -I$(DEPTH)/_tests/mozbase/mozinfo \ + -I$(topsrcdir)/build -I$(DEPTH)/_tests/mozbase/mozinfo \ $(topsrcdir)/testing/xpcshell/runxpcshelltests.py \ --manifest=$(DEPTH)/_tests/xpcshell/xpcshell.ini \ --build-info-json=$(DEPTH)/mozinfo.json \ @@ -289,7 +287,6 @@ xpcshell-tests: B2G_XPCSHELL = \ rm -f ./@.log && \ $(PYTHON) -u $(topsrcdir)/config/pythonpath.py \ - -I$(DEPTH)/_tests/xpcshell \ -I$(topsrcdir)/build \ $(topsrcdir)/testing/xpcshell/runtestsb2g.py \ --manifest=$(DEPTH)/_tests/xpcshell/xpcshell.ini \ diff --git a/testing/xpcshell/Makefile.in b/testing/xpcshell/Makefile.in index 7ec6cd7be8e5..f98b8883b584 100644 --- a/testing/xpcshell/Makefile.in +++ b/testing/xpcshell/Makefile.in @@ -54,13 +54,10 @@ libs:: $(INSTALL) $(srcdir)/xpcshell_android.ini $(DEPTH)/_tests/xpcshell cp $(srcdir)/xpcshell.ini $(DEPTH)/_tests/xpcshell/all-test-dirs.list -libs:: $(DEPTH)/build/automation.py - $(INSTALL) $^ $(DEPTH)/_tests/xpcshell - # Run selftests check:: OBJDIR=$(DEPTH) $(PYTHON) $(topsrcdir)/config/pythonpath.py \ - -I$(DEPTH)/_tests/xpcshell -I$(topsrcdir)/build -I$(topsrcdir)/testing/mozbase/mozinfo/mozinfo $(srcdir)/selftest.py + -I$(topsrcdir)/build -I$(topsrcdir)/testing/mozbase/mozinfo/mozinfo $(srcdir)/selftest.py stage-package: $(NSINSTALL) -D $(PKG_STAGE)/xpcshell/tests @@ -68,7 +65,6 @@ stage-package: @(cd $(srcdir) && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_FILES)) | (cd $(PKG_STAGE)/xpcshell && tar -xf -) @(cd $(topsrcdir)/build && tar $(TAR_CREATE_FLAGS) - $(EXTRA_BUILD_FILES)) | (cd $(PKG_STAGE)/xpcshell && tar -xf -) @cp $(DEPTH)/mozinfo.json $(PKG_STAGE)/xpcshell - @cp $(DEPTH)/build/automation.py $(PKG_STAGE)/xpcshell @(cd $(topsrcdir)/testing/mozbase/mozdevice/mozdevice && tar $(TAR_CREATE_FLAGS) - $(MOZDEVICE_FILES)) | (cd $(PKG_STAGE)/xpcshell && tar -xf -) (cd $(DEPTH)/_tests/xpcshell/ && tar $(TAR_CREATE_FLAGS_QUIET) - *) | (cd $(PKG_STAGE)/xpcshell/tests && tar -xf -) @(cd $(DIST)/bin/components && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_COMPONENTS)) | (cd $(PKG_STAGE)/bin/components && tar -xf -) diff --git a/testing/xpcshell/mach_commands.py b/testing/xpcshell/mach_commands.py index 58265e59b754..038b24284a5f 100644 --- a/testing/xpcshell/mach_commands.py +++ b/testing/xpcshell/mach_commands.py @@ -47,10 +47,6 @@ class XPCShellRunner(MozbuildObject): def run_test(self, test_file, debug=False, interactive=False, keep_going=False, shuffle=False): """Runs an individual xpcshell test.""" - # TODO Bug 794506 remove once mach integrates with virtualenv. - build_path = os.path.join(self.topobjdir, 'build') - if build_path not in sys.path: - sys.path.append(build_path) if test_file == 'all': self.run_suite(debug=debug, interactive=interactive, diff --git a/testing/xpcshell/runxpcshelltests.py b/testing/xpcshell/runxpcshelltests.py index 16212d79463b..f3329577c8bb 100644 --- a/testing/xpcshell/runxpcshelltests.py +++ b/testing/xpcshell/runxpcshelltests.py @@ -10,14 +10,12 @@ from glob import glob from optparse import OptionParser from subprocess import Popen, PIPE, STDOUT from tempfile import mkdtemp, gettempdir -from threading import Timer import manifestparser import mozinfo import random import socket import time -from automation import Automation, getGlobalLog, resetGlobalLog from automationutils import * # -------------------------------------------------------------- @@ -54,13 +52,14 @@ def markGotSIGINT(signum, stackFrame): class XPCShellTests(object): - log = getGlobalLog() + log = logging.getLogger() oldcwd = os.getcwd() - def __init__(self, log=None): + def __init__(self, log=sys.stdout): """ Init logging and node status """ - if log: - resetGlobalLog(log) + handler = logging.StreamHandler(log) + self.log.setLevel(logging.INFO) + self.log.addHandler(handler) self.nodeProc = None def buildTestList(self): @@ -574,10 +573,6 @@ class XPCShellTests(object): doc.writexml(fh, addindent=" ", newl="\n", encoding="utf-8") - def testTimeout(self, test, processPID): - self.log.error("TEST-UNEXPECTED-FAIL | %s | Test timed out" % test) - Automation().killAndGetStackNoScreenshot(processPID, self.appPath, None) - def post_to_autolog(self, results, name): from moztest.results import TestContext, TestResult, TestResultCollection from moztest.output.autolog import AutologOutput @@ -888,11 +883,6 @@ class XPCShellTests(object): completeCmd = cmdH + cmdT + args - testTimer = None - if not interactive and not self.debuggerInfo: - testTimer = Timer(120.0, lambda: self.testTimeout(name, proc.pid)) - testTimer.start() - proc = None try: @@ -916,10 +906,7 @@ class XPCShellTests(object): if interactive: # Not sure what else to do here... - return True, xunit_result - - if testTimer: - testTimer.cancel() + return True def print_stdout(stdout): """Print stdout line-by-line to avoid overflowing buffers."""