Bug 1592754 - Improve TV handling of modified reftest reference files; r=ahal

Replace the existing regex-based hack for recognizing reftest reference files
with a reliable method based on the reftest manifest.

Differential Revision: https://phabricator.services.mozilla.com/D51172

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Geoff Brown 2019-11-06 22:42:59 +00:00
Родитель fac08e5f9c
Коммит 727dbab951
1 изменённых файлов: 30 добавлений и 31 удалений

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

@ -10,7 +10,6 @@ import json
import math
import os
import posixpath
import re
import sys
import mozinfo
from manifestparser import TestManifest
@ -61,7 +60,7 @@ class SingleTestMixin(object):
# tests with the same path specified in multiple manifests).
disabled = [t['relpath'] for t in active if 'disabled' in t]
all_disabled += disabled
new_by_path = {t['relpath']: (suite, t.get('subsuite'))
new_by_path = {t['relpath']: (suite, t.get('subsuite'), None)
for t in active if 'disabled' not in t and
t['relpath'] not in disabled}
tests_by_path.update(new_by_path)
@ -81,12 +80,13 @@ class SingleTestMixin(object):
if os.path.exists(path):
man = manifest.ReftestManifest()
man.load(path)
for t in man.files:
relpath = os.path.relpath(t, self.reftest_test_dir)
tests_by_path[relpath] = (suite, subsuite)
self._map_test_path_to_source(t, relpath)
for t in man.tests:
relpath = os.path.relpath(t['path'], self.reftest_test_dir)
referenced = t['referenced-test'] if 'referenced-test' in t else None
tests_by_path[relpath] = (suite, subsuite, referenced)
self._map_test_path_to_source(t['path'], relpath)
self.info("Per-test run updated with manifest %s (%d tests)" %
(path, len(man.files)))
(path, len(man.tests)))
suite = 'jsreftest'
self.jsreftest_test_dir = os.path.join(dirs['abs_test_install_dir'], 'jsreftest', 'tests')
@ -105,7 +105,7 @@ class SingleTestMixin(object):
test_path = os.path.join(self.jsreftest_test_dir, relpath)
relpath = os.path.join('js', 'src', 'tests', relpath)
self._map_test_path_to_source(test_path, relpath)
tests_by_path.update({relpath: (suite, None)})
tests_by_path.update({relpath: (suite, None, None)})
else:
self.warning("unexpected jsreftest test format: %s" % str(t))
self.info("Per-test run updated with manifest %s (%d tests)" %
@ -131,25 +131,33 @@ class SingleTestMixin(object):
self.info("Per-test run (non-gpu) discarded gpu test %s (%s)" % (file, entry[1]))
continue
if entry[2] is not None:
# Test name substitution, for reftest reference file handling:
# - if both test and reference modified, run the test file
# - if only reference modified, run the test file
test_file = os.path.join(os.path.dirname(file), entry[2])
self.info("Per-test run substituting %s for %s" % (test_file, file))
file = test_file
self.info("Per-test run found test %s (%s/%s)" % (file, entry[0], entry[1]))
subsuite_mapping = {
# Map (<suite>, <subsuite>): <full-suite>
# <suite> is associated with a manifest, explicitly in code above
# <subsuite> comes from "subsuite" tags in some manifest entries
# <full-suite> is a unique id for the suite, matching desktop mozharness configs
('mochitest-browser-chrome', 'devtools'): 'mochitest-devtools-chrome',
('mochitest-browser-chrome', 'devtools-webreplay'): 'mochitest-devtools-chrome-webreplay', # noqa
('mochitest-browser-chrome', 'remote'): 'mochitest-remote',
('mochitest-browser-chrome', 'screenshots'): 'mochitest-browser-chrome-screenshots', # noqa
('mochitest-plain', 'media'): 'mochitest-media',
('mochitest-browser-chrome', 'devtools', None): 'mochitest-devtools-chrome',
('mochitest-browser-chrome', 'devtools-webreplay', None): 'mochitest-devtools-chrome-webreplay', # noqa
('mochitest-browser-chrome', 'remote', None): 'mochitest-remote',
('mochitest-browser-chrome', 'screenshots', None): 'mochitest-browser-chrome-screenshots', # noqa
('mochitest-plain', 'media', None): 'mochitest-media',
# below should be on test-verify-gpu job
('mochitest-chrome', 'gpu'): 'mochitest-chrome-gpu',
('mochitest-plain', 'gpu'): 'mochitest-plain-gpu',
('mochitest-plain', 'webgl1-core'): 'mochitest-webgl1-core',
('mochitest-plain', 'webgl1-ext'): 'mochitest-webgl1-ext',
('mochitest-plain', 'webgl2-core'): 'mochitest-webgl2-core',
('mochitest-plain', 'webgl2-ext'): 'mochitest-webgl2-ext',
('mochitest-plain', 'webgl2-deqp'): 'mochitest-webgl2-deqp',
('mochitest-chrome', 'gpu', None): 'mochitest-chrome-gpu',
('mochitest-plain', 'gpu', None): 'mochitest-plain-gpu',
('mochitest-plain', 'webgl1-core', None): 'mochitest-webgl1-core',
('mochitest-plain', 'webgl1-ext', None): 'mochitest-webgl1-ext',
('mochitest-plain', 'webgl2-core', None): 'mochitest-webgl2-core',
('mochitest-plain', 'webgl2-ext', None): 'mochitest-webgl2-ext',
('mochitest-plain', 'webgl2-deqp', None): 'mochitest-webgl2-deqp',
}
if entry in subsuite_mapping:
suite = subsuite_mapping[entry]
@ -158,7 +166,8 @@ class SingleTestMixin(object):
suite_files = self.suites.get(suite)
if not suite_files:
suite_files = []
suite_files.append(file)
if file not in suite_files:
suite_files.append(file)
self.suites[suite] = suite_files
def _find_wpt_tests(self, dirs, changed_files):
@ -305,7 +314,6 @@ class SingleTestMixin(object):
if not self.per_test_coverage and not self.verify_enabled:
return [[]]
references = re.compile(r"(-ref|-notref|-noref|-noref.)\.")
files = []
jsreftest_extra_dir = os.path.join('js', 'src', 'tests')
# For some suites, the test path needs to be updated before passing to
@ -314,15 +322,6 @@ class SingleTestMixin(object):
if (self.config.get('per_test_category') != "web-platform" and
suite in ['reftest', 'crashtest']):
file = os.path.join(self.reftest_test_dir, file)
if suite == 'reftest':
# Special handling for modified reftest reference files:
# - if both test and reference modified, run the test file
# - if only reference modified, run the test file
nonref = references.sub('.', file)
if nonref != file:
file = None
if nonref not in files and os.path.exists(nonref):
file = nonref
elif (self.config.get('per_test_category') != "web-platform" and
suite == 'jsreftest'):
file = os.path.relpath(file, jsreftest_extra_dir)