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 | |
86 | 85 |
87 | 86 |
88 _log = logging.getLogger(__name__) | 87 _log = logging.getLogger(__name__) |
89 | 88 |
90 | 89 |
91 def main(_argv, _stdout, _stderr): | 90 def main(_argv, _stdout, _stderr): |
92 options, args = parse_args() | 91 options, args = parse_args() |
93 host = Host() | 92 host = Host() |
94 source_repo_path = host.filesystem.normpath(os.path.abspath(args[0])) | 93 source_repo_path = host.filesystem.normpath(os.path.abspath(args[0])) |
95 | 94 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 Args: | 367 Args: |
369 file_to_copy: A dict in a file copy list constructed by | 368 file_to_copy: A dict in a file copy list constructed by |
370 find_importable_tests, which represents one file to copy, includ
ing | 369 find_importable_tests, which represents one file to copy, includ
ing |
371 the keys: | 370 the keys: |
372 "src": Absolute path to the source location of the file. | 371 "src": Absolute path to the source location of the file. |
373 "destination": File name of the destination file. | 372 "destination": File name of the destination file. |
374 And possibly also the keys "reference_support_info" or "is_jstes
t". | 373 And possibly also the keys "reference_support_info" or "is_jstes
t". |
375 dest_dir: Path to the directory where the file should be copied. | 374 dest_dir: Path to the directory where the file should be copied. |
376 | 375 |
377 Returns: | 376 Returns: |
378 The path to the new file, relative to the Blink root, | 377 The path to the new file, relative to the Blink root (//third_party/
WebKit). |
379 or None if the file should not be copied. | |
380 """ | 378 """ |
381 source_path = self.filesystem.normpath(file_to_copy['src']) | 379 source_path = self.filesystem.normpath(file_to_copy['src']) |
382 dest_path = self.filesystem.join(dest_dir, file_to_copy['dest']) | 380 dest_path = self.filesystem.join(dest_dir, file_to_copy['dest']) |
383 | 381 |
384 if self.filesystem.isdir(source_path): | 382 if self.filesystem.isdir(source_path): |
385 _log.error('%s refers to a directory', source_path) | 383 _log.error('%s refers to a directory', source_path) |
386 return None | 384 return None |
387 | 385 |
388 if not self.filesystem.exists(source_path): | 386 if not self.filesystem.exists(source_path): |
389 _log.error('%s not found. Possible error in the test.', source_path) | 387 _log.error('%s not found. Possible error in the test.', source_path) |
390 return None | 388 return None |
391 | 389 |
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 | |
396 if file_to_copy.get('reference_support_info'): | 390 if file_to_copy.get('reference_support_info'): |
397 reference_support_info = file_to_copy['reference_support_info'] | 391 reference_support_info = file_to_copy['reference_support_info'] |
398 else: | 392 else: |
399 reference_support_info = None | 393 reference_support_info = None |
400 | 394 |
401 if not self.filesystem.exists(self.filesystem.dirname(dest_path)): | 395 if not self.filesystem.exists(self.filesystem.dirname(dest_path)): |
402 if not self.import_in_place and not self.options.dry_run: | 396 if not self.import_in_place and not self.options.dry_run: |
403 self.filesystem.maybe_make_directory(self.filesystem.dirname(des
t_path)) | 397 self.filesystem.maybe_make_directory(self.filesystem.dirname(des
t_path)) |
404 | 398 |
405 relpath = self.filesystem.relpath(dest_path, self.layout_tests_dir) | 399 relpath = self.filesystem.relpath(dest_path, self.layout_tests_dir) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 """Checks whether a source path is too long to import. | 443 """Checks whether a source path is too long to import. |
450 | 444 |
451 Args: | 445 Args: |
452 Absolute path of file to be imported. | 446 Absolute path of file to be imported. |
453 | 447 |
454 Returns: | 448 Returns: |
455 True if the path is too long to import, False if it's OK. | 449 True if the path is too long to import, False if it's OK. |
456 """ | 450 """ |
457 path_from_repo_base = os.path.relpath(source_path, self.source_repo_path
) | 451 path_from_repo_base = os.path.relpath(source_path, self.source_repo_path
) |
458 return len(path_from_repo_base) > MAX_PATH_LENGTH | 452 return len(path_from_repo_base) > MAX_PATH_LENGTH |
OLD | NEW |