зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1238305: Modify cppunittests to look up breakpad symbols for logged stack traces; r=ted
--HG-- extra : rebase_source : 159c245748d0192207ffa97465e254ea1a1538e2
This commit is contained in:
Родитель
0a27a22677
Коммит
104c07093b
|
@ -401,14 +401,18 @@ class MachCommands(MachCommandBase):
|
|||
else:
|
||||
manifest_path = None
|
||||
|
||||
utility_path = self.bindir
|
||||
|
||||
if conditions.is_android(self):
|
||||
from mozrunner.devices.android_device import verify_android_device
|
||||
verify_android_device(self, install=False)
|
||||
return self.run_android_test(tests, symbols_path, manifest_path, log)
|
||||
|
||||
return self.run_desktop_test(tests, symbols_path, manifest_path, log)
|
||||
return self.run_desktop_test(tests, symbols_path, manifest_path,
|
||||
utility_path, log)
|
||||
|
||||
def run_desktop_test(self, tests, symbols_path, manifest_path, log):
|
||||
def run_desktop_test(self, tests, symbols_path, manifest_path,
|
||||
utility_path, log):
|
||||
import runcppunittests as cppunittests
|
||||
from mozlog import commandline
|
||||
|
||||
|
@ -418,6 +422,7 @@ class MachCommands(MachCommandBase):
|
|||
|
||||
options.symbols_path = symbols_path
|
||||
options.manifest_path = manifest_path
|
||||
options.utility_path = utility_path
|
||||
options.xre_path = self.bindir
|
||||
|
||||
try:
|
||||
|
|
|
@ -64,6 +64,7 @@ config = {
|
|||
"cppunittest": {
|
||||
"options": [
|
||||
"--symbols-path=%(symbols_path)s",
|
||||
"--utility-path=tests/bin",
|
||||
"--xre-path=%(abs_app_dir)s"
|
||||
],
|
||||
"run_filename": "runcppunittests.py",
|
||||
|
|
|
@ -36,6 +36,7 @@ config = {
|
|||
"cppunittest": {
|
||||
"options": [
|
||||
"--symbols-path=%(symbols_path)s",
|
||||
"--utility-path=tests/bin",
|
||||
"--xre-path=%(abs_res_dir)s"
|
||||
],
|
||||
"run_filename": "runcppunittests.py",
|
||||
|
|
|
@ -59,6 +59,7 @@ config = {
|
|||
"cppunittest": {
|
||||
"options": [
|
||||
"--symbols-path=%(symbols_path)s",
|
||||
"--utility-path=tests/bin",
|
||||
"--xre-path=%(abs_app_dir)s"
|
||||
],
|
||||
"run_filename": "runcppunittests.py",
|
||||
|
|
|
@ -15,6 +15,7 @@ import mozinfo
|
|||
import mozcrash
|
||||
import mozfile
|
||||
import mozlog
|
||||
import mozrunner.utils
|
||||
|
||||
SCRIPT_DIR = os.path.abspath(os.path.realpath(os.path.dirname(__file__)))
|
||||
|
||||
|
@ -64,7 +65,12 @@ class CPPUnitTests(object):
|
|||
outputTimeout=CPPUnitTests.TEST_PROC_NO_OUTPUT_TIMEOUT)
|
||||
proc.wait()
|
||||
if proc.output:
|
||||
output = "\n%s" % "\n".join(proc.output)
|
||||
if self.fix_stack:
|
||||
procOutput = [self.fix_stack(l) for l in proc.output]
|
||||
else:
|
||||
procOutput = proc.output
|
||||
|
||||
output = "\n%s" % "\n".join(procOutput)
|
||||
self.log.process_output(proc.pid, output, command=[prog])
|
||||
if proc.timedOut:
|
||||
message = "timed out after %d seconds" % CPPUnitTests.TEST_PROC_TIMEOUT
|
||||
|
@ -143,7 +149,8 @@ class CPPUnitTests(object):
|
|||
|
||||
return env
|
||||
|
||||
def run_tests(self, programs, xre_path, symbols_path=None, interactive=False):
|
||||
def run_tests(self, programs, xre_path, symbols_path=None,
|
||||
utility_path=None, interactive=False):
|
||||
"""
|
||||
Run a set of C++ unit test programs.
|
||||
|
||||
|
@ -152,12 +159,17 @@ class CPPUnitTests(object):
|
|||
* xre_path: A path to a directory containing a XUL Runtime Environment.
|
||||
* symbols_path: A path to a directory containing Breakpad-formatted
|
||||
symbol files for producing stack traces on crash.
|
||||
* utility_path: A path to a directory containing utility programs
|
||||
(xpcshell et al)
|
||||
|
||||
Returns True if all test programs exited with a zero status, False
|
||||
otherwise.
|
||||
"""
|
||||
self.xre_path = xre_path
|
||||
self.log = mozlog.get_default_logger()
|
||||
if utility_path:
|
||||
self.fix_stack = mozrunner.utils.get_stack_fixer_function(
|
||||
utility_path, symbols_path)
|
||||
self.log.suite_start(programs, name='cppunittest')
|
||||
env = self.build_environment()
|
||||
pass_count = 0
|
||||
|
@ -196,6 +208,10 @@ class CPPUnittestOptions(OptionParser):
|
|||
action="store", type="string", dest="manifest_path",
|
||||
default=None,
|
||||
help="path to test manifest, if different from the path to test binaries")
|
||||
self.add_option("--utility-path",
|
||||
action="store", type="string", dest="utility_path",
|
||||
default=None,
|
||||
help="path to directory containing utility programs")
|
||||
|
||||
|
||||
def extract_unittests_from_args(args, environ, manifest_path):
|
||||
|
@ -257,8 +273,10 @@ def run_test_harness(options, args):
|
|||
update_mozinfo()
|
||||
progs = extract_unittests_from_args(args, mozinfo.info, options.manifest_path)
|
||||
options.xre_path = os.path.abspath(options.xre_path)
|
||||
options.utility_path = os.path.abspath(options.utility_path)
|
||||
tester = CPPUnitTests()
|
||||
result = tester.run_tests(progs, options.xre_path, options.symbols_path)
|
||||
result = tester.run_tests(progs, options.xre_path, options.symbols_path,
|
||||
options.utility_path)
|
||||
|
||||
return result
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче