Skip to content

Commit bd7c1e7

Browse files
reconbotMylesBorins
authored andcommitted
tools: allow test.py to use full paths of tests
Allow test.py to run tests with a 'tests/' prefix or a '.js' postfix PR-URL: #9694 Fixes: #9684 Reviewed-By: Prince John Wesley <[email protected]> Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
1 parent 8a91616 commit bd7c1e7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tools/test.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def HasRun(self, output):
298298

299299
if output.HasCrashed():
300300
self.severity = 'crashed'
301-
exit_code = output.output.exit_code
301+
exit_code = output.output.exit_code
302302
self.traceback = "oh no!\nexit code: " + PrintCrashed(exit_code)
303303

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

1464+
def NormalizePath(path):
1465+
# strip the extra path information of the specified test
1466+
if path.startswith('test/'):
1467+
path = path[5:]
1468+
if path.endswith('.js'):
1469+
path = path[:-3]
1470+
return path
14641471

14651472
def GetSpecialCommandProcessor(value):
14661473
if (not value) or (value.find('@') == -1):
@@ -1534,7 +1541,7 @@ def Main():
15341541
else:
15351542
paths = [ ]
15361543
for arg in args:
1537-
path = SplitPath(arg)
1544+
path = SplitPath(NormalizePath(arg))
15381545
paths.append(path)
15391546

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

0 commit comments

Comments
 (0)