| 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 import sys | 75 import sys |
| 76 | 76 |
| 77 from webkitpy.common.host import Host | 77 from webkitpy.common.host import Host |
| 78 from webkitpy.common.webkit_finder import WebKitFinder | 78 from webkitpy.common.webkit_finder import WebKitFinder |
| 79 from webkitpy.common.system.executive import ScriptError | 79 from webkitpy.common.system.executive import ScriptError |
| 80 from webkitpy.layout_tests.models.test_expectations import TestExpectationParser | 80 from webkitpy.layout_tests.models.test_expectations import TestExpectationParser |
| 81 from webkitpy.w3c.test_parser import TestParser | 81 from webkitpy.w3c.test_parser import TestParser |
| 82 from webkitpy.w3c.test_converter import convert_for_webkit | 82 from webkitpy.w3c.test_converter import convert_for_webkit |
| 83 | 83 |
| 84 | 84 |
| 85 # Maximum length of import path starting from top of source repository. |
| 86 # This limit is here because the Windows builders cannot create paths that are |
| 87 # longer than the Windows max path length (260). See http://crbug.com/609871. |
| 88 MAX_PATH_LENGTH = 125 |
| 89 |
| 90 |
| 85 _log = logging.getLogger(__name__) | 91 _log = logging.getLogger(__name__) |
| 86 | 92 |
| 87 | 93 |
| 88 def main(_argv, _stdout, _stderr): | 94 def main(_argv, _stdout, _stderr): |
| 89 options, args = parse_args() | 95 options, args = parse_args() |
| 90 host = Host() | 96 host = Host() |
| 91 dir_to_import = host.filesystem.normpath(os.path.abspath(args[0])) | 97 dir_to_import = host.filesystem.normpath(os.path.abspath(args[0])) |
| 92 if len(args) == 1: | 98 if len(args) == 1: |
| 93 top_of_repo = dir_to_import | 99 top_of_repo = dir_to_import |
| 94 else: | 100 else: |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 328 |
| 323 if self.filesystem.isdir(orig_filepath): | 329 if self.filesystem.isdir(orig_filepath): |
| 324 # FIXME: Figure out what is triggering this and what to do a
bout it. | 330 # FIXME: Figure out what is triggering this and what to do a
bout it. |
| 325 _log.error('%s refers to a directory' % orig_filepath) | 331 _log.error('%s refers to a directory' % orig_filepath) |
| 326 continue | 332 continue |
| 327 | 333 |
| 328 if not self.filesystem.exists(orig_filepath): | 334 if not self.filesystem.exists(orig_filepath): |
| 329 _log.warning('%s not found. Possible error in the test.', or
ig_filepath) | 335 _log.warning('%s not found. Possible error in the test.', or
ig_filepath) |
| 330 continue | 336 continue |
| 331 | 337 |
| 338 if self.path_too_long(orig_filepath): |
| 339 _log.warning('%s skipped (longer than %d chars), to avoid hi
tting Windows max path length on builders (http://crbug.com/609871).', |
| 340 orig_filepath, MAX_PATH_LENGTH) |
| 341 continue |
| 342 |
| 332 new_filepath = self.filesystem.join(new_path, file_to_copy['dest
']) | 343 new_filepath = self.filesystem.join(new_path, file_to_copy['dest
']) |
| 333 if 'reference_support_info' in file_to_copy.keys() and file_to_c
opy['reference_support_info'] != {}: | 344 if 'reference_support_info' in file_to_copy.keys() and file_to_c
opy['reference_support_info'] != {}: |
| 334 reference_support_info = file_to_copy['reference_support_inf
o'] | 345 reference_support_info = file_to_copy['reference_support_inf
o'] |
| 335 else: | 346 else: |
| 336 reference_support_info = None | 347 reference_support_info = None |
| 337 | 348 |
| 338 if not self.filesystem.exists(self.filesystem.dirname(new_filepa
th)): | 349 if not self.filesystem.exists(self.filesystem.dirname(new_filepa
th)): |
| 339 if not self.import_in_place and not self.options.dry_run: | 350 if not self.import_in_place and not self.options.dry_run: |
| 340 self.filesystem.maybe_make_directory(self.filesystem.dir
name(new_filepath)) | 351 self.filesystem.maybe_make_directory(self.filesystem.dir
name(new_filepath)) |
| 341 | 352 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 _log.info('Imported %d reftests', total_imported_reftests) | 392 _log.info('Imported %d reftests', total_imported_reftests) |
| 382 _log.info('Imported %d JS tests', total_imported_jstests) | 393 _log.info('Imported %d JS tests', total_imported_jstests) |
| 383 _log.info('Imported %d pixel/manual tests', total_imported_tests - total
_imported_jstests - total_imported_reftests) | 394 _log.info('Imported %d pixel/manual tests', total_imported_tests - total
_imported_jstests - total_imported_reftests) |
| 384 _log.info('') | 395 _log.info('') |
| 385 | 396 |
| 386 if total_prefixed_properties: | 397 if total_prefixed_properties: |
| 387 _log.info('Properties needing prefixes (by count):') | 398 _log.info('Properties needing prefixes (by count):') |
| 388 for prefixed_property in sorted(total_prefixed_properties, key=lambd
a p: total_prefixed_properties[p]): | 399 for prefixed_property in sorted(total_prefixed_properties, key=lambd
a p: total_prefixed_properties[p]): |
| 389 _log.info(' %s: %s', prefixed_property, total_prefixed_properti
es[prefixed_property]) | 400 _log.info(' %s: %s', prefixed_property, total_prefixed_properti
es[prefixed_property]) |
| 390 | 401 |
| 402 def path_too_long(self, source_path): |
| 403 """Checks whether a source path is too long to import. |
| 404 |
| 405 Args: |
| 406 Absolute path of file to be imported. |
| 407 """ |
| 408 path_from_repo_base = os.path.relpath(source_path, self.top_of_repo) |
| 409 return len(path_from_repo_base) > MAX_PATH_LENGTH |
| 410 |
| 391 def setup_destination_directory(self): | 411 def setup_destination_directory(self): |
| 392 """ Creates a destination directory that mirrors that of the source dire
ctory """ | 412 """ Creates a destination directory that mirrors that of the source dire
ctory """ |
| 393 | 413 |
| 394 new_subpath = self.dir_to_import[len(self.top_of_repo):] | 414 new_subpath = self.dir_to_import[len(self.top_of_repo):] |
| 395 | 415 |
| 396 destination_directory = self.filesystem.join(self.destination_directory,
new_subpath) | 416 destination_directory = self.filesystem.join(self.destination_directory,
new_subpath) |
| 397 | 417 |
| 398 if not self.filesystem.exists(destination_directory): | 418 if not self.filesystem.exists(destination_directory): |
| 399 self.filesystem.maybe_make_directory(destination_directory) | 419 self.filesystem.maybe_make_directory(destination_directory) |
| 400 | 420 |
| 401 _log.info('Tests will be imported into: %s', destination_directory) | 421 _log.info('Tests will be imported into: %s', destination_directory) |
| OLD | NEW |