Backout bedff4a78d9a (bug 1190474) for B2G ICS Emulator Cpp unittests permafail. r=backout

This commit is contained in:
Sebastian Hengst 2015-08-13 09:08:45 +02:00
Родитель 38517add5e
Коммит 4bf9aa2b08
3 изменённых файлов: 27 добавлений и 50 удалений

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

@ -299,10 +299,9 @@ class MachCommands(MachCommandBase):
if len(params['test_files']) == 0: if len(params['test_files']) == 0:
testdir = os.path.join(self.distdir, 'cppunittests') testdir = os.path.join(self.distdir, 'cppunittests')
manifest = os.path.join(self.topsrcdir, 'testing', 'cppunittest.ini') tests = cppunittests.extract_unittests_from_args([testdir], mozinfo.info)
tests = cppunittests.extract_unittests_from_args([testdir], mozinfo.info, manifest)
else: else:
tests = cppunittests.extract_unittests_from_args(params['test_files'], mozinfo.info, None) tests = cppunittests.extract_unittests_from_args(params['test_files'], mozinfo.info)
# See if we have crash symbols # See if we have crash symbols
symbols_path = os.path.join(self.distdir, 'crashreporter-symbols') symbols_path = os.path.join(self.distdir, 'crashreporter-symbols')

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

@ -114,8 +114,7 @@ class RemoteCPPUnitTests(cppunittests.CPPUnitTests):
return env return env
def run_one_test(self, prog, env, symbols_path=None, interactive=False, def run_one_test(self, prog, env, symbols_path=None, interactive=False):
timeout_factor=1):
""" """
Run a single C++ unit test program remotely. Run a single C++ unit test program remotely.
@ -124,7 +123,6 @@ class RemoteCPPUnitTests(cppunittests.CPPUnitTests):
* env: The environment to use for running the program. * env: The environment to use for running the program.
* symbols_path: A path to a directory containing Breakpad-formatted * symbols_path: A path to a directory containing Breakpad-formatted
symbol files for producing stack traces on crash. symbol files for producing stack traces on crash.
* timeout_factor: An optional test-specific timeout multiplier.
Return True if the program exits with a zero status, False otherwise. Return True if the program exits with a zero status, False otherwise.
""" """
@ -132,9 +130,8 @@ class RemoteCPPUnitTests(cppunittests.CPPUnitTests):
remote_bin = posixpath.join(self.remote_bin_dir, basename) remote_bin = posixpath.join(self.remote_bin_dir, basename)
self.log.test_start(basename) self.log.test_start(basename)
buf = StringIO.StringIO() buf = StringIO.StringIO()
test_timeout = cppunittests.CPPUnitTests.TEST_PROC_TIMEOUT * timeout_factor
returncode = self.device.shell([remote_bin], buf, env=env, cwd=self.remote_home_dir, returncode = self.device.shell([remote_bin], buf, env=env, cwd=self.remote_home_dir,
timeout=test_timeout) timeout=cppunittests.CPPUnitTests.TEST_PROC_TIMEOUT)
self.log.process_output(basename, "\n%s" % buf.getvalue(), self.log.process_output(basename, "\n%s" % buf.getvalue(),
command=[remote_bin]) command=[remote_bin])
with mozfile.TemporaryDirectory() as tempdir: with mozfile.TemporaryDirectory() as tempdir:
@ -257,10 +254,8 @@ def main():
options.xre_path = os.path.abspath(options.xre_path) options.xre_path = os.path.abspath(options.xre_path)
cppunittests.update_mozinfo() cppunittests.update_mozinfo()
progs = cppunittests.extract_unittests_from_args(args, progs = cppunittests.extract_unittests_from_args(args, mozinfo.info)
mozinfo.info, tester = RemoteCPPUnitTests(dm, options, progs)
options.manifest_path)
tester = RemoteCPPUnitTests(dm, options, [item[0] for item in progs])
try: try:
result = tester.run_tests(progs, options.xre_path, options.symbols_path) result = tester.run_tests(progs, options.xre_path, options.symbols_path)
except Exception, e: except Exception, e:

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

