зеркало из https://github.com/mozilla/pjs.git
Bug 581750 - runxpcshell.py --verbose breaks success/fail detection. a=NPOTB
Also includes printf formatting fix for head.js
This commit is contained in:
Родитель
225ef1286e
Коммит
c1142e5f1e
|
@ -211,13 +211,13 @@ function _execute_test() {
|
|||
// possible that this will mask an NS_ERROR_ABORT that happens after a
|
||||
// do_check failure though.
|
||||
if (!_quit || e != Components.results.NS_ERROR_ABORT) {
|
||||
_dump("TEST-UNEXPECTED-FAIL | (xpcshell/head.js) | " + e);
|
||||
msg = "TEST-UNEXPECTED-FAIL | (xpcshell/head.js) | " + e;
|
||||
if (e.stack) {
|
||||
_dump(" - See following stack:\n");
|
||||
_dump(msg + " - See following stack:\n");
|
||||
_dump_exception_stack(e.stack);
|
||||
}
|
||||
else {
|
||||
_dump("\n");
|
||||
_dump(msg + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,12 @@ from tempfile import mkdtemp, gettempdir
|
|||
|
||||
from automationutils import *
|
||||
|
||||
""" Control-C handling """
|
||||
gotSIGINT = False
|
||||
def markGotSIGINT(signum, stackFrame):
|
||||
global gotSIGINT
|
||||
gotSIGINT = True
|
||||
|
||||
class XPCShellTests(object):
|
||||
|
||||
log = logging.getLogger()
|
||||
|
@ -185,7 +191,7 @@ class XPCShellTests(object):
|
|||
Determine the value of the stdout and stderr for the test.
|
||||
Return value is a list (pStdout, pStderr).
|
||||
"""
|
||||
if self.interactive or self.verbose:
|
||||
if self.interactive:
|
||||
pStdout = None
|
||||
pStderr = None
|
||||
else:
|
||||
|
@ -382,7 +388,7 @@ class XPCShellTests(object):
|
|||
|
||||
def runTests(self, xpcshell, xrePath=None, symbolsPath=None,
|
||||
manifest=None, testdirs=[], testPath=None,
|
||||
interactive=False, verbose=False, logfiles=True,
|
||||
interactive=False, verbose=False, keepGoing=False, logfiles=True,
|
||||
thisChunk=1, totalChunks=1, debugger=None,
|
||||
debuggerArgs=None, debuggerInteractive=False,
|
||||
profileName=None):
|
||||
|
@ -409,6 +415,8 @@ class XPCShellTests(object):
|
|||
directory if running only a subset of tests
|
||||
"""
|
||||
|
||||
global gotSIGINT
|
||||
|
||||
self.xpcshell = xpcshell
|
||||
self.xrePath = xrePath
|
||||
self.symbolsPath = symbolsPath
|
||||
|
@ -417,6 +425,7 @@ class XPCShellTests(object):
|
|||
self.testPath = testPath
|
||||
self.interactive = interactive
|
||||
self.verbose = verbose
|
||||
self.keepGoing = keepGoing
|
||||
self.logfiles = logfiles
|
||||
self.totalChunks = totalChunks
|
||||
self.thisChunk = thisChunk
|
||||
|
@ -467,8 +476,12 @@ class XPCShellTests(object):
|
|||
proc = self.launchProcess(cmdH + cmdT + self.xpcsRunArgs,
|
||||
stdout=pStdout, stderr=pStderr, env=self.env, cwd=testdir)
|
||||
|
||||
# Allow user to kill hung subprocess with SIGINT w/o killing this script
|
||||
# - don't move this line above launchProcess, or child will inherit the SIG_IGN
|
||||
signal.signal(signal.SIGINT, markGotSIGINT)
|
||||
# |stderr == None| as |pStderr| was either |None| or redirected to |stdout|.
|
||||
stdout, stderr = self.communicate(proc)
|
||||
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||
|
||||
if interactive:
|
||||
# Not sure what else to do here...
|
||||
|
@ -484,6 +497,8 @@ class XPCShellTests(object):
|
|||
failCount += 1
|
||||
else:
|
||||
print "TEST-PASS | %s | test passed" % test
|
||||
if verbose:
|
||||
print """>>>>>>>\n%s\n<<<<<<<""" % stdout
|
||||
passCount += 1
|
||||
|
||||
checkForCrashes(testdir, self.symbolsPath, testName=test)
|
||||
|
@ -503,7 +518,12 @@ class XPCShellTests(object):
|
|||
# or check-one.
|
||||
if self.profileDir and not self.interactive and not self.singleFile:
|
||||
self.removeDir(self.profileDir)
|
||||
|
||||
if gotSIGINT:
|
||||
print "TEST-UNEXPECTED-FAIL | Received SIGINT (control-C) during test execution"
|
||||
if (keepGoing):
|
||||
gotSIGINT = False
|
||||
else:
|
||||
break
|
||||
if passCount == 0 and failCount == 0:
|
||||
print "TEST-UNEXPECTED-FAIL | runxpcshelltests.py | No tests run. Did you pass an invalid --test-path?"
|
||||
failCount = 1
|
||||
|
@ -512,6 +532,10 @@ class XPCShellTests(object):
|
|||
INFO | Passed: %d
|
||||
INFO | Failed: %d""" % (passCount, failCount)
|
||||
|
||||
if gotSIGINT and not keepGoing:
|
||||
print "TEST-UNEXPECTED-FAIL | Received SIGINT (control-C), so stopped run. " \
|
||||
"(Use --keep-going to keep running tests after killing one with SIGINT)"
|
||||
return False
|
||||
return failCount == 0
|
||||
|
||||
class XPCShellOptions(OptionParser):
|
||||
|
@ -526,6 +550,9 @@ class XPCShellOptions(OptionParser):
|
|||
self.add_option("--verbose",
|
||||
action="store_true", dest="verbose", default=False,
|
||||
help="always print stdout and stderr from tests")
|
||||
self.add_option("--keep-going",
|
||||
action="store_true", dest="keepGoing", default=False,
|
||||
help="continue running tests after test killed with control-C (SIGINT)")
|
||||
self.add_option("--logfiles",
|
||||
action="store_true", dest="logfiles", default=True,
|
||||
help="create log files (default, only used to override --no-logfiles)")
|
||||
|
|
Загрузка…
Ссылка в новой задаче