Bug 982560 - Fix mach fails to find tests in subdirectory. r=gps

Make the test paths relative to topsrcdir before passing them to
TestResolver. Also do not passing cwd to TestResolver since it will
filter out tests that do not live under the directory where the mach
command is executed.

Verification steps:
Execute a mach test command from any subdirectory. For example:
$ cd testing/tps/
$ ../../mach xpcshell-test ../../services/fxaccounts/tests/xpcshell/
$ ../../mach test ../../services/fxaccounts/tests/xpcshell/
This commit is contained in:
Ting-Yu Lin 2014-07-01 23:21:00 +02:00
parent eee06f2917
commit dea8ddcd04
3 changed files with 6 additions and 5 deletions

View File

@ -190,8 +190,8 @@ class Test(MachCommandBase):
continue
# Now look for file/directory matches in the TestResolver.
tests = list(resolver.resolve_tests(paths=[entry],
cwd=self._mach_context.cwd))
relpath = self._wrap_path_argument(entry).relpath()
tests = list(resolver.resolve_tests(paths=[relpath]))
run_tests.extend(tests)
if not tests:

View File

@ -338,8 +338,7 @@ class MochitestRunner(MozbuildObject):
if test_paths:
resolver = self._spawn(TestResolver)
tests = list(resolver.resolve_tests(paths=test_paths, flavor=flavor,
cwd=context.cwd))
tests = list(resolver.resolve_tests(paths=test_paths, flavor=flavor))
if not tests:
print('No tests could be found in the path specified. Please '

View File

@ -87,13 +87,15 @@ class XPCShellRunner(MozbuildObject):
debuggerInteractive=debuggerInteractive,
rerun_failures=rerun_failures)
return
elif test_paths:
test_paths = [self._wrap_path_argument(p).relpath() for p in test_paths]
if test_objects:
tests = test_objects
else:
resolver = self._spawn(TestResolver)
tests = list(resolver.resolve_tests(paths=test_paths,
flavor='xpcshell', cwd=self.cwd))
flavor='xpcshell'))
if not tests:
raise InvalidTestPathError('We could not find an xpcshell test '