| OLD | NEW |
| 1 # Copyright (c) 2009, Google Inc. All rights reserved. | 1 # Copyright (c) 2009, Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 @memoized | 79 @memoized |
| 80 def fetch_retry_summary_json(self, build): | 80 def fetch_retry_summary_json(self, build): |
| 81 """Fetches and returns the text of the archived retry_summary file. | 81 """Fetches and returns the text of the archived retry_summary file. |
| 82 | 82 |
| 83 This file is expected to contain the results of retrying layout tests | 83 This file is expected to contain the results of retrying layout tests |
| 84 with and without a patch in a try job. It includes lists of tests | 84 with and without a patch in a try job. It includes lists of tests |
| 85 that failed only with the patch ("failures"), and tests that failed | 85 that failed only with the patch ("failures"), and tests that failed |
| 86 both with and without ("ignored"). | 86 both with and without ("ignored"). |
| 87 """ | 87 """ |
| 88 url_base = "%s/%s" % (self.builder_results_url_base(build.builder_name),
build.build_number) | 88 url_base = "%s/%s" % (self.builder_results_url_base(build.builder_name),
build.build_number) |
| 89 return NetworkTransaction(convert_404_to_None=True).run( | 89 return NetworkTransaction(return_none_on_404=True).run( |
| 90 lambda: self._fetch_file(url_base, "retry_summary.json")) | 90 lambda: self._fetch_file(url_base, "retry_summary.json")) |
| 91 | 91 |
| 92 def accumulated_results_url_base(self, builder_name): | 92 def accumulated_results_url_base(self, builder_name): |
| 93 return self.builder_results_url_base(builder_name) + "/results/layout-te
st-results" | 93 return self.builder_results_url_base(builder_name) + "/results/layout-te
st-results" |
| 94 | 94 |
| 95 @memoized | 95 @memoized |
| 96 def latest_layout_test_results(self, builder_name): | 96 def latest_layout_test_results(self, builder_name): |
| 97 return self.fetch_layout_test_results(self.accumulated_results_url_base(
builder_name)) | 97 return self.fetch_layout_test_results(self.accumulated_results_url_base(
builder_name)) |
| 98 | 98 |
| 99 @memoized | 99 @memoized |
| 100 def fetch_results(self, build): | 100 def fetch_results(self, build): |
| 101 return self.fetch_layout_test_results(self.results_url(build.builder_nam
e, build.build_number)) | 101 return self.fetch_layout_test_results(self.results_url(build.builder_nam
e, build.build_number)) |
| 102 | 102 |
| 103 @memoized | 103 @memoized |
| 104 def fetch_layout_test_results(self, results_url): | 104 def fetch_layout_test_results(self, results_url): |
| 105 """Returns a LayoutTestResults object for results fetched from a given U
RL.""" | 105 """Returns a LayoutTestResults object for results fetched from a given U
RL.""" |
| 106 results_file = NetworkTransaction(convert_404_to_None=True).run( | 106 results_file = NetworkTransaction(return_none_on_404=True).run( |
| 107 lambda: self._fetch_file(results_url, "failing_results.json")) | 107 lambda: self._fetch_file(results_url, "failing_results.json")) |
| 108 revision = NetworkTransaction(convert_404_to_None=True).run( | 108 revision = NetworkTransaction(return_none_on_404=True).run( |
| 109 lambda: self._fetch_file(results_url, "LAST_CHANGE")) | 109 lambda: self._fetch_file(results_url, "LAST_CHANGE")) |
| 110 if not revision: | 110 if not revision: |
| 111 results_file = None | 111 results_file = None |
| 112 return LayoutTestResults.results_from_string(results_file, revision) | 112 return LayoutTestResults.results_from_string(results_file, revision) |
| 113 | 113 |
| 114 def _fetch_file(self, url_base, file_name): | 114 def _fetch_file(self, url_base, file_name): |
| 115 # It seems this can return None if the url redirects and then returns 40
4. | 115 # It seems this can return None if the url redirects and then returns 40
4. |
| 116 # FIXME: This could use Web instead of using urllib2 directly. | 116 # FIXME: This could use Web instead of using urllib2 directly. |
| 117 result = urllib2.urlopen("%s/%s" % (url_base, file_name)) | 117 result = urllib2.urlopen("%s/%s" % (url_base, file_name)) |
| 118 if not result: | 118 if not result: |
| 119 return None | 119 return None |
| 120 # urlopen returns a file-like object which sometimes works fine with str
() | 120 # urlopen returns a file-like object which sometimes works fine with str
() |
| 121 # but sometimes is a addinfourl object. In either case calling read() i
s correct. | 121 # but sometimes is a addinfourl object. In either case calling read() i
s correct. |
| 122 return result.read() | 122 return result.read() |
| OLD | NEW |