| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 # See which ones we need to move (only those that are about to be | 80 # See which ones we need to move (only those that are about to be |
| 81 # updated), and make sure we're not clobbering any files in the | 81 # updated), and make sure we're not clobbering any files in the |
| 82 # destination. | 82 # destination. |
| 83 current_extensions = set(current_baselines[baseline_target].keys()) | 83 current_extensions = set(current_baselines[baseline_target].keys()) |
| 84 actual_result_extensions = [ | 84 actual_result_extensions = [ |
| 85 os.path.splitext(f)[1] for f in actual_result_files] | 85 os.path.splitext(f)[1] for f in actual_result_files] |
| 86 extensions_to_move = current_extensions.intersection( | 86 extensions_to_move = current_extensions.intersection( |
| 87 actual_result_extensions) | 87 actual_result_extensions) |
| 88 | 88 |
| 89 if extensions_to_move.intersection( | 89 if extensions_to_move.intersection( |
| 90 current_baselines.get(baseline_move_to, {}).keys()): | 90 current_baselines.get(baseline_move_to, {}).keys()): |
| 91 log(' Already had baselines in %s, could not move existing ' | 91 log(' Already had baselines in %s, could not move existing ' |
| 92 '%s ones' % (baseline_move_to, baseline_target)) | 92 '%s ones' % (baseline_move_to, baseline_target)) |
| 93 return False | 93 return False |
| 94 | 94 |
| 95 # Do the actual move. | 95 # Do the actual move. |
| 96 if extensions_to_move: | 96 if extensions_to_move: |
| 97 if not _move_test_baselines( | 97 if not _move_test_baselines( |
| 98 test_file, | 98 test_file, |
| 99 list(extensions_to_move), | 99 list(extensions_to_move), |
| 100 baseline_target, | 100 baseline_target, |
| 101 baseline_move_to, | 101 baseline_move_to, |
| 102 test_config, | 102 test_config, |
| 103 log): | 103 log): |
| 104 return False | 104 return False |
| 105 else: | 105 else: |
| 106 log(' No current baselines to move') | 106 log(' No current baselines to move') |
| 107 | 107 |
| 108 log(' Updating baselines for %s' % baseline_target) | 108 log(' Updating baselines for %s' % baseline_target) |
| 109 filesystem.maybe_make_directory(target_expectations_directory) | 109 filesystem.maybe_make_directory(target_expectations_directory) |
| 110 for source_file in actual_result_files: | 110 for source_file in actual_result_files: |
| 111 source_path = filesystem.join(test_results_directory, source_file) | 111 source_path = filesystem.join(test_results_directory, source_file) |
| 112 destination_file = source_file.replace('-actual', '-expected') | 112 destination_file = source_file.replace('-actual', '-expected') |
| 113 destination_path = filesystem.join( | 113 destination_path = filesystem.join( |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 elif mode == 'diff-text': | 276 elif mode == 'diff-text': |
| 277 file_name = test_name + '-diff.txt' | 277 file_name = test_name + '-diff.txt' |
| 278 elif mode == 'diff-text-pretty': | 278 elif mode == 'diff-text-pretty': |
| 279 file_name = test_name + '-pretty-diff.html' | 279 file_name = test_name + '-pretty-diff.html' |
| 280 | 280 |
| 281 file_path = os.path.join(self.server.test_config.results_directory, file
_name) | 281 file_path = os.path.join(self.server.test_config.results_directory, file
_name) |
| 282 | 282 |
| 283 # Let results be cached for 60 seconds, so that they can be pre-fetched | 283 # Let results be cached for 60 seconds, so that they can be pre-fetched |
| 284 # by the UI | 284 # by the UI |
| 285 self._serve_file(file_path, cacheable_seconds=60) | 285 self._serve_file(file_path, cacheable_seconds=60) |
| OLD | NEW |