Bug 1257659 - Fix |mach try| on Windows by normalizing before comparing paths. r=mshal draft
authorChris Manchester <cmanchester@mozilla.com>
Fri, 18 Mar 2016 11:20:32 -0700
changeset 342230 66503c59f8e49ac7349c3c4c49b0758f919438d8
parent 341653 3e04659fdf6aef792f7cf9840189c6c38d08d1e8
child 516542 7773748274abfecc97efd6eaa73952fa578123b2
push id13374
push usercmanchester@mozilla.com
push dateFri, 18 Mar 2016 18:20:48 +0000
reviewersmshal
bugs1257659
milestone48.0a1
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
testing/mach_commands.py
--- 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)