OLD | NEW |
1 # Copyright 2017 The Chromium Authors. All rights reserved. | 1 # Copyright 2017 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 """Classes for merging layout tests results directories together. | 5 """Classes for merging layout tests results directories together. |
6 | 6 |
7 This is split into three parts: | 7 This is split into three parts: |
8 | 8 |
9 * Generic code to merge JSON data together. | 9 * Generic code to merge JSON data together. |
10 * Generic code to merge directories together. | 10 * Generic code to merge directories together. |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 423 |
424 self.filesystem = filesystem or FileSystem() | 424 self.filesystem = filesystem or FileSystem() |
425 | 425 |
426 # Default to just checking the file contents matches. | 426 # Default to just checking the file contents matches. |
427 self.add_helper(lambda *args: True, MergeFilesMatchingContents(self.file
system)) | 427 self.add_helper(lambda *args: True, MergeFilesMatchingContents(self.file
system)) |
428 # Copy the file it it's the only one. | 428 # Copy the file it it's the only one. |
429 self.add_helper(lambda _, to_merge: len(to_merge) == 1, MergeFilesOne(se
lf.filesystem)) | 429 self.add_helper(lambda _, to_merge: len(to_merge) == 1, MergeFilesOne(se
lf.filesystem)) |
430 | 430 |
431 def merge(self, output_dir, to_merge_dirs): | 431 def merge(self, output_dir, to_merge_dirs): |
432 output_dir = self.filesystem.realpath(self.filesystem.abspath(output_dir
)) | 432 output_dir = self.filesystem.realpath(self.filesystem.abspath(output_dir
)) |
433 if self.filesystem.exists(output_dir): | |
434 raise OSError("Output directory %s exists." % output_dir) | |
435 | 433 |
436 merge_dirs = [] | 434 merge_dirs = [] |
437 # Normalize the given directory values. | 435 # Normalize the given directory values. |
438 for base_dir in to_merge_dirs: | 436 for base_dir in to_merge_dirs: |
439 merge_dirs.append(self.filesystem.realpath(self.filesystem.abspath(b
ase_dir))) | 437 merge_dirs.append(self.filesystem.realpath(self.filesystem.abspath(b
ase_dir))) |
440 merge_dirs.sort() | 438 merge_dirs.sort() |
441 | 439 |
442 _log.debug("Merging following paths:") | 440 _log.debug("Merging following paths:") |
443 _log.debug(DeferredPrettyPrint(merge_dirs)) | 441 _log.debug(DeferredPrettyPrint(merge_dirs)) |
444 | 442 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 | 599 |
602 self.add_helper( | 600 self.add_helper( |
603 FilenameMatch('failing_results.json'), | 601 FilenameMatch('failing_results.json'), |
604 results_json_file_merger) | 602 results_json_file_merger) |
605 self.add_helper( | 603 self.add_helper( |
606 FilenameMatch('full_results.json'), | 604 FilenameMatch('full_results.json'), |
607 results_json_file_merger) | 605 results_json_file_merger) |
608 self.add_helper( | 606 self.add_helper( |
609 FilenameMatch('output.json'), | 607 FilenameMatch('output.json'), |
610 results_json_file_merger) | 608 results_json_file_merger) |
OLD | NEW |