Skip to content

Commit 561b149

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: #9694Fixes: #9684 Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
1 parent 16af467 commit 561b149

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎tools/test.py‎

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

299299
ifoutput.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
ifoutput.HasTimedOut():
@@ -1461,6 +1461,13 @@ def SplitPath(s):
14611461
stripped= [ c.strip() forcins.split('/') ]
14621462
return [ Pattern(s) forsinstrippediflen(s) >0 ]
14631463

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

14651472
defGetSpecialCommandProcessor(value):
14661473
if (notvalue) or (value.find('@') ==-1):
@@ -1534,7 +1541,7 @@ def Main():
15341541
else:
15351542
paths= [ ]
15361543
forarginargs:
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)