Bug 1417051 - Mozharness has to run Marionette tests from tests folder. r=maja_zf

Updates the mozharness script to run the Marionette command by using
the test folder as current working directory. This will make sure
that the relative path to the tests is reported. It's identical to
the location in the tree.

MozReview-Commit-ID: 6hOQnJSqfv0

--HG--
extra : rebase_source : b54f2a928d47b369b4102a920532aee0503534df
This commit is contained in:
Henrik Skupin 2017-11-30 17:55:03 +01:00
parent 0e0f517ffb
commit 04dbc73772
5 changed files with 30 additions and 18 deletions

View File

@ -31,9 +31,9 @@ config = {
'run-tests',
],
"default_blob_upload_servers": [
"https://blobupload.elasticbeanstalk.com",
"https://blobupload.elasticbeanstalk.com",
],
"blob_uploader_auth_file" : os.path.join(os.getcwd(), "oauth.txt"),
"blob_uploader_auth_file": os.path.join(os.getcwd(), "oauth.txt"),
"download_symbols": "ondemand",
"download_minidump_stackwalk": True,
"tooltool_cache": "/builds/worker/tooltool-cache",
@ -49,7 +49,7 @@ config = {
"--symbols-path=%(symbols_path)s"
],
"run_filename": "",
"testsdir": ""
"testsdir": "marionette"
}
},
"structured_output": True,

View File

@ -24,7 +24,7 @@ config = {
"--symbols-path=%(symbols_path)s"
],
"run_filename": "",
"testsdir": ""
"testsdir": "marionette"
},
},
}

View File

@ -35,9 +35,9 @@ config = {
'run-tests',
],
"default_blob_upload_servers": [
"https://blobupload.elasticbeanstalk.com",
"https://blobupload.elasticbeanstalk.com",
],
"blob_uploader_auth_file" : os.path.join(os.getcwd(), "oauth.txt"),
"blob_uploader_auth_file": os.path.join(os.getcwd(), "oauth.txt"),
"download_minidump_stackwalk": True,
"download_symbols": "ondemand",
"suite_definitions": {
@ -52,7 +52,7 @@ config = {
"--symbols-path=%(symbols_path)s"
],
"run_filename": "",
"testsdir": ""
"testsdir": "marionette"
},
},
}

View File

@ -34,9 +34,9 @@ config = {
'run-tests',
],
"default_blob_upload_servers": [
"https://blobupload.elasticbeanstalk.com",
"https://blobupload.elasticbeanstalk.com",
],
"blob_uploader_auth_file" : 'C:/builds/oauth.txt',
"blob_uploader_auth_file": 'C:/builds/oauth.txt',
"download_minidump_stackwalk": True,
"download_symbols": "ondemand",
"suite_definitions": {
@ -51,7 +51,7 @@ config = {
"--symbols-path=%(symbols_path)s"
],
"run_filename": "",
"testsdir": ""
"testsdir": "marionette"
},
},
}

View File

@ -147,6 +147,10 @@ class MarionetteTest(TestingMixin, MercurialScript, BlobUploadMixin, TransferMix
self.test_url = c.get('test_url')
self.test_packages_url = c.get('test_packages_url')
self.test_suite = self._get_test_suite(c.get('emulator'))
if self.test_suite not in self.config["suite_definitions"]:
self.fatal("{} is not defined in the config!".format(self.test_suite))
if c.get('structured_output'):
self.parser_class = StructuredOutputParser
else:
@ -158,6 +162,12 @@ class MarionetteTest(TestingMixin, MercurialScript, BlobUploadMixin, TransferMix
self.fatal("You need to specify a --marionette-address for non-emulator tests! "
"(Try --marionette-address localhost:2828 )")
def _query_tests_dir(self):
dirs = self.query_abs_dirs()
test_dir = self.config["suite_definitions"][self.test_suite]["testsdir"]
return os.path.join(dirs['abs_test_install_dir'], test_dir)
def query_abs_dirs(self):
if self.abs_dirs:
return self.abs_dirs
@ -209,7 +219,7 @@ class MarionetteTest(TestingMixin, MercurialScript, BlobUploadMixin, TransferMix
self.register_virtualenv_module(
'marionette', os.path.join('tests', 'marionette'))
def _get_options_group(self, is_emulator):
def _get_test_suite(self, is_emulator):
"""
Determine which in tree options group to use and return the
appropriate key.
@ -295,13 +305,8 @@ class MarionetteTest(TestingMixin, MercurialScript, BlobUploadMixin, TransferMix
if self.config.get("structured_output"):
cmd.append("--log-raw=-")
options_group = self._get_options_group(self.config.get('emulator'))
if options_group not in self.config["suite_definitions"]:
self.fatal("%s is not defined in the config!" % options_group)
for s in self.config["suite_definitions"][options_group]["options"]:
cmd.append(s % config_fmt_args)
for arg in self.config["suite_definitions"][self.test_suite]["options"]:
cmd.append(arg % config_fmt_args)
if self.mkdir_p(dirs["abs_blob_upload_dir"]) == -1:
# Make sure that the logging directory exists
@ -330,11 +335,18 @@ class MarionetteTest(TestingMixin, MercurialScript, BlobUploadMixin, TransferMix
self.mkdir_p(env['MOZ_UPLOAD_DIR'])
env = self.query_env(partial_env=env)
try:
cwd = self._query_tests_dir()
except Exception as e:
self.fatal("Don't know how to run --test-suite '{0}': {1}!".format(
self.test_suite, e))
marionette_parser = self.parser_class(config=self.config,
log_obj=self.log_obj,
error_list=BaseErrorList + HarnessErrorList,
strict=False)
return_code = self.run_command(cmd,
cwd=cwd,
output_timeout=1000,
output_parser=marionette_parser,
env=env)