Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Unified Diff: telemetry/telemetry/internal/results/results_options.py

Issue 1964663003: [telemetry] Add Html2OutputFormatter for generating results2.html (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: telemetry/telemetry/internal/results/results_options.py
diff --git a/telemetry/telemetry/internal/results/results_options.py b/telemetry/telemetry/internal/results/results_options.py
index e4386f6995b875e953ad1221b1f18ddf3817df17..c2484f72af99003b75cd10e83d7cb334f2be2dec 100644
--- a/telemetry/telemetry/internal/results/results_options.py
+++ b/telemetry/telemetry/internal/results/results_options.py
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import codecs
import optparse
import os
import sys
@@ -14,18 +15,20 @@ from telemetry.internal.results import chart_json_output_formatter
from telemetry.internal.results import csv_pivot_table_output_formatter
from telemetry.internal.results import gtest_progress_reporter
from telemetry.internal.results import html_output_formatter
+from telemetry.internal.results import html2_output_formatter
from telemetry.internal.results import json_output_formatter
from telemetry.internal.results import page_test_results
from telemetry.internal.results import progress_reporter
# Allowed output formats. The default is the first item in the list.
-_OUTPUT_FORMAT_CHOICES = ('html', 'buildbot', 'gtest', 'json',
+_OUTPUT_FORMAT_CHOICES = ('html', 'html2', 'buildbot', 'gtest', 'json',
'chartjson', 'csv-pivot-table', 'none')
# Filenames to use for given output formats.
_OUTPUT_FILENAME_LOOKUP = {
'html': 'results.html',
+ 'html2': 'results2.html',
'json': 'results.json',
'chartjson': 'results-chart.json',
'csv-pivot-table': 'results-pivot-table.csv'
@@ -95,11 +98,11 @@ def _GetOutputStream(output_format, output_dir):
output_file = os.path.join(output_dir, _OUTPUT_FILENAME_LOOKUP[output_format])
# TODO(eakuefner): Factor this hack out after we rewrite HTMLOutputFormatter.
- if output_format == 'html':
+ if output_format == 'html' or output_format == 'html2':
open(output_file, 'a').close() # Create file if it doesn't exist.
- return open(output_file, 'r+')
+ return codecs.open(output_file, 'r+', 'utf-8')
else:
- return open(output_file, 'w+')
+ return codecs.open(output_file, 'w+', 'utf-8')
def _GetProgressReporter(output_skipped_tests_summary, suppress_gtest_report):
@@ -146,6 +149,9 @@ def CreateResults(benchmark_metadata, options,
output_stream, benchmark_metadata, options.reset_results,
options.upload_results, options.browser_type,
options.results_label))
+ elif output_format == 'html2':
+ output_formatters.append(html2_output_formatter.Html2OutputFormatter(
+ output_stream, options.reset_results, options.upload_results))
elif output_format == 'json':
output_formatters.append(json_output_formatter.JsonOutputFormatter(
output_stream, benchmark_metadata))
« no previous file with comments | « telemetry/telemetry/internal/results/page_test_results.py ('k') | telemetry/telemetry/value/common_value_helpers.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698