| OLD | NEW |
| (Empty) | |
| 1 #! /usr/bin/env python |
| 2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 # pylint: disable=R0201 |
| 6 |
| 7 """Log parsing for telemetry tests.""" |
| 8 |
| 9 import json |
| 10 import logging |
| 11 import os |
| 12 import tempfile |
| 13 |
| 14 |
| 15 class TelemetryResultsTracker(object): |
| 16 |
| 17 def __init__(self): |
| 18 self._chart_filename = None |
| 19 self._ref_chart_filename = None |
| 20 |
| 21 def GetArguments(self): |
| 22 if not self._chart_filename: |
| 23 (handle, self._chart_filename) = tempfile.mkstemp() |
| 24 os.close(handle) |
| 25 if not self._ref_chart_filename: |
| 26 (handle, self._ref_chart_filename) = tempfile.mkstemp() |
| 27 os.close(handle) |
| 28 return (['--chart-output-filename', self._chart_filename, |
| 29 '--ref-output-filename', self._ref_chart_filename]) |
| 30 |
| 31 def _GetFileJson(self, filename): |
| 32 try: |
| 33 return json.loads(open(filename).read()) |
| 34 except (IOError, ValueError): |
| 35 logging.error('Error reading telemetry results from %s', filename) |
| 36 return None |
| 37 |
| 38 def ChartJson(self): |
| 39 return self._GetFileJson(self._chart_filename) |
| 40 |
| 41 def RefJson(self): |
| 42 return self._GetFileJson(self._ref_chart_filename) |
| 43 |
| 44 def Cleanup(self): |
| 45 try: |
| 46 os.remove(self._chart_filename) |
| 47 except OSError: |
| 48 pass |
| 49 try: |
| 50 os.remove(self._ref_chart_filename) |
| 51 except OSError: |
| 52 pass |
| 53 |
| 54 def IsChartJson(self): |
| 55 """This is the new telemetry --chartjson output format.""" |
| 56 return True |
| 57 |
| 58 def ProcessLine(self, line): |
| 59 pass |
| 60 |
| 61 def FailedTests(self): |
| 62 return [] |
| 63 |
| 64 def SuppressionHashes(self): # pylint: disable=R0201 |
| 65 return [] |
| 66 |
| 67 def ParsingErrors(self): # pylint: disable=R0201 |
| 68 return [] |
| 69 |
| 70 def PerformanceSummary(self): |
| 71 return '' |
| OLD | NEW |