Bug 1238469 - Part 3: Use b2g_emulator_unittest.py for b2g marionette tests; r=ahal

--HG--
extra : commitid : 1CfVlIkAUgs
extra : rebase_source : fcb5ab9135854f5451c255e9a0c754875e92ed9d
This commit is contained in:
Edgar Chen 2016-01-20 19:27:05 +08:00
Родитель 1721808b8f
Коммит db274a814c
7 изменённых файлов: 71 добавлений и 32 удалений

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

@ -33,7 +33,8 @@ config = {
"reftest": "runreftestb2g.py",
"crashtest": "runreftestb2g.py",
"xpcshell": "runtestsb2g.py",
"cppunittest": "remotecppunittests.py"
"cppunittest": "remotecppunittests.py",
"marionette": "runtests.py"
},
"suite_definitions": {
"cppunittest": {
@ -175,6 +176,19 @@ config = {
],
"run_filename": "runtestsb2g.py",
"testsdir": "xpcshell"
},
"marionette": {
"options": [
"--type=b2g",
"--log-raw=%(raw_log_file)s",
"--log-errorsummary=%(error_summary_file)s",
"--symbols-path=%(symbols_path)s",
"--logcat-dir=%(logcat_dir)s",
"--emulator=%(emulator)s",
"--homedir=%(homedir)s"
],
"run_filename": "runtests.py",
"testsdir": "marionette/client/marionette"
}
},
"vcs_output_timeout": 1760,

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

@ -1,4 +1,6 @@
# This is a template config file for marionette production.
# TODO: This could be removed after B2G ICS emulator buildbot builds is turned
# off, Bug 1209180.
import os

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

