Chromium Code Reviews| Index: appengine/findit/waterfall/buildbot.py |
| diff --git a/appengine/findit/waterfall/buildbot.py b/appengine/findit/waterfall/buildbot.py |
| index 28d39db4ab0f9ee9d9348adb02abe0da31398105..01fe884316cf9415c7d217bb589380190b6999e9 100644 |
| --- a/appengine/findit/waterfall/buildbot.py |
| +++ b/appengine/findit/waterfall/buildbot.py |
| @@ -2,11 +2,15 @@ |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| +import contextlib |
| from datetime import datetime |
| +import gzip |
| import json |
| import re |
| import urllib |
| +import cloudstorage as gcs |
| + |
| from waterfall.build_info import BuildInfo |
| _MASTER_URL_PATTERN = re.compile(r'^https?://build\.chromium\.org/p/([^/]+)' |
| @@ -97,7 +101,12 @@ def CreateStdioLogUrl(master_name, builder_name, build_number, step_name): |
| master_name, builder_name, build_number, step_name) |
| -def GetBuildDataFromBuildMaster(master_name, |
| +def CreateGtestResultPath(master_name, builder_name, build_number, step_name): |
| + return ('/chrome-gtest-results/buildbot/%s/%s/%s/%s.json.gz') % ( |
| + master_name, builder_name, build_number, step_name) |
| + |
| + |
| +def GetBuildDataFromBuildMaster(master_name, |
| builder_name, build_number, http_client): |
| """Returns the json-format data of the build from buildbot json API.""" |
| status_code, data = http_client.Get( |
| @@ -108,7 +117,7 @@ def GetBuildDataFromBuildMaster(master_name, |
| return data |
| -def GetBuildDataFromArchive(master_name, |
| +def GetBuildDataFromArchive(master_name, |
| builder_name, build_number, http_client): |
| """Returns the json-format data of the build from build archive.""" |
| status_code, data = http_client.Get( |
| @@ -130,6 +139,20 @@ def GetStepStdio(master_name, builder_name, build_number, |
| return data |
| +def GetGtestResultLog(master_name, |
| + builder_name, build_number, step_name): # pragma: no cover |
|
stgao
2015/05/22 22:49:42
style: parameter indent.
chanli
2015/05/22 23:26:32
Done.
|
| + """Returns the content of the gtest json results for the gtest-based step.""" |
| + try: |
| + with contextlib.closing(gcs.open(CreateGtestResultPath( |
| + master_name, builder_name, |
| + build_number, step_name))) as gtest_result_file: |
| + with contextlib.closing(gzip.open( |
| + gtest_result_file)) as unzipped_gtest_result_file: |
| + return unzipped_gtest_result_file.read() |
| + except gcs.NotFoundError: |
| + return None |
| + |
| + |
| def GetStepResult(step_data_json): |
| """Returns the result of a step.""" |
| result = step_data_json.get('results') |