Skip to content

Commit 373a9a8

Browse files
mi-acCommit Bot
authored andcommitted
[test] Switch to flattened json output
This flattens the json output to one result record as a dict. In the past several records with different arch/mode combinations could be run, but this is deprecated since several releases. We also drop storing the arch/mode information in the record as it isn't used on the infra side for anything. This was prepared on the infra side by: https://crrev.com/c/2453562 Bug: chromium:1132088 Change-Id: I944514dc00a671e7671bcdbcaa3a72407476d7ad Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2456987 Reviewed-by: Liviu Rau <[email protected]> Commit-Queue: Michael Achenbach <[email protected]> Cr-Commit-Position: refs/heads/master@{#70402}
1 parent 0ce4c51 commit 373a9a8

6 files changed

Lines changed: 8 additions & 33 deletions

File tree

tools/testrunner/base_runner.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117

118118

119119
ModeConfig = namedtuple(
120-
'ModeConfig', 'label flags timeout_scalefactor status_mode execution_mode')
120+
'ModeConfig', 'label flags timeout_scalefactor status_mode')
121121

122122
DEBUG_FLAGS = ["--nohard-abort", "--enable-slow-asserts", "--verify-heap"]
123123
RELEASE_FLAGS = ["--nohard-abort"]
@@ -127,15 +127,13 @@
127127
flags=DEBUG_FLAGS,
128128
timeout_scalefactor=4,
129129
status_mode="debug",
130-
execution_mode="debug",
131130
)
132131

133132
RELEASE_MODE = ModeConfig(
134133
label='release',
135134
flags=RELEASE_FLAGS,
136135
timeout_scalefactor=1,
137136
status_mode="release",
138-
execution_mode="release",
139137
)
140138

141139
# Normal trybot release configuration. There, dchecks are always on which
@@ -146,7 +144,6 @@
146144
flags=RELEASE_FLAGS,
147145
timeout_scalefactor=4,
148146
status_mode="debug",
149-
execution_mode="release",
150147
)
151148

152149
PROGRESS_INDICATORS = {
@@ -761,13 +758,7 @@ def _get_shard_info(self, options):
761758
def _create_progress_indicators(self, test_count, options):
762759
procs = [PROGRESS_INDICATORS[options.progress]()]
763760
if options.json_test_results:
764-
# TODO(machenbach): Deprecate the execution mode. Previously it was meant
765-
# to differentiate several records in the json output. But there is now
766-
# only one record and the mode information is redundant.
767-
procs.append(progress.JsonTestProgressIndicator(
768-
self.framework_name,
769-
self.build_config.arch,
770-
self.mode_options.execution_mode))
761+
procs.append(progress.JsonTestProgressIndicator(self.framework_name))
771762

772763
for proc in procs:
773764
proc.configure(options)

tools/testrunner/standard_runner.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,8 @@ def _duration_results_text(test):
364364
]
365365

366366
assert os.path.exists(options.json_test_results)
367-
complete_results = []
368367
with open(options.json_test_results, "r") as f:
369-
complete_results = json.loads(f.read())
370-
output = complete_results[0]
368+
output = json.load(f)
371369
lines = []
372370
for test in output['slowest_tests']:
373371
suffix = ''

tools/testrunner/testproc/progress.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def _clear_line(self, last_length):
349349

350350

351351
class JsonTestProgressIndicator(ProgressIndicator):
352-
def __init__(self, framework_name, arch, mode):
352+
def __init__(self, framework_name):
353353
super(JsonTestProgressIndicator, self).__init__()
354354
# We want to drop stdout/err for all passed tests on the first try, but we
355355
# need to get outputs for all runs after the first one. To accommodate that,
@@ -358,8 +358,6 @@ def __init__(self, framework_name, arch, mode):
358358
self._requirement = base.DROP_PASS_STDOUT
359359

360360
self.framework_name = framework_name
361-
self.arch = arch
362-
self.mode = mode
363361
self.results = []
364362
self.duration_sum = 0
365363
self.test_count = 0
@@ -429,24 +427,16 @@ def _test_record(self, test, result, output, run):
429427
}
430428

431429
def finished(self):
432-
complete_results = []
433-
if os.path.exists(self.options.json_test_results):
434-
with open(self.options.json_test_results, "r") as f:
435-
# On bots we might start out with an empty file.
436-
complete_results = json.loads(f.read() or "[]")
437-
438430
duration_mean = None
439431
if self.test_count:
440432
duration_mean = self.duration_sum / self.test_count
441433

442-
complete_results.append({
443-
"arch": self.arch,
444-
"mode": self.mode,
434+
result = {
445435
"results": self.results,
446436
"slowest_tests": self.tests.as_list(),
447437
"duration_mean": duration_mean,
448438
"test_total": self.test_count,
449-
})
439+
}
450440

451441
with open(self.options.json_test_results, "w") as f:
452-
f.write(json.dumps(complete_results))
442+
json.dump(result, f)

tools/unittests/run_tests_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def check_cleaned_json_output(
246246
self, expected_results_name, actual_json, basedir):
247247
# Check relevant properties of the json output.
248248
with open(actual_json) as f:
249-
json_output = json.load(f)[0]
249+
json_output = json.load(f)
250250

251251
# Replace duration in actual output as it's non-deterministic. Also
252252
# replace the python executable prefix as it has a different absolute

tools/unittests/testdata/expected_test_results1.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{
2-
"arch": "x64",
32
"duration_mean": 1,
4-
"mode": "release",
53
"results": [
64
{
75
"command": "/usr/bin/python out/build/d8_mocked.py --test strawberries --random-seed=123 --nohard-abort --testing-d8-test-runner",

tools/unittests/testdata/expected_test_results2.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{
2-
"arch": "x64",
32
"duration_mean": 1,
4-
"mode": "release",
53
"results": [
64
{
75
"command": "/usr/bin/python out/build/d8_mocked.py bananaflakes --random-seed=123 --nohard-abort --testing-d8-test-runner",

0 commit comments

Comments
 (0)