@ -9,7 +9,7 @@ import os
import re
from mozharness.mozilla.testing.errors import TinderBoxPrintRe
from mozharness.base.log import OutputParser, WARNING, INFO, CRITICAL
from mozharness.base.log import OutputParser, WARNING, INFO, CRITICAL, ERROR
from mozharness.mozilla.buildbot import TBPL_WARNING, TBPL_FAILURE, TBPL_RETRY
from mozharness.mozilla.buildbot import TBPL_SUCCESS, TBPL_WORST_LEVEL_TUPLE
@ -50,6 +50,8 @@ class TestSummaryOutputParserHelper(OutputParser):
self.passed = 0
self.todo = 0
self.last_line = None
self.tbpl_status = TBPL_SUCCESS
self.worst_log_level = INFO
super(TestSummaryOutputParserHelper, self).__init__(**kwargs)
def parse_single_line(self, line):
@ -63,7 +65,18 @@ class TestSummaryOutputParserHelper(OutputParser):
# ignore bad values
pass
def evaluate_parser(self):
def evaluate_parser(self, return_code, success_codes=None):
if return_code == 0 and self.passed > 0 and self.failed == 0:
self.tbpl_status = TBPL_SUCCESS
elif return_code == 10 and self.failed > 0:
self.tbpl_status = TBPL_WARNING
else:
self.tbpl_status = TBPL_FAILURE
self.worst_log_level = ERROR
return (self.tbpl_status, self.worst_log_level)
def print_summary(self, suite_name):
# generate the TinderboxPrint line for TBPL
emphasize_fail_text = '<em class="testfail">%s</em>'
failed = "0"
@ -74,10 +87,11 @@ class TestSummaryOutputParserHelper(OutputParser):
failed = emphasize_fail_text % str(self.failed)
self.tsummary = "%d/%s/%d" % (self.passed, failed, self.todo)
def print_summary(self, suite_name):
self.evaluate_parser()
self.info("TinderboxPrint: %s: %s\n" % (suite_name, self.tsummary))
def append_tinderboxprint_line(self, suite_name):
self.print_summary(suite_name)
class DesktopUnittestOutputParser(OutputParser):
"""

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

@ -23,11 +23,12 @@ from mozharness.base.vcs.vcsbase import VCSMixin
from mozharness.mozilla.blob_upload import BlobUploadMixin, blobupload_config_options
from mozharness.mozilla.testing.errors import LogcatErrorList
from mozharness.mozilla.testing.testbase import TestingMixin, testing_config_options
from mozharness.mozilla.testing.unittest import TestSummaryOutputParserHelper
from mozharness.mozilla.buildbot import TBPL_SUCCESS
class B2GEmulatorTest(TestingMixin, VCSMixin, BaseScript, BlobUploadMixin):
test_suites = ('jsreftest', 'reftest', 'mochitest', 'mochitest-chrome', 'xpcshell', 'crashtest', 'cppunittest')
test_suites = ('jsreftest', 'reftest', 'mochitest', 'mochitest-chrome', 'xpcshell', 'crashtest', 'cppunittest', 'marionette')
config_options = [[
["--type"],
{"action": "store",
@ -190,6 +191,8 @@ class B2GEmulatorTest(TestingMixin, VCSMixin, BaseScript, BlobUploadMixin):
dirs['abs_test_install_dir'], 'xpcshell')
dirs['abs_cppunittest_dir'] = os.path.join(
dirs['abs_test_install_dir'], 'cppunittest')
dirs['abs_marionette_dir'] = os.path.join(
dirs['abs_test_install_dir'], 'marionette', 'marionette')
for key in dirs.keys():
if key not in abs_dirs:
abs_dirs[key] = dirs[key]
@ -250,6 +253,7 @@ class B2GEmulatorTest(TestingMixin, VCSMixin, BaseScript, BlobUploadMixin):
'xre_path': os.path.join(dirs['abs_xre_dir'], 'bin'),
'utility_path': os.path.join(dirs['abs_test_install_dir'], 'bin'),
'symbols_path': self.symbols_path,
'homedir': os.path.join(dirs['abs_emulator_dir'], 'b2g-distro'),
'busybox': self.busybox_path,
'total_chunks': self.config.get('total_chunks'),
'this_chunk': self.config.get('this_chunk'),
@ -274,6 +278,9 @@ class B2GEmulatorTest(TestingMixin, VCSMixin, BaseScript, BlobUploadMixin):
str_format_values=str_format_values)
cmd.extend(opt for opt in tests if not opt.endswith('None'))
if self.test_manifest:
cmd.append(self.test_manifest)
return cmd
def _query_adb(self):
@ -285,19 +292,15 @@ class B2GEmulatorTest(TestingMixin, VCSMixin, BaseScript, BlobUploadMixin):
def preflight_run_tests(self):
super(B2GEmulatorTest, self).preflight_run_tests()
suite = self.config['test_suite']
dirs = self.query_abs_dirs()
# set default test manifest by suite if none specified
if not self.test_manifest:
if suite == 'reftest':
self.test_manifest = os.path.join('tests', 'layout',
'reftests', 'reftest.list')
elif suite == 'xpcshell':
self.test_manifest = os.path.join('tests', 'xpcshell_b2g.ini')
elif suite == 'crashtest':
self.test_manifest = os.path.join('tests', 'testing',
'crashtest', 'crashtests.list')
elif suite == 'jsreftest':
self.test_manifest = os.path.join('jsreftest', 'tests',
'jstests.list')
if self.test_manifest:
if suite == 'marionette':
self.test_manifest = os.path.join(dirs['abs_test_install_dir'],
'marionette', 'tests',
'testing', 'marionette',
'client', 'marionette',
'tests', self.test_manifest)
if not os.path.isfile(self.adb_path):
self.fatal("The adb binary '%s' is not a valid file!" % self.adb_path)
@ -352,10 +355,15 @@ class B2GEmulatorTest(TestingMixin, VCSMixin, BaseScript, BlobUploadMixin):
env = self.query_env(partial_env=env)
success_codes = self._get_success_codes(suite_name)
parser = self.get_test_output_parser(suite_name,
config=self.config,
log_obj=self.log_obj,
error_list=error_list)
if suite_name == "marionette":
parser = TestSummaryOutputParserHelper(config=self.config,
log_obj=self.log_obj,
error_list=self.error_list)
else:
parser = self.get_test_output_parser(suite_name,
config=self.config,
log_obj=self.log_obj,
error_list=error_list)
return_code = self.run_command(cmd, cwd=cwd, env=env,
output_timeout=1000,
output_parser=parser,

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

@ -26,6 +26,8 @@ from mozharness.mozilla.testing.testbase import TestingMixin, testing_config_opt
from mozharness.mozilla.testing.unittest import TestSummaryOutputParserHelper
from mozharness.mozilla.structuredlog import StructuredOutputParser
# TODO: we could remove emulator specific code after B2G ICS emulator buildbot
# builds is turned off, Bug 1209180.
class MarionetteTest(TestingMixin, MercurialScript, BlobUploadMixin, TransferMixin, GaiaMixin):
config_options = [[
["--application"],

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

@ -11,13 +11,13 @@ task:
command:
- entrypoint
- >
python ./mozharness/scripts/marionette.py
--no-read-buildbot-config
--config-file ./mozharness/configs/marionette/automation_emulator_config.py
--config-file ./mozharness_configs/remove_executables.py
--download-symbols ondemand
python ./mozharness/scripts/b2g_emulator_unittest.py
--config-file ./mozharness/configs/b2g/taskcluster_emulator_automation.py
--test-suite marionette
--test-manifest unit-tests.ini
--installer-url {{build_url}}
--test-packages-url {{test_packages_url}}
--xre-url https://api.pub.build.mozilla.org/tooltool/sha512/cefa8c00db04969d3a50e2a5509bd4ea1dc17d256a651a9518cb28dad72e87a1dbbcd3c88ef770be0edf0ab73d2d73925140df93618ffb7fab81b789d312f547
artifacts:
'public/build':
type: directory

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

@ -11,14 +11,13 @@ task:
command:
- entrypoint
- >
python ./mozharness/scripts/marionette.py
--no-read-buildbot-config
--config-file ./mozharness/configs/marionette/automation_emulator_config.py
--config-file ./mozharness_configs/remove_executables.py
--download-symbols ondemand
python ./mozharness/scripts/b2g_emulator_unittest.py
--config-file ./mozharness/configs/b2g/taskcluster_emulator_automation.py
--test-suite marionette
--test-manifest webapi-tests.ini
--installer-url {{build_url}}
--test-packages-url {{test_packages_url}}
--xre-url https://api.pub.build.mozilla.org/tooltool/sha512/cefa8c00db04969d3a50e2a5509bd4ea1dc17d256a651a9518cb28dad72e87a1dbbcd3c88ef770be0edf0ab73d2d73925140df93618ffb7fab81b789d312f547
artifacts:
'public/build':
type: directory