@ -24,8 +24,7 @@ class CPPUnitTests(object):
# Time (seconds) in which process will be killed if it produces no output. # Time (seconds) in which process will be killed if it produces no output.
TEST_PROC_NO_OUTPUT_TIMEOUT = 300 TEST_PROC_NO_OUTPUT_TIMEOUT = 300
def run_one_test(self, prog, env, symbols_path=None, interactive=False, def run_one_test(self, prog, env, symbols_path=None, interactive=False):
timeout_factor=1):
""" """
Run a single C++ unit test program. Run a single C++ unit test program.
@ -34,7 +33,6 @@ class CPPUnitTests(object):
* env: The environment to use for running the program. * env: The environment to use for running the program.
* symbols_path: A path to a directory containing Breakpad-formatted * symbols_path: A path to a directory containing Breakpad-formatted
symbol files for producing stack traces on crash. symbol files for producing stack traces on crash.
* timeout_factor: An optional test-specific timeout multiplier.
Return True if the program exits with a zero status, False otherwise. Return True if the program exits with a zero status, False otherwise.
""" """
@ -55,8 +53,7 @@ class CPPUnitTests(object):
processOutputLine=lambda _: None) processOutputLine=lambda _: None)
#TODO: After bug 811320 is fixed, don't let .run() kill the process, #TODO: After bug 811320 is fixed, don't let .run() kill the process,
# instead use a timeout in .wait() and then kill to get a stack. # instead use a timeout in .wait() and then kill to get a stack.
test_timeout = CPPUnitTests.TEST_PROC_TIMEOUT * timeout_factor proc.run(timeout=CPPUnitTests.TEST_PROC_TIMEOUT,
proc.run(timeout=test_timeout,
outputTimeout=CPPUnitTests.TEST_PROC_NO_OUTPUT_TIMEOUT) outputTimeout=CPPUnitTests.TEST_PROC_NO_OUTPUT_TIMEOUT)
proc.wait() proc.wait()
if proc.output: if proc.output:
@ -136,7 +133,7 @@ class CPPUnitTests(object):
Run a set of C++ unit test programs. Run a set of C++ unit test programs.
Arguments: Arguments:
* programs: An iterable containing (test path, test timeout factor) tuples * programs: An iterable containing paths to test programs.
* xre_path: A path to a directory containing a XUL Runtime Environment. * xre_path: A path to a directory containing a XUL Runtime Environment.
* symbols_path: A path to a directory containing Breakpad-formatted * symbols_path: A path to a directory containing Breakpad-formatted
symbol files for producing stack traces on crash. symbol files for producing stack traces on crash.
@ -151,10 +148,7 @@ class CPPUnitTests(object):
pass_count = 0 pass_count = 0
fail_count = 0 fail_count = 0
for prog in programs: for prog in programs:
test_path = prog[0] single_result = self.run_one_test(prog, env, symbols_path, interactive)
timeout_factor = prog[1]
single_result = self.run_one_test(test_path, env, symbols_path,
interactive, timeout_factor)
if single_result: if single_result:
pass_count += 1 pass_count += 1
else: else:
@ -178,41 +172,33 @@ class CPPUnittestOptions(OptionParser):
action = "store", type = "string", dest = "symbols_path", action = "store", type = "string", dest = "symbols_path",
default = None, default = None,
help = "absolute path to directory containing breakpad symbols, or the URL of a zip file containing symbols") help = "absolute path to directory containing breakpad symbols, or the URL of a zip file containing symbols")
self.add_option("--manifest-path", self.add_option("--skip-manifest",
action = "store", type = "string", dest = "manifest_path", action = "store", type = "string", dest = "manifest_file",
default = None, default = None,
help = "path to test manifest, if different from the path to test binaries") help = "absolute path to a manifest file")
def extract_unittests_from_args(args, environ, manifest_path): def extract_unittests_from_args(args, environ):
"""Extract unittests from args, expanding directories as needed""" """Extract unittests from args, expanding directories as needed"""
mp = manifestparser.TestManifest(strict=True) mp = manifestparser.TestManifest(strict=True)
tests = [] tests = []
binary_path = None
if manifest_path:
mp.read(manifest_path)
binary_path = os.path.abspath(args[0])
else:
for p in args: for p in args:
if os.path.isdir(p): if os.path.isdir(p):
try: try:
mp.read(os.path.join(p, 'cppunittest.ini')) mp.read(os.path.join(p, 'cppunittest.ini'))
except IOError: except IOError:
tests.extend([(os.path.abspath(os.path.join(p, x)), 1) for x in os.listdir(p)]) tests.extend([os.path.abspath(os.path.join(p, x)) for x in os.listdir(p)])
else: else:
tests.append((os.path.abspath(p), 1)) tests.append(os.path.abspath(p))
# we skip the existence check here because not all tests are built # we skip the existence check here because not all tests are built
# for all platforms (and it will fail on Windows anyway) # for all platforms (and it will fail on Windows anyway)
active_tests = mp.active_tests(exists=False, disabled=False, **environ) if mozinfo.isWin:
suffix = '.exe' if mozinfo.isWin else '' tests.extend([test['path'] + '.exe' for test in mp.active_tests(exists=False, disabled=False, **environ)])
if binary_path:
tests.extend([(os.path.join(binary_path, test['relpath'] + suffix), int(test.get('requesttimeoutfactor', 1))) for test in active_tests])
else: else:
tests.extend([(test['path'] + suffix, int(test.get('requesttimeoutfactor', 1))) for test in active_tests]) tests.extend([test['path'] for test in mp.active_tests(exists=False, disabled=False, **environ)])
# skip non-existing tests # skip non-existing tests
tests = [test for test in tests if os.path.isfile(test[0])] tests = [test for test in tests if os.path.isfile(test)]
return tests return tests
@ -237,15 +223,12 @@ def main():
if not options.xre_path: if not options.xre_path:
print >>sys.stderr, """Error: --xre-path is required""" print >>sys.stderr, """Error: --xre-path is required"""
sys.exit(1) sys.exit(1)
if options.manifest_path and len(args) > 1:
print >>sys.stderr, "Error: multiple arguments not supported with --test-manifest"
sys.exit(1)
log = mozlog.commandline.setup_logging("cppunittests", options, log = mozlog.commandline.setup_logging("cppunittests", options,
{"tbpl": sys.stdout}) {"tbpl": sys.stdout})
update_mozinfo() update_mozinfo()
progs = extract_unittests_from_args(args, mozinfo.info, options.manifest_path) progs = extract_unittests_from_args(args, mozinfo.info)
options.xre_path = os.path.abspath(options.xre_path) options.xre_path = os.path.abspath(options.xre_path)
if mozinfo.isMac: if mozinfo.isMac:
options.xre_path = os.path.join(os.path.dirname(options.xre_path), 'Resources') options.xre_path = os.path.join(os.path.dirname(options.xre_path), 'Resources')