Bug 1257659 - Fix |mach try| on Windows by normalizing before comparing paths. r=mshal
We recently started posix-normalizing path separators for "topsrcdir", so
we need to posix-normalize our inputs before making comparisons.
MozReview-Commit-ID: 4qMy0swseND
--- a/testing/mach_commands.py
+++ b/testing/mach_commands.py
@@ -15,16 +15,17 @@ from collections import defaultdict
from mach.decorators import (
CommandArgument,
CommandProvider,
Command,
)
from mozbuild.base import MachCommandBase
from mozbuild.base import MachCommandConditions as conditions
+import mozpack.path as mozpath
from argparse import ArgumentParser
UNKNOWN_TEST = '''
I was unable to find tests from the given argument(s).
You should specify a test directory, filename, test suite name, or
abbreviation. If no arguments are given, there must be local file
changes and corresponding IMPACTED_TESTS annotations in moz.build
@@ -535,17 +536,17 @@ class PushToTry(MachCommandBase):
talos = (self.normalise_list(kwargs["talos"], allow_subitems=True)
if kwargs["talos"] else [])
except ValueError as e:
print("Error parsing -t argument:\n%s" % e.message)
sys.exit(1)
paths = []
for p in kwargs["paths"]:
- p = os.path.normpath(os.path.abspath(p))
+ p = mozpath.normpath(os.path.abspath(p))
if not (os.path.isdir(p) and p.startswith(self.topsrcdir)):
print('Specified path "%s" is not a directory under the srcdir,'
' unable to specify tests outside of the srcdir' % p)
sys.exit(1)
if len(p) <= len(self.topsrcdir):
print('Specified path "%s" is at the top of the srcdir and would'
' select all tests.' % p)
sys.exit(1)