Bug 992983 - Run gtests from mozharness' desktop_unittest.py r=jlund

This commit is contained in:
Chris Manchester 2015-07-18 22:05:06 -07:00
parent 101e1e2e07
commit 7da5e1f3a8
5 changed files with 82 additions and 6 deletions

View File

@ -40,6 +40,7 @@ config = {
"reftest": "runreftest.py",
"xpcshell": "runxpcshelltests.py",
"cppunittest": "runcppunittests.py",
"gtest": "rungtests.py",
"jittest": "jit_test.py",
"mozbase": "test.py",
"mozmill": "runtestlist.py",
@ -51,6 +52,7 @@ config = {
"reftest": ["reftest/*", "jsreftest/*"],
"xpcshell": ["xpcshell/*"],
"cppunittest": ["cppunittest/*"],
"gtest": ["gtest/*"],
"jittest": ["jit-test/*"],
"mozbase": ["mozbase/*"],
"mozmill": ["mozmill/*"],
@ -163,7 +165,16 @@ config = {
],
"run_filename": "runxpcshelltests.py",
"testsdir": "xpcshell"
}
},
"gtest": {
"options": [
"--xre-path=%(abs_res_dir)s",
"--cwd=%(gtest_dir)s",
"--symbols-path=%(symbols_path)s",
"%(binary_path)s",
],
"run_filename": "rungtests.py",
},
},
# local mochi suites
"all_mochitest_suites": {
@ -218,6 +229,9 @@ config = {
"all_cppunittest_suites": {
"cppunittest": ['tests/cppunittest']
},
"all_gtest_suites": {
"gtest": []
},
"all_jittest_suites": {
"jittest": [],
"jittest1": ["--total-chunks=2", "--this-chunk=1"],

View File

@ -29,6 +29,7 @@ config = {
"reftest": "runreftest.py",
"xpcshell": "runxpcshelltests.py",
"cppunittest": "runcppunittests.py",
"gtest": "rungtests.py",
"jittest": "jit_test.py",
"mozbase": "test.py",
"mozmill": "runtestlist.py",
@ -40,6 +41,7 @@ config = {
"reftest": ["reftest/*", "jsreftest/*"],
"xpcshell": ["xpcshell/*"],
"cppunittest": ["cppunittest/*"],
"gtest": ["gtest/*"],
"jittest": ["jit-test/*"],
"mozbase": ["mozbase/*"],
"mozmill": ["mozmill/*"],
@ -130,7 +132,16 @@ config = {
],
"run_filename": "runxpcshelltests.py",
"testsdir": "xpcshell"
}
},
"gtest": {
"options": [
"--xre-path=%(abs_res_dir)s",
"--cwd=%(gtest_dir)s",
"--symbols-path=%(symbols_path)s",
"%(binary_path)s",
],
"run_filename": "rungtests.py",
},
},
# local mochi suites
"all_mochitest_suites": {
@ -177,6 +188,9 @@ config = {
"all_cppunittest_suites": {
"cppunittest": ['tests/cppunittest']
},
"all_gtest_suites": {
"gtest": []
},
"all_jittest_suites": {
"jittest": []
},

View File

@ -38,6 +38,7 @@ config = {
"reftest": "runreftest.py",
"xpcshell": "runxpcshelltests.py",
"cppunittest": "runcppunittests.py",
"gtest": "rungtests.py",
"jittest": "jit_test.py",
"mozbase": "test.py",
"mozmill": "runtestlist.py",
@ -49,6 +50,7 @@ config = {
"reftest": ["reftest/*", "jsreftest/*"],
"xpcshell": ["xpcshell/*"],
"cppunittest": ["cppunittest/*"],
"gtest": ["gtest/*"],
"jittest": ["jit-test/*"],
"mozbase": ["mozbase/*"],
"mozmill": ["mozmill/*"],
@ -138,7 +140,16 @@ config = {
],
"run_filename": "runxpcshelltests.py",
"testsdir": "xpcshell"
}
},
"gtest": {
"options": [
"--xre-path=%(abs_res_dir)s",
"--cwd=%(gtest_dir)s",
"--symbols-path=%(symbols_path)s",
"%(binary_path)s",
],
"run_filename": "rungtests.py",
},
},
# local mochi suites
"all_mochitest_suites":
@ -191,6 +202,9 @@ config = {
"all_cppunittest_suites": {
"cppunittest": ['tests/cppunittest']
},
"all_gtest_suites": {
"gtest": []
},
"all_jittest_suites": {
"jittest": []
},

View File

@ -60,6 +60,12 @@ TinderBoxPrintRe = {
'fail_group': "Failed",
'known_fail_group': None,
},
"gtest_summary": {
'regex': re.compile(r'''(Passed|Failed): (\d+)'''),
'pass_group': "Passed",
'fail_group': "Failed",
'known_fail_group': None,
},
"jittest_summary": {
'regex': re.compile(r'''(Passed|Failed): (\d+)'''),
'pass_group': "Passed",

View File

@ -31,9 +31,8 @@ from mozharness.mozilla.testing.codecoverage import (
code_coverage_config_options
)
from mozharness.mozilla.testing.testbase import TestingMixin, testing_config_options
from mozharness.mozilla.buildbot import TBPL_WARNING
SUITE_CATEGORIES = ['cppunittest', 'jittest', 'mochitest', 'reftest', 'xpcshell', 'mozbase', 'mozmill', 'webapprt']
SUITE_CATEGORIES = ['gtest', 'cppunittest', 'jittest', 'mochitest', 'reftest', 'xpcshell', 'mozbase', 'mozmill', 'webapprt']
# DesktopUnittest {{{1
@ -79,6 +78,14 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
"Suites are defined in the config file\n."
"Examples: 'cppunittest'"}
],
[['--gtest-suite', ], {
"action": "extend",
"dest": "specified_gtest_suites",
"type": "string",
"help": "Specify which gtest suite to run. "
"Suites are defined in the config file\n."
"Examples: 'gtest'"}
],
[['--jittest-suite', ], {
"action": "extend",
"dest": "specified_jittest_suites",
@ -207,6 +214,7 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
dirs['abs_reftest_dir'] = os.path.join(dirs['abs_test_install_dir'], "reftest")
dirs['abs_xpcshell_dir'] = os.path.join(dirs['abs_test_install_dir'], "xpcshell")
dirs['abs_cppunittest_dir'] = os.path.join(dirs['abs_test_install_dir'], "cppunittest")
dirs['abs_gtest_dir'] = os.path.join(dirs['abs_test_install_dir'], "gtest")
dirs['abs_blob_upload_dir'] = os.path.join(abs_dirs['abs_work_dir'], 'blobber_upload_dir')
dirs['abs_jittest_dir'] = os.path.join(dirs['abs_test_install_dir'], "jit-test", "jit-test")
dirs['abs_mozbase_dir'] = os.path.join(dirs['abs_test_install_dir'], "mozbase")
@ -339,7 +347,10 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
'abs_res_dir': abs_res_dir,
'raw_log_file': raw_log_file,
'error_summary_file': error_summary_file,
'gtest_dir': os.path.join(dirs['abs_test_install_dir'],
'gtest'),
}
# TestingMixin._download_and_extract_symbols() will set
# self.symbols_path when downloading/extracting.
if self.symbols_path:
@ -468,6 +479,8 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
preflight_run_method=self.preflight_xpcshell)
self._run_category_suites('cppunittest',
preflight_run_method=self.preflight_cppunittest)
self._run_category_suites('gtest',
preflight_run_method=self.preflight_gtest)
self._run_category_suites('jittest')
self._run_category_suites('mozbase')
self._run_category_suites('mozmill',
@ -515,6 +528,21 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
for f in files:
self.move(f, abs_res_dir)
def preflight_gtest(self, suites):
abs_res_dir = self.query_abs_res_dir()
abs_app_dir = self.query_abs_app_dir()
dirs = self.query_abs_dirs()
abs_gtest_dir = dirs['abs_gtest_dir']
dirs['abs_test_bin_dir'] = os.path.join(dirs['abs_test_install_dir'], 'bin')
files = glob.glob(os.path.join(dirs['abs_test_bin_plugins_dir'], 'gmp-*'))
files.append(os.path.join(abs_gtest_dir, 'dependentlibs.list.gtest'))
for f in files:
self.move(f, abs_res_dir)
self.copytree(os.path.join(abs_gtest_dir, 'gtest_bin'),
os.path.join(abs_app_dir))
def preflight_mozmill(self, suites):
c = self.config
dirs = self.query_abs_dirs()
@ -606,7 +634,7 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
# 3) checking to see if the return code is in success_codes
success_codes = None
if self._is_windows():
if self._is_windows() and suite_category != 'gtest':
# bug 1120644
success_codes = [0, 1]