| OLD | NEW |
| 1 # Copyright (c) 2010 Google Inc. All rights reserved. | 1 # Copyright (c) 2010 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 def _rebaseline_test(test_file, baseline_target, baseline_move_to, test_config,
log): | 58 def _rebaseline_test(test_file, baseline_target, baseline_move_to, test_config,
log): |
| 59 test_name, _ = os.path.splitext(test_file) | 59 test_name, _ = os.path.splitext(test_file) |
| 60 test_directory = os.path.dirname(test_name) | 60 test_directory = os.path.dirname(test_name) |
| 61 | 61 |
| 62 log('Rebaselining %s...' % test_name) | 62 log('Rebaselining %s...' % test_name) |
| 63 | 63 |
| 64 actual_result_files = _get_actual_result_files(test_file, test_config) | 64 actual_result_files = _get_actual_result_files(test_file, test_config) |
| 65 filesystem = test_config.filesystem | 65 filesystem = test_config.filesystem |
| 66 scm = test_config.scm | 66 scm = test_config.scm |
| 67 layout_tests_directory = test_config.layout_tests_directory | 67 layout_tests_directory = test_config.layout_tests_directory |
| 68 results_directory = test_config.results_directory | |
| 69 target_expectations_directory = filesystem.join( | 68 target_expectations_directory = filesystem.join( |
| 70 layout_tests_directory, 'platform', baseline_target, test_directory) | 69 layout_tests_directory, 'platform', baseline_target, test_directory) |
| 71 test_results_directory = test_config.filesystem.join( | 70 test_results_directory = test_config.filesystem.join( |
| 72 test_config.results_directory, test_directory) | 71 test_config.results_directory, test_directory) |
| 73 | 72 |
| 74 # If requested, move current baselines out | 73 # If requested, move current baselines out |
| 75 current_baselines = get_test_baselines(test_file, test_config) | 74 current_baselines = get_test_baselines(test_file, test_config) |
| 76 if baseline_target in current_baselines and baseline_move_to != 'none': | 75 if baseline_target in current_baselines and baseline_move_to != 'none': |
| 77 log(' Moving current %s baselines to %s' % | 76 log(' Moving current %s baselines to %s' % |
| 78 (baseline_target, baseline_move_to)) | 77 (baseline_target, baseline_move_to)) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 def __init__(self, host): | 166 def __init__(self, host): |
| 168 super(AllPlatformsPort, self).__init__(host, 'mac') | 167 super(AllPlatformsPort, self).__init__(host, 'mac') |
| 169 self._platforms_by_directory = dict([(self._webkit_baseline_path(p),
p) for p in test_config.platforms]) | 168 self._platforms_by_directory = dict([(self._webkit_baseline_path(p),
p) for p in test_config.platforms]) |
| 170 | 169 |
| 171 def baseline_search_path(self): | 170 def baseline_search_path(self): |
| 172 return self._platforms_by_directory.keys() | 171 return self._platforms_by_directory.keys() |
| 173 | 172 |
| 174 def platform_from_directory(self, directory): | 173 def platform_from_directory(self, directory): |
| 175 return self._platforms_by_directory[directory] | 174 return self._platforms_by_directory[directory] |
| 176 | 175 |
| 177 test_path = test_config.filesystem.join(test_config.layout_tests_directory,
test_file) | 176 all_platforms_port = AllPlatformsPort(test_config.host) |
| 178 host = test_config.host | |
| 179 all_platforms_port = AllPlatformsPort(host) | |
| 180 | 177 |
| 181 all_test_baselines = {} | 178 all_test_baselines = {} |
| 182 for baseline_extension in ('.txt', '.checksum', '.png'): | 179 for baseline_extension in ('.txt', '.checksum', '.png'): |
| 183 test_baselines = test_config.test_port.expected_baselines(test_file, bas
eline_extension) | 180 test_baselines = test_config.test_port.expected_baselines(test_file, bas
eline_extension) |
| 184 baselines = all_platforms_port.expected_baselines(test_file, baseline_ex
tension, all_baselines=True) | 181 baselines = all_platforms_port.expected_baselines(test_file, baseline_ex
tension, all_baselines=True) |
| 185 for platform_directory, expected_filename in baselines: | 182 for platform_directory, expected_filename in baselines: |
| 186 if not platform_directory: | 183 if not platform_directory: |
| 187 continue | 184 continue |
| 188 if platform_directory == test_config.layout_tests_directory: | 185 if platform_directory == test_config.layout_tests_directory: |
| 189 platform = 'base' | 186 platform = 'base' |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 elif mode == 'diff-text': | 273 elif mode == 'diff-text': |
| 277 file_name = test_name + '-diff.txt' | 274 file_name = test_name + '-diff.txt' |
| 278 elif mode == 'diff-text-pretty': | 275 elif mode == 'diff-text-pretty': |
| 279 file_name = test_name + '-pretty-diff.html' | 276 file_name = test_name + '-pretty-diff.html' |
| 280 | 277 |
| 281 file_path = os.path.join(self.server.test_config.results_directory, file
_name) | 278 file_path = os.path.join(self.server.test_config.results_directory, file
_name) |
| 282 | 279 |
| 283 # Let results be cached for 60 seconds, so that they can be pre-fetched | 280 # Let results be cached for 60 seconds, so that they can be pre-fetched |
| 284 # by the UI | 281 # by the UI |
| 285 self._serve_file(file_path, cacheable_seconds=60) | 282 self._serve_file(file_path, cacheable_seconds=60) |
| OLD | NEW |