[resultdb] Make suffixes more distinguishable

Test ids would get an uniform format between different kinds of tests:
prefix//test_id//suffix

 - prefix:
   - empty for regular tests
   - or 'special test' token, as in 'numfuzz'
 - test_id is the full name of the test as generated by test runner:
   - suite_name/path/to/actual/test_name
 - suffix is anything a test runner processor might want to add to the name:
   - numfuzz processor will add 'analysis' of a numeric value
   - variant processor will add the variant name

Bug: v8:13316
Change-Id: Ied8f958173f82d8e26c62e39ccc21167ca2928ab
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4084763
Commit-Queue: Liviu Rau <liviurau@google.com>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84736}
This commit is contained in:
Liviu Rau 2022-12-08 14:44:48 +01:00 committed by V8 LUCI CQ
parent ada6f41e91
commit 46efa1b1c8
6 changed files with 21 additions and 13 deletions

View File

@ -460,11 +460,18 @@ class TestCase(object):
def __str__(self):
return self.full_name
def test_suffixes(self):
suffixes = self.origin.test_suffixes() if self.origin else []
current_suffix = self.processor.test_suffix(self)
if current_suffix:
suffixes.append(str(current_suffix))
return suffixes
@property
def rdb_test_id(self):
rdb_id = self.origin.rdb_test_id if self.origin else self.full_name
rdb_id += self.processor.test_suffix(self)
return rdb_id
suffixes = '/'.join(self.test_suffixes())
full_suffix = ('//' + suffixes) if suffixes else ''
return self.full_name + full_suffix
@property
def processor_name(self):
@ -475,7 +482,7 @@ class DuckProcessor:
"""Dummy default processor for original tests implemented by duck-typing."""
def test_suffix(self, test):
return ''
return None
@property
def name(self):

View File

@ -31,14 +31,15 @@ class TestCaseTest(unittest.TestCase):
self.assertEqual(test.keep_output, False)
subtest = test.create_subtest(FakeProcessor(), 0, keep_output=True)
self.assertEqual(subtest.rdb_test_id, 'fakeSuite/parent/fakep/0')
self.assertEqual(subtest.rdb_test_id, 'fakeSuite/parent//fakep/0')
# provide by FakeProcessor
self.assertEqual(subtest.processor.name, 'fake_processor1')
self.assertEqual(subtest.procid, 'fakeSuite/parent.fake_processor1-0')
self.assertEqual(subtest.keep_output, True)
subsubtest = subtest.create_subtest(FakeProcessor(), 1)
self.assertEqual(subsubtest.rdb_test_id, 'fakeSuite/parent/fakep/0/fakep/1')
self.assertEqual(subsubtest.rdb_test_id,
'fakeSuite/parent//fakep/0/fakep/1')
# provide by FakeProcessor
self.assertEqual(subsubtest.processor.name, 'fake_processor2')
self.assertEqual(subsubtest.procid,
@ -68,7 +69,7 @@ class FakeProcessor:
return f'fake_processor{self.idx}'
def test_suffix(self, test):
return f'/fakep/{test.subtest_id}'
return f'fakep/{test.subtest_id}'
if __name__ == '__main__':

View File

@ -179,15 +179,15 @@ class StandardRunnerTest(TestRunnerTest):
)
self.assertEquals(len(records), 3)
self.assertEquals(records[0]['testId'], 'sweet/bananaflakes/stress')
self.assertEquals(records[0]['testId'], 'sweet/bananaflakes//stress')
self.assertEquals(tag_dict(records[0]['tags'])['run'], '1')
self.assertFalse(records[0]['expected'])
self.assertEquals(records[1]['testId'], 'sweet/bananaflakes/stress')
self.assertEquals(records[1]['testId'], 'sweet/bananaflakes//stress')
self.assertEquals(tag_dict(records[1]['tags'])['run'], '2')
self.assertTrue(records[1]['expected'])
self.assertEquals(records[2]['testId'], 'sweet/bananaflakes/default')
self.assertEquals(records[2]['testId'], 'sweet/bananaflakes//default')
self.assertEquals(tag_dict(records[2]['tags'])['run'], '1')
self.assertTrue(records[2]['expected'])

View File

@ -163,7 +163,7 @@ class TestProcProducer(TestProc):
def test_suffix(self, test):
"""Default implementation of rdb test id suffix generated by a producer"""
return ''
return None
class TestProcFilter(TestProc):

View File

@ -173,7 +173,7 @@ class FuzzerProc(base.TestProcProducer):
self._gens = {}
def test_suffix(self, test):
return '/' + test.subtest_id
return test.subtest_id
def _next_test(self, test):
if self.is_stopped:

View File

@ -29,7 +29,7 @@ class VariantProc(base.TestProcProducer):
self._variants = variants
def test_suffix(self, test):
return f'/{test.variant}'
return test.variant
def _next_test(self, test):
gen = self._variants_gen(test)