--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -317,16 +317,17 @@ def call(*args, **kwargs):
def killPid(pid, log):
# see also https://bugzilla.mozilla.org/show_bug.cgi?id=911249#c58
try:
os.kill(pid, getattr(signal, "SIGKILL", signal.SIGTERM))
except Exception as e:
log.info("Failed to kill process %d: %s" % (pid, str(e)))
+
if mozinfo.isWin:
import ctypes.wintypes
def isPidAlive(pid):
STILL_ACTIVE = 259
PROCESS_QUERY_LIMITED_INFORMATION = 0x1000
pHandle = ctypes.windll.kernel32.OpenProcess(
PROCESS_QUERY_LIMITED_INFORMATION,
@@ -2353,16 +2354,17 @@ toolbar#nav-bar {
if self.browserEnv is None:
return 1
if self.mozLogs:
self.browserEnv["MOZ_LOG_FILE"] = "{}/moz-pid=%PID-uid={}.log".format(
self.browserEnv["MOZ_UPLOAD_DIR"], str(uuid.uuid4()))
+ status = 0
try:
self.startServers(options, debuggerInfo)
if options.immersiveMode:
options.browserArgs.extend(('-firefoxpath', options.app))
options.app = self.immersiveHelperPath
if options.jsdebugger:
@@ -2412,33 +2414,35 @@ toolbar#nav-bar {
testURL = self.buildTestURL(options, scheme=scheme)
self.buildURLOptions(options, self.browserEnv)
if self.urlOpts:
testURL += "?" + "&".join(self.urlOpts)
self.log.info("runtests.py | Running with e10s: {}".format(options.e10s))
self.log.info("runtests.py | Running tests: start.\n")
- status = self.runApp(testURL,
- self.browserEnv,
- options.app,
- profile=self.profile,
- extraArgs=options.browserArgs,
- utilityPath=options.utilityPath,
- debuggerInfo=debuggerInfo,
- valgrindPath=valgrindPath,
- valgrindArgs=valgrindArgs,
- valgrindSuppFiles=valgrindSuppFiles,
- symbolsPath=options.symbolsPath,
- timeout=timeout,
- detectShutdownLeaks=detectShutdownLeaks,
- screenshotOnFail=options.screenshotOnFail,
- bisectChunk=options.bisectChunk,
- marionette_args=marionette_args,
- )
+ ret = self.runApp(
+ testURL,
+ self.browserEnv,
+ options.app,
+ profile=self.profile,
+ extraArgs=options.browserArgs,
+ utilityPath=options.utilityPath,
+ debuggerInfo=debuggerInfo,
+ valgrindPath=valgrindPath,
+ valgrindArgs=valgrindArgs,
+ valgrindSuppFiles=valgrindSuppFiles,
+ symbolsPath=options.symbolsPath,
+ timeout=timeout,
+ detectShutdownLeaks=detectShutdownLeaks,
+ screenshotOnFail=options.screenshotOnFail,
+ bisectChunk=options.bisectChunk,
+ marionette_args=marionette_args,
+ )
+ status = ret or status
except KeyboardInterrupt:
self.log.info("runtests.py | Received keyboard interrupt.\n")
status = -1
except:
traceback.print_exc()
self.log.error(
"Automation Error: Received unexpected exception while running application\n")
status = 1
@@ -2730,10 +2734,11 @@ def cli(args=sys.argv[1:]):
parser = MochitestArgumentParser(app='generic')
options = parser.parse_args(args)
if options is None:
# parsing error
sys.exit(1)
return run_test_harness(parser, options)
+
if __name__ == "__main__":
sys.exit(cli())