Bug 1470266 - [moztest.resolve] Create a unittest for the task regexes, r=jmaher

I almost forgot to update the regexes in moztest.resolve when creating the -sw
variant of task. This adds a test to make sure we don't forget more things in
the future.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew Halberstadt 2018-09-28 06:59:39 +00:00
Родитель 6ddb5fb144
Коммит aebcf45519
1 изменённых файлов: 112 добавлений и 0 удалений

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

@ -7,6 +7,7 @@ from __future__ import absolute_import, unicode_literals
import cPickle as pickle
import os
import re
import shutil
import tempfile
import unittest
@ -19,6 +20,7 @@ from mozfile import NamedTemporaryFile
from moztest.resolve import (
TestMetadata,
TestResolver,
TEST_SUITES,
)
@ -156,6 +158,46 @@ TEST_DEFAULTS = {
"/firefox/toolkit/mozapps/update/test/unit/xpcshell_updater.ini": {"support-files": "\ndata/**\nxpcshell_updater.ini"}
}
TASK_LABELS = [
'test-linux64/opt-browser-screenshots-1',
'test-linux64/opt-browser-screenshots-e10s-1',
'test-linux64/opt-marionette',
'test-linux64/opt-mochitest',
'test-linux64/debug-mochitest-e10s',
'test-linux64/opt-mochitest-a11y',
'test-linux64/opt-mochitest-browser',
'test-linux64/opt-mochitest-browser-chrome',
'test-linux64/opt-mochitest-browser-chrome-e10s',
'test-linux64/opt-mochitest-browser-chrome-e10s-11',
'test-linux64/opt-mochitest-chrome',
'test-linux64/opt-mochitest-clipboard',
'test-linux64/opt-mochitest-devtools',
'test-linux64/opt-mochitest-devtools-chrome',
'test-linux64/opt-mochitest-gpu',
'test-linux64/opt-mochitest-gpu-e10s',
'test-linux64/opt-mochitest-media-e10s-1',
'test-linux64/opt-mochitest-media-e10s-11',
'test-linux64/opt-mochitest-plain',
'test-linux64/opt-mochitest-screenshots-1',
'test-linux64/opt-reftest',
'test-linux64/debug-reftest-e10s-1',
'test-linux64/debug-reftest-e10s-11',
'test-linux64/opt-robocop',
'test-linux64/opt-robocop-1',
'test-linux64/opt-robocop-e10s',
'test-linux64/opt-robocop-e10s-1',
'test-linux64/opt-robocop-e10s-11',
'test-linux64/opt-web-platform-tests-e10s-1',
'test-linux64/opt-web-platform-tests-reftests-e10s-1',
'test-linux64/opt-web-platform-tests-reftest-e10s-1',
'test-linux64/opt-web-platform-tests-wdspec-e10s-1',
'test-linux64/opt-web-platform-tests-1',
'test-linux64/opt-web-platform-test-e10s-1',
'test-linux64/opt-xpcshell',
'test-linux64/opt-xpcshell-1',
'test-linux64/opt-xpcshell-2',
]
class Base(unittest.TestCase):
def setUp(self):
@ -341,6 +383,76 @@ class TestTestResolver(Base):
'mobile/android/tests/browser/junit3/src/TestDistribution.java',
]
def test_task_regexes(self):
"""Test the task_regexes defined in TEST_SUITES."""
test_cases = {
'mochitest-browser': [
'test-linux64/opt-mochitest-browser-chrome',
'test-linux64/opt-mochitest-browser-chrome-e10s',
],
'mochitest-chrome': [
'test-linux64/opt-mochitest-chrome',
],
'mochitest-devtools': [
'test-linux64/opt-mochitest-devtools-chrome',
],
'mochitest-gpu': [
'test-linux64/opt-mochitest-gpu',
'test-linux64/opt-mochitest-gpu-e10s',
],
'mochitest-media': [
'test-linux64/opt-mochitest-media-e10s-1',
],
'mochitest-plain': [
'test-linux64/opt-mochitest',
'test-linux64/debug-mochitest-e10s',
],
'mochitest-screenshots': [
'test-linux64/opt-browser-screenshots-1',
'test-linux64/opt-browser-screenshots-e10s-1',
],
'reftest': [
'test-linux64/opt-reftest',
'test-linux64/debug-reftest-e10s-1',
],
'robocop': [
'test-linux64/opt-robocop',
'test-linux64/opt-robocop-1',
'test-linux64/opt-robocop-e10s',
'test-linux64/opt-robocop-e10s-1',
],
'web-platform-tests': [
'test-linux64/opt-web-platform-tests-e10s-1',
'test-linux64/opt-web-platform-tests-reftests-e10s-1',
'test-linux64/opt-web-platform-tests-wdspec-e10s-1',
'test-linux64/opt-web-platform-tests-1',
],
'web-platform-tests-testharness': [
'test-linux64/opt-web-platform-tests-e10s-1',
'test-linux64/opt-web-platform-tests-1',
],
'web-platform-tests-reftest': [
'test-linux64/opt-web-platform-tests-reftests-e10s-1',
],
'web-platform-tests-wdspec': [
'test-linux64/opt-web-platform-tests-wdspec-e10s-1',
],
'xpcshell': [
'test-linux64/opt-xpcshell',
'test-linux64/opt-xpcshell-1',
],
}
regexes = []
def match_task(task):
return any(re.search(pattern, task) for pattern in regexes)
for suite, expected in sorted(test_cases.items()):
regexes = TEST_SUITES[suite]['task_regex']
assert set(filter(match_task, TASK_LABELS)) == set(expected)
if __name__ == '__main__':
mozunit.main()