[tools] Fix run_perf.py --filter=<regexp>

In the previous refactoring --filter was accidentally filtering out
paths that matched <regexp>. This CL restores the original behavior
where only the matching paths are kept.

Bug: v8:12821, v8:11113
Change-Id: I7e7d7b793107fbf9b4944b1674874150803f4bb4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3623539
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80426}
This commit is contained in:
Camillo Bruni 2022-05-09 14:34:41 +02:00 committed by V8 LUCI CQ
parent cba1501d70
commit 46ca99766c
2 changed files with 32 additions and 1 deletions

View File

@ -1241,7 +1241,7 @@ def Main(argv):
try:
for runnable in FlattenRunnables(root, NodeCB):
runnable_name = '/'.join(runnable.graphs)
if args.filter and args.filter.search(runnable_name):
if args.filter and not args.filter.match(runnable_name):
logging.info('Skipping suite "%s" due to filter', runnable_name)
continue
logging.info('>>> Running suite: %s', runnable_name)

View File

@ -583,6 +583,37 @@ class PerfTest(unittest.TestCase):
self._VerifyMock(
os.path.join('out', 'x64.release', 'd7'), '--flag', 'run.js')
def testFilterInvalidRegexp(self):
self._WriteTestInput(V8_JSON)
self._MockCommand(['.'], ['x\nRichards: 1.234\nDeltaBlue: 10657567\ny\n'])
self.assertNotEqual(0, self._CallMain("--filter=((("))
self._VerifyMock(os.path.join('out', 'Release', 'd7'), '--flag', 'run.js')
def testFilterRegexpMatchAll(self):
self._WriteTestInput(V8_JSON)
self._MockCommand(['.'], ['x\nRichards: 1.234\nDeltaBlue: 10657567\ny\n'])
self.assertEqual(0, self._CallMain("--filter=test"))
self._VerifyResults('test', 'score', [
{
'name': 'Richards',
'results': [1.234],
'stddev': ''
},
{
'name': 'DeltaBlue',
'results': [10657567.0],
'stddev': ''
},
])
self._VerifyMock(
os.path.join('out', 'x64.release', 'd7'), '--flag', 'run.js')
def testFilterRegexpSkipAll(self):
self._WriteTestInput(V8_JSON)
self._MockCommand(['.'], ['x\nRichards: 1.234\nDeltaBlue: 10657567\ny\n'])
self.assertEqual(0, self._CallMain("--filter=NonExistingName"))
self._VerifyResults('test', 'score', [])
def testOneRunCrashed(self):
test_input = dict(V8_JSON)
test_input['retry_count'] = 1