OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Base classes for a test and validator which upload results | 5 """Base classes for a test and validator which upload results |
6 (reference images, error images) to cloud storage.""" | 6 (reference images, error images) to cloud storage.""" |
7 | 7 |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 class ValidatorBase(gpu_test_base.ValidatorBase): | 90 class ValidatorBase(gpu_test_base.ValidatorBase): |
91 def __init__(self): | 91 def __init__(self): |
92 super(ValidatorBase, self).__init__() | 92 super(ValidatorBase, self).__init__() |
93 # Parameters for cloud storage reference images. | 93 # Parameters for cloud storage reference images. |
94 self.vendor_id = None | 94 self.vendor_id = None |
95 self.device_id = None | 95 self.device_id = None |
96 self.vendor_string = None | 96 self.vendor_string = None |
97 self.device_string = None | 97 self.device_string = None |
98 self.msaa = False | 98 self.msaa = False |
| 99 self.model_name = None |
99 | 100 |
100 ### | 101 ### |
101 ### Routines working with the local disk (only used for local | 102 ### Routines working with the local disk (only used for local |
102 ### testing without a cloud storage account -- the bots do not use | 103 ### testing without a cloud storage account -- the bots do not use |
103 ### this code path). | 104 ### this code path). |
104 ### | 105 ### |
105 | 106 |
106 def _UrlToImageName(self, url): | 107 def _UrlToImageName(self, url): |
107 image_name = re.sub(r'^(http|https|file)://(/*)', '', url) | 108 image_name = re.sub(r'^(http|https|file)://(/*)', '', url) |
108 image_name = re.sub(r'\.\./', '', image_name) | 109 image_name = re.sub(r'\.\./', '', image_name) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 else: | 159 else: |
159 raise Exception('GPU device information was incomplete') | 160 raise Exception('GPU device information was incomplete') |
160 # TODO(senorblanco): This should probably be checking | 161 # TODO(senorblanco): This should probably be checking |
161 # for the presence of the extensions in system_info.gpu_aux_attributes | 162 # for the presence of the extensions in system_info.gpu_aux_attributes |
162 # in order to check for MSAA, rather than sniffing the blacklist. | 163 # in order to check for MSAA, rather than sniffing the blacklist. |
163 self.msaa = not ( | 164 self.msaa = not ( |
164 ('disable_chromium_framebuffer_multisample' in | 165 ('disable_chromium_framebuffer_multisample' in |
165 system_info.gpu.driver_bug_workarounds) or | 166 system_info.gpu.driver_bug_workarounds) or |
166 ('disable_multisample_render_to_texture' in | 167 ('disable_multisample_render_to_texture' in |
167 system_info.gpu.driver_bug_workarounds)) | 168 system_info.gpu.driver_bug_workarounds)) |
| 169 self.model_name = system_info.model_name |
168 | 170 |
169 def _FormatGpuInfo(self, tab): | 171 def _FormatGpuInfo(self, tab): |
170 self._ComputeGpuInfo(tab) | 172 self._ComputeGpuInfo(tab) |
171 msaa_string = '_msaa' if self.msaa else '_non_msaa' | 173 msaa_string = '_msaa' if self.msaa else '_non_msaa' |
172 if self.vendor_id: | 174 if self.vendor_id: |
173 return '%s_%04x_%04x%s' % ( | 175 return '%s_%04x_%04x%s' % ( |
174 self.options.os_type, self.vendor_id, self.device_id, msaa_string) | 176 self.options.os_type, self.vendor_id, self.device_id, msaa_string) |
175 else: | 177 else: |
176 return '%s_%s_%s%s' % ( | 178 # This is the code path for Android devices. Include the model |
| 179 # name (e.g. "Nexus 9") in the GPU string to disambiguate |
| 180 # multiple devices on the waterfall which might have the same |
| 181 # device string ("NVIDIA Tegra") but different screen |
| 182 # resolutions and device pixel ratios. |
| 183 return '%s_%s_%s_%s%s' % ( |
177 self.options.os_type, self.vendor_string, self.device_string, | 184 self.options.os_type, self.vendor_string, self.device_string, |
178 msaa_string) | 185 self.model_name, msaa_string) |
179 | 186 |
180 def _FormatReferenceImageName(self, img_name, page, tab): | 187 def _FormatReferenceImageName(self, img_name, page, tab): |
181 return '%s_v%s_%s.png' % ( | 188 return '%s_v%s_%s.png' % ( |
182 img_name, | 189 img_name, |
183 page.revision, | 190 page.revision, |
184 self._FormatGpuInfo(tab)) | 191 self._FormatGpuInfo(tab)) |
185 | 192 |
186 def _UploadBitmapToCloudStorage(self, bucket, name, bitmap, public=False): | 193 def _UploadBitmapToCloudStorage(self, bucket, name, bitmap, public=False): |
187 # This sequence of steps works on all platforms to write a temporary | 194 # This sequence of steps works on all platforms to write a temporary |
188 # PNG to disk, following the pattern in bitmap_unittest.py. The key to | 195 # PNG to disk, following the pattern in bitmap_unittest.py. The key to |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 default='') | 300 default='') |
294 group.add_option('--test-machine-name', | 301 group.add_option('--test-machine-name', |
295 help='Name of the test machine. Specifying this argument causes this ' | 302 help='Name of the test machine. Specifying this argument causes this ' |
296 'script to upload failure images and diffs to cloud storage directly, ' | 303 'script to upload failure images and diffs to cloud storage directly, ' |
297 'instead of relying on the archive_gpu_pixel_test_results.py script.', | 304 'instead of relying on the archive_gpu_pixel_test_results.py script.', |
298 default='') | 305 default='') |
299 group.add_option('--generated-dir', | 306 group.add_option('--generated-dir', |
300 help='Overrides the default on-disk location for generated test images ' | 307 help='Overrides the default on-disk location for generated test images ' |
301 '(only used for local testing without a cloud storage account)', | 308 '(only used for local testing without a cloud storage account)', |
302 default=default_generated_data_dir) | 309 default=default_generated_data_dir) |
OLD | NEW |