Skip to content

Commit

Permalink
tools: allow test.py to use full paths of tests
Browse files Browse the repository at this point in the history
Allow test.py to run tests with a 'tests/' prefix or a '.js' postfix

Fixes: #9684
  • Loading branch information
reconbot committed Nov 20, 2016
1 parent 6df167c commit ddcbcf1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def HasRun(self, output):

if output.HasCrashed():
self.severity = 'crashed'
exit_code = output.output.exit_code
exit_code = output.output.exit_code
self.traceback = "oh no!\nexit code: " + PrintCrashed(exit_code)

if output.HasTimedOut():
Expand Down Expand Up @@ -1461,6 +1461,13 @@ def SplitPath(s):
stripped = [ c.strip() for c in s.split('/') ]
return [ Pattern(s) for s in stripped if len(s) > 0 ]

def NormalizePath(path):
# strip the extra path information of the specified test
if path.startswith('test/'):
path = path[5:]
if path.endswith('.js'):
path = path[:-3]
return path

def GetSpecialCommandProcessor(value):
if (not value) or (value.find('@') == -1):
Expand Down Expand Up @@ -1534,7 +1541,7 @@ def Main():
else:
paths = [ ]
for arg in args:
path = SplitPath(arg)
path = SplitPath(NormalizePath(arg))
paths.append(path)

# Check for --valgrind option. If enabled, we overwrite the special
Expand Down

0 comments on commit ddcbcf1

Please sign in to comment.