Bug 1749772 - [tryselect] Normalize 'manifest_relpath' in filter_tasks_by_paths, r=Gijs

Ideally 'manifest' and 'manifest_relpath' should be normalized to forward
slashes upstream in the TestResolver class. But normalizing them there could
potentially break other uses in-tree, and I don't have bandwidth to do a proper
audit to be confident I'm not breaking something elsewhere.

Differential Revision: https://phabricator.services.mozilla.com/D136183
This commit is contained in:
Andrew Halberstadt 2022-01-18 14:43:50 +00:00
Родитель c3b4f0fb57
Коммит 1e1b1683bc
2 изменённых файлов: 19 добавлений и 1 удалений

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

@ -9,6 +9,7 @@ import re
import sys
from collections import defaultdict
import mozpack.path as mozpath
from mach.util import get_state_dir
from mozbuild.base import MozbuildObject
from mozpack.files import FileFinder
@ -175,8 +176,11 @@ def resolve_tests_by_suite(paths):
if test_path is None:
continue
found_path = None
manifest_relpath = None
if "manifest_relpath" in test:
manifest_relpath = mozpath.normpath(test["manifest_relpath"])
for path in remaining_paths_by_suite[key]:
if test_path.startswith(path) or test.get("manifest_relpath") == path:
if test_path.startswith(path) or manifest_relpath == path:
found_path = path
break
if found_path:

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

@ -2,6 +2,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import mozunit
import pytest
@ -54,6 +56,18 @@ def test_filter_tasks_by_paths(patch_resolver):
},
id="two tests",
),
pytest.param(
["test/xpcshell.ini"],
[
{
"flavor": "xpcshell",
"srcdir_relpath": "test/xpcshell.js",
"manifest_relpath": os.path.join("test", "xpcshell.ini"),
},
],
{"xpcshell": ["test/xpcshell.ini"]},
id="mismatched path separators",
),
),
)
def test_resolve_tests_by_suite(patch_resolver, input, tests, expected):