Bug 1413928 - [mozharness] Accept extra test harness args via environment variable r=maja_zf

When MOZHARNESS_TEST_PATHS is set, the test suite mozharness scripts
will run the paths specified there instead of the normal chunking
and/or default manifest. Paths should be separated by a ':' character.

In the case of web_platform_tests.py, we have to make the test paths
relative to 'testing/web-platform'.

MozReview-Commit-ID: IHRXXi5mB4G

--HG--
extra : rebase_source : 17b31ec19a64ab16918d0bd80d19d9bb496cbe37
This commit is contained in:
Andrew Halberstadt 2017-11-02 15:53:39 -04:00
Родитель 193e30d84e
Коммит 811da0a366
4 изменённых файлов: 32 добавлений и 14 удалений

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

@ -463,23 +463,28 @@ class AndroidEmulatorTest(BlobUploadMixin, TestingMixin, EmulatorMixin, VCSMixin
self.config.get('marionette_test_manifest', '')
),
}
user_paths = os.environ.get('MOZHARNESS_TEST_PATHS')
for option in self.config["suite_definitions"][self.test_suite]["options"]:
opt = option.split('=')[0]
# override configured chunk options with script args, if specified
if opt == '--this-chunk' and self.this_chunk is not None:
continue
if opt == '--total-chunks' and self.total_chunks is not None:
continue
if opt in ('--this-chunk', '--total-chunks'):
if user_paths or getattr(self, opt.replace('-', '_').strip('_'), None) is not None:
continue
if '%(app)' in option:
# only query package name if requested
cmd.extend([option % {'app': self._query_package_name()}])
else:
cmd.extend([option % str_format_values])
if self.this_chunk is not None:
cmd.extend(['--this-chunk', self.this_chunk])
if self.total_chunks is not None:
cmd.extend(['--total-chunks', self.total_chunks])
if user_paths:
cmd.extend(user_paths.split(':'))
else:
if self.this_chunk is not None:
cmd.extend(['--this-chunk', self.this_chunk])
if self.total_chunks is not None:
cmd.extend(['--total-chunks', self.total_chunks])
try_options, try_tests = self.try_args(self.test_suite)
cmd.extend(try_options)

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

@ -415,7 +415,10 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
elif suite_category not in SUITE_DEFAULT_E10S and c['e10s']:
base_cmd.append('--e10s')
if c.get('total_chunks') and c.get('this_chunk'):
# Ignore chunking if we have user specified test paths
if os.environ.get('MOZHARNESS_TEST_PATHS'):
base_cmd.extend(os.environ['MOZHARNESS_TEST_PATHS'].split(':'))
elif c.get('total_chunks') and c.get('this_chunk'):
base_cmd.extend(['--total-chunks', c['total_chunks'],
'--this-chunk', c['this_chunk']])

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

@ -312,7 +312,10 @@ class MarionetteTest(TestingMixin, MercurialScript, BlobUploadMixin, TransferMix
# Make sure that the logging directory exists
self.fatal("Could not create blobber upload directory")
cmd.append(manifest)
if os.environ.get('MOZHARNESS_TEST_PATHS'):
cmd.extend(os.environ['MOZHARNESS_TEST_PATHS'].split(':'))
else:
cmd.append(manifest)
try_options, try_tests = self.try_args("marionette")
cmd.extend(self.query_tests_args(try_tests,

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

@ -224,10 +224,17 @@ class WebPlatformTest(TestingMixin, MercurialScript, BlobUploadMixin, CodeCovera
else:
cmd.append("--stylo-threads=4")
for opt in ["total_chunks", "this_chunk"]:
val = c.get(opt)
if val:
cmd.append("--%s=%s" % (opt.replace("_", "-"), val))
if os.environ.get('MOZHARNESS_TEST_PATHS'):
prefix = 'testing/web-platform'
paths = os.environ['MOZHARNESS_TEST_PATHS'].split(':')
paths = [os.path.join(dirs["abs_wpttest_dir"], os.path.relpath(p, prefix))
for p in paths if p.startswith(prefix)]
cmd.extend(paths)
else:
for opt in ["total_chunks", "this_chunk"]:
val = c.get(opt)
if val:
cmd.append("--%s=%s" % (opt.replace("_", "-"), val))
if "wdspec" in test_types:
geckodriver_path = self._query_geckodriver()