Commit 5538c878 authored by Steven Bennetts's avatar Steven Bennetts Committed by Commit Bot

Add process_perf_results.py to disk_usage_tast_test's merge script v2

Bug: 1047454
Change-Id: I9cd74e14d66ed9018c48dee4c711e85c456c1610
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2044874
Commit-Queue: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarBen Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743190}
parent 69e064cc
......@@ -11,6 +11,7 @@ import logging
import os
import pipes
import re
import shutil
import signal
import socket
import sys
......@@ -371,6 +372,7 @@ class TastTest(RemoteTest):
base_result = base_test_result.BaseTestResult(
test['name'], result, duration=duration_ms, log=error_log)
suite_results.AddResult(base_result)
self._maybe_handle_perf_results(test['name'])
if self._test_launcher_summary_output:
with open(self._test_launcher_summary_output, 'w') as f:
......@@ -385,6 +387,38 @@ class TastTest(RemoteTest):
return return_code
return 0
def _maybe_handle_perf_results(self, test_name):
"""Prepares any perf results from |test_name| for process_perf_results.
- process_perf_results looks for top level directories containing a
perf_results.json file and a test_results.json file. The directory names
are used as the benchmark names.
- If a perf_results.json or results-chart.json file exists in the
|test_name| results directory, a top level directory is created and the
perf results file is copied to perf_results.json.
- A trivial test_results.json file is also created to indicate that the test
succeeded (this function would not be called otherwise).
- When process_perf_results is run, it will find the expected files in the
named directory and upload the benchmark results.
"""
perf_results = os.path.join(self._logs_dir, 'tests', test_name,
'perf_results.json')
# TODO(stevenjb): Remove check for crosbolt results-chart.json file.
if not os.path.exists(perf_results):
perf_results = os.path.join(self._logs_dir, 'tests', test_name,
'results-chart.json')
if os.path.exists(perf_results):
benchmark_dir = os.path.join(self._logs_dir, test_name)
if not os.path.isdir(benchmark_dir):
os.makedirs(benchmark_dir)
shutil.copyfile(perf_results,
os.path.join(benchmark_dir, 'perf_results.json'))
# process_perf_results.py expects a test_results.json file.
test_results = {'valid': True, 'failures': []}
with open(os.path.join(benchmark_dir, 'test_results.json'), 'w') as out:
json.dump(test_results, out)
class GTestTest(RemoteTest):
......
......@@ -170,8 +170,7 @@
},
{
"merge": {
"args": [],
"script": "//testing/merge_scripts/standard_gtest_merge.py"
"script": "//tools/perf/process_perf_results.py"
},
"swarming": {
"can_use_on_swarming_builders": true,
......@@ -658,8 +657,7 @@
},
{
"merge": {
"args": [],
"script": "//testing/merge_scripts/standard_gtest_merge.py"
"script": "//tools/perf/process_perf_results.py"
},
"swarming": {
"can_use_on_swarming_builders": true,
......@@ -751,8 +749,7 @@
},
{
"merge": {
"args": [],
"script": "//testing/merge_scripts/standard_gtest_merge.py"
"script": "//tools/perf/process_perf_results.py"
},
"swarming": {
"can_use_on_swarming_builders": true,
......@@ -847,8 +844,7 @@
},
{
"merge": {
"args": [],
"script": "//testing/merge_scripts/standard_gtest_merge.py"
"script": "//tools/perf/process_perf_results.py"
},
"swarming": {
"can_use_on_swarming_builders": true,
......
......@@ -175,8 +175,7 @@
},
{
"merge": {
"args": [],
"script": "//testing/merge_scripts/standard_gtest_merge.py"
"script": "//tools/perf/process_perf_results.py"
},
"swarming": {
"can_use_on_swarming_builders": true,
......@@ -702,8 +701,7 @@
},
{
"merge": {
"args": [],
"script": "//testing/merge_scripts/standard_gtest_merge.py"
"script": "//tools/perf/process_perf_results.py"
},
"swarming": {
"can_use_on_swarming_builders": true,
......
......@@ -416,6 +416,9 @@
},
'cros_browser_sanity_test': {},
'disk_usage_tast_test': {
'merge': {
'script': '//tools/perf/process_perf_results.py',
},
'swarming': {
'idempotent': False, # https://crbug.com/923426#c27
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment