| OLD | NEW |
| 1 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 1 # Copyright (C) 2013 Adobe Systems Incorporated. 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 | 4 # modification, are permitted provided that the following conditions |
| 5 # are met: | 5 # are met: |
| 6 # | 6 # |
| 7 # 1. Redistributions of source code must retain the above | 7 # 1. Redistributions of source code must retain the above |
| 8 # copyright notice, this list of conditions and the following | 8 # copyright notice, this list of conditions and the following |
| 9 # disclaimer. | 9 # disclaimer. |
| 10 # 2. Redistributions in binary form must reproduce the above | 10 # 2. Redistributions in binary form must reproduce the above |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 from webkitpy.common.webkit_finder import WebKitFinder | 75 from webkitpy.common.webkit_finder import WebKitFinder |
| 76 from webkitpy.layout_tests.models.test_expectations import TestExpectationParser | 76 from webkitpy.layout_tests.models.test_expectations import TestExpectationParser |
| 77 from webkitpy.w3c.test_parser import TestParser | 77 from webkitpy.w3c.test_parser import TestParser |
| 78 from webkitpy.w3c.test_converter import convert_for_webkit | 78 from webkitpy.w3c.test_converter import convert_for_webkit |
| 79 | 79 |
| 80 | 80 |
| 81 # Maximum length of import path starting from top of source repository. | 81 # Maximum length of import path starting from top of source repository. |
| 82 # This limit is here because the Windows builders cannot create paths that are | 82 # This limit is here because the Windows builders cannot create paths that are |
| 83 # longer than the Windows max path length (260). See http://crbug.com/609871. | 83 # longer than the Windows max path length (260). See http://crbug.com/609871. |
| 84 MAX_PATH_LENGTH = 125 | 84 MAX_PATH_LENGTH = 125 |
| 85 MAX_FILE_SIZE_BYTES = 800 * 1024 |
| 85 | 86 |
| 86 | 87 |
| 87 _log = logging.getLogger(__name__) | 88 _log = logging.getLogger(__name__) |
| 88 | 89 |
| 89 | 90 |
| 90 def main(_argv, _stdout, _stderr): | 91 def main(_argv, _stdout, _stderr): |
| 91 options, args = parse_args() | 92 options, args = parse_args() |
| 92 host = Host() | 93 host = Host() |
| 93 source_repo_path = host.filesystem.normpath(os.path.abspath(args[0])) | 94 source_repo_path = host.filesystem.normpath(os.path.abspath(args[0])) |
| 94 | 95 |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 Args: | 368 Args: |
| 368 file_to_copy: A dict in a file copy list constructed by | 369 file_to_copy: A dict in a file copy list constructed by |
| 369 find_importable_tests, which represents one file to copy, includ
ing | 370 find_importable_tests, which represents one file to copy, includ
ing |
| 370 the keys: | 371 the keys: |
| 371 "src": Absolute path to the source location of the file. | 372 "src": Absolute path to the source location of the file. |
| 372 "destination": File name of the destination file. | 373 "destination": File name of the destination file. |
| 373 And possibly also the keys "reference_support_info" or "is_jstes
t". | 374 And possibly also the keys "reference_support_info" or "is_jstes
t". |
| 374 dest_dir: Path to the directory where the file should be copied. | 375 dest_dir: Path to the directory where the file should be copied. |
| 375 | 376 |
| 376 Returns: | 377 Returns: |
| 377 The path to the new file, relative to the Blink root (//third_party/
WebKit). | 378 The path to the new file, relative to the Blink root, |
| 379 or None if the file should not be copied. |
| 378 """ | 380 """ |
| 379 source_path = self.filesystem.normpath(file_to_copy['src']) | 381 source_path = self.filesystem.normpath(file_to_copy['src']) |
| 380 dest_path = self.filesystem.join(dest_dir, file_to_copy['dest']) | 382 dest_path = self.filesystem.join(dest_dir, file_to_copy['dest']) |
| 381 | 383 |
| 382 if self.filesystem.isdir(source_path): | 384 if self.filesystem.isdir(source_path): |
| 383 _log.error('%s refers to a directory', source_path) | 385 _log.error('%s refers to a directory', source_path) |
| 384 return None | 386 return None |
| 385 | 387 |
| 386 if not self.filesystem.exists(source_path): | 388 if not self.filesystem.exists(source_path): |
| 387 _log.error('%s not found. Possible error in the test.', source_path) | 389 _log.error('%s not found. Possible error in the test.', source_path) |
| 388 return None | 390 return None |
| 389 | 391 |
| 392 if self.filesystem.getsize(source_path) > MAX_FILE_SIZE_BYTES: |
| 393 _log.error('%s is too large (%d bytes)', source_path, self.filesyste
m.getsize(source_path)) |
| 394 return None |
| 395 |
| 390 if file_to_copy.get('reference_support_info'): | 396 if file_to_copy.get('reference_support_info'): |
| 391 reference_support_info = file_to_copy['reference_support_info'] | 397 reference_support_info = file_to_copy['reference_support_info'] |
| 392 else: | 398 else: |
| 393 reference_support_info = None | 399 reference_support_info = None |
| 394 | 400 |
| 395 if not self.filesystem.exists(self.filesystem.dirname(dest_path)): | 401 if not self.filesystem.exists(self.filesystem.dirname(dest_path)): |
| 396 if not self.import_in_place and not self.options.dry_run: | 402 if not self.import_in_place and not self.options.dry_run: |
| 397 self.filesystem.maybe_make_directory(self.filesystem.dirname(des
t_path)) | 403 self.filesystem.maybe_make_directory(self.filesystem.dirname(des
t_path)) |
| 398 | 404 |
| 399 relpath = self.filesystem.relpath(dest_path, self.layout_tests_dir) | 405 relpath = self.filesystem.relpath(dest_path, self.layout_tests_dir) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 """Checks whether a source path is too long to import. | 449 """Checks whether a source path is too long to import. |
| 444 | 450 |
| 445 Args: | 451 Args: |
| 446 Absolute path of file to be imported. | 452 Absolute path of file to be imported. |
| 447 | 453 |
| 448 Returns: | 454 Returns: |
| 449 True if the path is too long to import, False if it's OK. | 455 True if the path is too long to import, False if it's OK. |
| 450 """ | 456 """ |
| 451 path_from_repo_base = os.path.relpath(source_path, self.source_repo_path
) | 457 path_from_repo_base = os.path.relpath(source_path, self.source_repo_path
) |
| 452 return len(path_from_repo_base) > MAX_PATH_LENGTH | 458 return len(path_from_repo_base) > MAX_PATH_LENGTH |
| OLD | NEW |