Bug 1233506 - Only accept positional arguments to mach try that are directories. r=jgraham
--- a/testing/mach_commands.py
+++ b/testing/mach_commands.py
@@ -528,19 +528,19 @@ class PushToTry(MachCommandBase):
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))
- if not p.startswith(self.topsrcdir):
- print('Specified path "%s" is outside of the srcdir, unable to'
- ' specify tests outside of the srcdir' % 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)
paths.append(os.path.relpath(p, self.topsrcdir))
try: