blob: ee05d34a4cbd19bd2db05694911ca626f6d2ff48 [file] [log] [blame]
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Log parsing for non-Telemetry tests that output data in HistogramSets.
This is specifically not meant for Telemetry tests, as those should all be using
the src-side scripts for dashboard uploading via the "merge script"
functionality. This is a temporary solution for non-Telemetry tests that still
use the build-side code for dashboard uploading.
This is based off telemetry_utils.TelemetryResultsProcessor.
import json
import logging
import os
import shutil
class HistogramResultsParser(object):
def __init__(self, filename, is_ref, cleanup_parent_dir):
self._histogram_filename = filename
self._is_reference_build = is_ref
self._cleanup_parent_dir = cleanup_parent_dir
def HistogramSet(self):
with open(self._histogram_filename) as f:
return json.load(f)
except (IOError, ValueError) as e:
logging.error('Error reading histogram results from %s',
logging.error('Given error is %s', e)
return None
def Cleanup(self):
except OSError as e:
logging.error('Unable to remove HistogramSet output file %s',
logging.error('Given error is %s', e)
if self._cleanup_parent_dir:
except OSError as e:
logging.error('Unable to remve output directory %s',
logging.error('Given error is %s', e)
def IsChartJson(self):
"""This is not the deprecated ChartJSON format."""
return False
def IsHistogramSet(self):
"""This is the newer HistogramSet format that replaces ChartJSON."""
return True
def HistogramFilename(self):
return self._histogram_filename
def IsReferenceBuild(self):
return self._is_reference_build
def ProcessLine(self, line):
def FailedTests(self):
return []
def MemoryToolReportHashes(self):
return []
def ParsingErrors(self):
return []
def PerformanceSummary(self):
return []