[resultdb] Add framework_name tag to ResultDB

Drive by: refactor framework_name propagation. The property was already injected in the TestSuite objects. Since it finally got attached to the result record it was natural to have it attached on the TestCase object at creation time. This eliminates the need to inject it through progress objects.

Change-Id: Ic4028d24589a241fb6225dc53ccef2215728d569
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4079228
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Liviu Rau <liviurau@google.com>
Cr-Commit-Position: refs/heads/main@{#84670}
This commit is contained in:
Liviu Rau 2022-12-05 17:18:43 +01:00 committed by V8 LUCI CQ
parent fd9bc064b2
commit 7f0c9d299e
7 changed files with 13 additions and 13 deletions

View File

@ -115,8 +115,9 @@ class TestLoader(object):
def _create_test(self, path, suite, **kwargs):
"""Converts paths into test objects using the given options"""
return self.test_class(
suite, path, self._path_to_name(path), self.test_config, **kwargs)
return self.test_class(suite, path, self._path_to_name(path),
self.test_config, self.suite.framework_name,
**kwargs)
def list_tests(self):
"""Loads and returns the test objects for a TestSuite"""

View File

@ -155,8 +155,7 @@ class NumFuzzer(base_runner.BaseTestRunner):
results = ResultsTracker.create(self.options)
execproc = ExecutionProc(ctx, self.options.j)
sigproc = self._create_signal_proc()
progress = ProgressProc(ctx, self.options, self.framework_name,
tests.test_count_estimate)
progress = ProgressProc(ctx, self.options, tests.test_count_estimate)
procs = [
loader,
NameFilterProc(args) if args else None,

View File

@ -78,7 +78,8 @@ def read_file(file):
return f.read()
class TestCase(object):
def __init__(self, suite, path, name, test_config):
def __init__(self, suite, path, name, test_config, framework_name):
self.suite = suite # TestSuite object
self.path = path # string, e.g. 'div-mod', 'test-api/foo'
@ -104,6 +105,8 @@ class TestCase(object):
self._statusfile_flags = None
self.expected_failure_reason = None
self.framework_name = framework_name
self._prepare_outcomes()
def create_subtest(self, processor, subtest_id, variant=None, flags=None,

View File

@ -294,8 +294,7 @@ class StandardTestRunner(base_runner.BaseTestRunner):
outproc_factory = predictable.get_outproc
execproc = ExecutionProc(ctx, jobs, outproc_factory)
sigproc = self._create_signal_proc()
progress = ProgressProc(ctx, self.options, self.framework_name,
tests.test_count_estimate)
progress = ProgressProc(ctx, self.options, tests.test_count_estimate)
procs = [
loader,
NameFilterProc(args) if args else None,

View File

@ -366,7 +366,7 @@ class StackParser:
class JsonTestProgressIndicator(ProgressIndicator):
def __init__(self, context, options, test_count, framework_name):
def __init__(self, context, options, test_count):
super(JsonTestProgressIndicator, self).__init__(context, options,
test_count)
self.tests = util.FixedSizeTopList(
@ -377,7 +377,6 @@ class JsonTestProgressIndicator(ProgressIndicator):
# keep_output set to True in the RerunProc.
self._requirement = base.DROP_PASS_STDOUT
self.framework_name = framework_name
self.results = []
self.duration_sum = 0
self.test_count = 0
@ -434,7 +433,6 @@ class JsonTestProgressIndicator(ProgressIndicator):
def _test_record(self, test, result, run):
record = util.base_test_record(test, result, run)
record.update(
framework_name=self.framework_name,
command=result.cmd.to_string(relative=True),
)
return record

View File

@ -57,7 +57,7 @@ class ResultsTracker(base.TestProcObserver):
class ProgressProc(base.TestProcObserver):
def __init__(self, context, options, framework_name, test_count):
def __init__(self, context, options, test_count):
super(ProgressProc, self).__init__()
self.procs = [
PROGRESS_INDICATORS[options.progress](context, options, test_count)
@ -65,8 +65,7 @@ class ProgressProc(base.TestProcObserver):
if options.json_test_results:
self.procs.insert(
0,
JsonTestProgressIndicator(context, options, test_count,
framework_name))
JsonTestProgressIndicator(context, options, test_count))
sink = rdb_sink()
if sink:
self.procs.append(ResultDBIndicator(context, options, test_count, sink))

View File

@ -64,6 +64,7 @@ def base_test_record(test, result, run):
'target_name': test.get_shell(),
'variant': test.variant,
'variant_flags': test.variant_flags,
'framework_name': test.framework_name,
}
if result.output:
record.update(