| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Module that combines JSON summaries and outputs the summaries in HTML.""" | 6 """Module that combines JSON summaries and outputs the summaries in HTML.""" |
| 7 | 7 |
| 8 import glob | 8 import glob |
| 9 import json | 9 import json |
| 10 import optparse | 10 import optparse |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 TOTAL_FAILING_FILES_TEMPLATE_VAR = 'failing_files_count' | 37 TOTAL_FAILING_FILES_TEMPLATE_VAR = 'failing_files_count' |
| 38 GS_FILES_LOCATION_NO_PATCH_TEMPLATE_VAR = 'gs_http_files_location_nopatch' | 38 GS_FILES_LOCATION_NO_PATCH_TEMPLATE_VAR = 'gs_http_files_location_nopatch' |
| 39 GS_FILES_LOCATION_WITH_PATCH_TEMPLATE_VAR = 'gs_http_files_location_withpatch' | 39 GS_FILES_LOCATION_WITH_PATCH_TEMPLATE_VAR = 'gs_http_files_location_withpatch' |
| 40 GS_FILES_LOCATION_DIFFS_TEMPLATE_VAR = 'gs_http_files_location_diffs' | 40 GS_FILES_LOCATION_DIFFS_TEMPLATE_VAR = 'gs_http_files_location_diffs' |
| 41 GS_FILES_LOCATION_WHITE_DIFFS_TEMPLATE_VAR = 'gs_http_files_location_whitediffs' | 41 GS_FILES_LOCATION_WHITE_DIFFS_TEMPLATE_VAR = 'gs_http_files_location_whitediffs' |
| 42 | 42 |
| 43 | 43 |
| 44 class FileInfo(object): | 44 class FileInfo(object): |
| 45 """Container class that holds all file data.""" | 45 """Container class that holds all file data.""" |
| 46 def __init__(self, file_name, skp_location, num_pixels_differing, | 46 def __init__(self, file_name, skp_location, num_pixels_differing, |
| 47 percent_pixels_differing, weighted_diff_measure, | 47 percent_pixels_differing, |
| 48 max_diff_per_channel, perceptual_diff): | 48 max_diff_per_channel, perceptual_diff): |
| 49 self.file_name = file_name | 49 self.file_name = file_name |
| 50 self.diff_file_name = _GetDiffFileName(self.file_name) | 50 self.diff_file_name = _GetDiffFileName(self.file_name) |
| 51 self.skp_location = skp_location | 51 self.skp_location = skp_location |
| 52 self.num_pixels_differing = num_pixels_differing | 52 self.num_pixels_differing = num_pixels_differing |
| 53 self.percent_pixels_differing = percent_pixels_differing | 53 self.percent_pixels_differing = percent_pixels_differing |
| 54 self.weighted_diff_measure = weighted_diff_measure | |
| 55 self.max_diff_per_channel = max_diff_per_channel | 54 self.max_diff_per_channel = max_diff_per_channel |
| 56 self.perceptual_diff = perceptual_diff | 55 self.perceptual_diff = perceptual_diff |
| 57 | 56 |
| 58 | 57 |
| 59 def _GetDiffFileName(file_name): | 58 def _GetDiffFileName(file_name): |
| 60 file_name_no_ext, ext = os.path.splitext(file_name) | 59 file_name_no_ext, ext = os.path.splitext(file_name) |
| 61 return '%s_nopatch-vs-%s_withpatch%s' % ( | 60 return '%s_nopatch-vs-%s_withpatch%s' % ( |
| 62 file_name_no_ext, file_name_no_ext, ext) | 61 file_name_no_ext, file_name_no_ext, ext) |
| 63 | 62 |
| 64 | 63 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 91 for failed_file in slave_data[json_summary_constants.JSONKEY_FAILED_FILES]: | 90 for failed_file in slave_data[json_summary_constants.JSONKEY_FAILED_FILES]: |
| 92 failed_file_name = failed_file[json_summary_constants.JSONKEY_FILE_NAME] | 91 failed_file_name = failed_file[json_summary_constants.JSONKEY_FILE_NAME] |
| 93 skp_location = posixpath.join( | 92 skp_location = posixpath.join( |
| 94 STORAGE_HTTP_BASE, | 93 STORAGE_HTTP_BASE, |
| 95 failed_file[ | 94 failed_file[ |
| 96 json_summary_constants.JSONKEY_SKP_LOCATION].lstrip('gs://')) | 95 json_summary_constants.JSONKEY_SKP_LOCATION].lstrip('gs://')) |
| 97 num_pixels_differing = failed_file[ | 96 num_pixels_differing = failed_file[ |
| 98 json_summary_constants.JSONKEY_NUM_PIXELS_DIFFERING] | 97 json_summary_constants.JSONKEY_NUM_PIXELS_DIFFERING] |
| 99 percent_pixels_differing = failed_file[ | 98 percent_pixels_differing = failed_file[ |
| 100 json_summary_constants.JSONKEY_PERCENT_PIXELS_DIFFERING] | 99 json_summary_constants.JSONKEY_PERCENT_PIXELS_DIFFERING] |
| 101 weighted_diff_measure = failed_file[ | |
| 102 json_summary_constants.JSONKEY_WEIGHTED_DIFF_MEASURE] | |
| 103 max_diff_per_channel = failed_file[ | 100 max_diff_per_channel = failed_file[ |
| 104 json_summary_constants.JSONKEY_MAX_DIFF_PER_CHANNEL] | 101 json_summary_constants.JSONKEY_MAX_DIFF_PER_CHANNEL] |
| 105 perceptual_diff = failed_file[ | 102 perceptual_diff = failed_file[ |
| 106 json_summary_constants.JSONKEY_PERCEPTUAL_DIFF] | 103 json_summary_constants.JSONKEY_PERCEPTUAL_DIFF] |
| 107 | 104 |
| 108 file_info = FileInfo( | 105 file_info = FileInfo( |
| 109 file_name=failed_file_name, | 106 file_name=failed_file_name, |
| 110 skp_location=skp_location, | 107 skp_location=skp_location, |
| 111 num_pixels_differing=num_pixels_differing, | 108 num_pixels_differing=num_pixels_differing, |
| 112 percent_pixels_differing=percent_pixels_differing, | 109 percent_pixels_differing=percent_pixels_differing, |
| 113 weighted_diff_measure=weighted_diff_measure, | |
| 114 max_diff_per_channel=max_diff_per_channel, | 110 max_diff_per_channel=max_diff_per_channel, |
| 115 perceptual_diff=perceptual_diff) | 111 perceptual_diff=perceptual_diff) |
| 116 file_info_list.append(file_info) | 112 file_info_list.append(file_info) |
| 117 | 113 |
| 118 slave_info = SlaveInfo( | 114 slave_info = SlaveInfo( |
| 119 slave_name=slave_name, | 115 slave_name=slave_name, |
| 120 failed_files=file_info_list, | 116 failed_files=file_info_list, |
| 121 skps_location=slave_data[json_summary_constants.JSONKEY_SKPS_LOCATION], | 117 skps_location=slave_data[json_summary_constants.JSONKEY_SKPS_LOCATION], |
| 122 files_location_nopatch=slave_data[ | 118 files_location_nopatch=slave_data[ |
| 123 json_summary_constants.JSONKEY_FILES_LOCATION_NOPATCH], | 119 json_summary_constants.JSONKEY_FILES_LOCATION_NOPATCH], |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 'Must specify json_summaries_dir, output_html_dir, ' | 222 'Must specify json_summaries_dir, output_html_dir, ' |
| 227 'render_pictures_args, nopatch_gpu and withpatch_gpu') | 223 'render_pictures_args, nopatch_gpu and withpatch_gpu') |
| 228 | 224 |
| 229 OutputToHTML( | 225 OutputToHTML( |
| 230 slave_name_to_info=CombineJsonSummaries(options.json_summaries_dir), | 226 slave_name_to_info=CombineJsonSummaries(options.json_summaries_dir), |
| 231 output_html_dir=options.output_html_dir, | 227 output_html_dir=options.output_html_dir, |
| 232 absolute_url=options.absolute_url, | 228 absolute_url=options.absolute_url, |
| 233 render_pictures_args=options.render_pictures_args, | 229 render_pictures_args=options.render_pictures_args, |
| 234 nopatch_gpu=options.nopatch_gpu, | 230 nopatch_gpu=options.nopatch_gpu, |
| 235 withpatch_gpu=options.withpatch_gpu) | 231 withpatch_gpu=options.withpatch_gpu) |
| OLD | NEW |