Chromium Code Reviews| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 from webkitpy.common.webkit_finder import WebKitFinder | 80 from webkitpy.common.webkit_finder import WebKitFinder |
| 81 from webkitpy.common.system.executive import ScriptError | 81 from webkitpy.common.system.executive import ScriptError |
| 82 from webkitpy.layout_tests.models.test_expectations import TestExpectationParser | 82 from webkitpy.layout_tests.models.test_expectations import TestExpectationParser |
| 83 from webkitpy.w3c.test_parser import TestParser | 83 from webkitpy.w3c.test_parser import TestParser |
| 84 from webkitpy.w3c.test_converter import convert_for_webkit | 84 from webkitpy.w3c.test_converter import convert_for_webkit |
| 85 | 85 |
| 86 | 86 |
| 87 CHANGESET_NOT_AVAILABLE = 'Not Available' | 87 CHANGESET_NOT_AVAILABLE = 'Not Available' |
| 88 | 88 |
| 89 | 89 |
| 90 # Maximum length of import path starting from top of source repository. | |
| 91 # This limit is here because the Windows builders cannot create paths that are | |
| 92 # longer than the Windows max path length (260). See http://crbug.com/609871. | |
| 93 MAX_PATH_LENGTH = 125 | |
| 94 | |
| 95 | |
| 90 _log = logging.getLogger(__name__) | 96 _log = logging.getLogger(__name__) |
| 91 | 97 |
| 92 | 98 |
| 93 def main(_argv, _stdout, _stderr): | 99 def main(_argv, _stdout, _stderr): |
| 94 options, args = parse_args() | 100 options, args = parse_args() |
| 95 host = Host() | 101 host = Host() |
| 96 dir_to_import = host.filesystem.normpath(os.path.abspath(args[0])) | 102 dir_to_import = host.filesystem.normpath(os.path.abspath(args[0])) |
| 97 if len(args) == 1: | 103 if len(args) == 1: |
| 98 top_of_repo = dir_to_import | 104 top_of_repo = dir_to_import |
| 99 else: | 105 else: |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 self.import_list = [] | 179 self.import_list = [] |
| 174 | 180 |
| 175 def do_import(self): | 181 def do_import(self): |
| 176 _log.info("Importing %s into %s", self.dir_to_import, self.destination_d irectory) | 182 _log.info("Importing %s into %s", self.dir_to_import, self.destination_d irectory) |
| 177 self.find_importable_tests(self.dir_to_import) | 183 self.find_importable_tests(self.dir_to_import) |
| 178 self.load_changeset() | 184 self.load_changeset() |
| 179 self.import_tests() | 185 self.import_tests() |
| 180 | 186 |
| 181 def load_changeset(self): | 187 def load_changeset(self): |
| 182 """Returns the current changeset from mercurial or "Not Available".""" | 188 """Returns the current changeset from mercurial or "Not Available".""" |
| 189 # TODO(qyearsley): Remove this, since mercurial isn't used for w3c repos any more, so this is not applicable. | |
| 183 try: | 190 try: |
| 184 self.changeset = self.host.executive.run_command(['hg', 'tip']).spli t('changeset:')[1] | 191 self.changeset = self.host.executive.run_command(['hg', 'tip']).spli t('changeset:')[1] |
| 185 except (OSError, ScriptError): | 192 except (OSError, ScriptError): |
| 186 self.changeset = CHANGESET_NOT_AVAILABLE | 193 self.changeset = CHANGESET_NOT_AVAILABLE |
| 187 | 194 |
| 188 def find_importable_tests(self, directory): | 195 def find_importable_tests(self, directory): |
| 189 paths_to_skip = self.find_paths_to_skip() | 196 paths_to_skip = self.find_paths_to_skip() |
| 190 | 197 |
| 191 for root, dirs, files in self.filesystem.walk(directory): | 198 for root, dirs, files in self.filesystem.walk(directory): |
| 192 cur_dir = root.replace(self.dir_above_repo + '/', '') + '/' | 199 cur_dir = root.replace(self.dir_above_repo + '/', '') + '/' |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 337 | 344 |
| 338 if self.filesystem.isdir(orig_filepath): | 345 if self.filesystem.isdir(orig_filepath): |
| 339 # FIXME: Figure out what is triggering this and what to do a bout it. | 346 # FIXME: Figure out what is triggering this and what to do a bout it. |
| 340 _log.error('%s refers to a directory' % orig_filepath) | 347 _log.error('%s refers to a directory' % orig_filepath) |
| 341 continue | 348 continue |
| 342 | 349 |
| 343 if not self.filesystem.exists(orig_filepath): | 350 if not self.filesystem.exists(orig_filepath): |
| 344 _log.warning('%s not found. Possible error in the test.', or ig_filepath) | 351 _log.warning('%s not found. Possible error in the test.', or ig_filepath) |
| 345 continue | 352 continue |
| 346 | 353 |
| 354 if self.path_too_long(orig_filepath): | |
| 355 _log.warning('%s skipped (longer than %d chars), to avoid hi tting Windows max path length on builders.', | |
|
Dirk Pranke
2016/05/13 18:01:41
I'd actually include the bug number in the message
qyearsley
2016/05/13 21:45:19
Done now.
| |
| 356 orig_filepath, MAX_PATH_LENGTH) | |
| 357 continue | |
| 358 | |
| 347 new_filepath = self.filesystem.join(new_path, file_to_copy['dest ']) | 359 new_filepath = self.filesystem.join(new_path, file_to_copy['dest ']) |
| 348 if 'reference_support_info' in file_to_copy.keys() and file_to_c opy['reference_support_info'] != {}: | 360 if 'reference_support_info' in file_to_copy.keys() and file_to_c opy['reference_support_info'] != {}: |
| 349 reference_support_info = file_to_copy['reference_support_inf o'] | 361 reference_support_info = file_to_copy['reference_support_inf o'] |
| 350 else: | 362 else: |
| 351 reference_support_info = None | 363 reference_support_info = None |
| 352 | 364 |
| 353 if not self.filesystem.exists(self.filesystem.dirname(new_filepa th)): | 365 if not self.filesystem.exists(self.filesystem.dirname(new_filepa th)): |
| 354 if not self.import_in_place and not self.options.dry_run: | 366 if not self.import_in_place and not self.options.dry_run: |
| 355 self.filesystem.maybe_make_directory(self.filesystem.dir name(new_filepath)) | 367 self.filesystem.maybe_make_directory(self.filesystem.dir name(new_filepath)) |
| 356 | 368 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 396 _log.info('Imported %d reftests', total_imported_reftests) | 408 _log.info('Imported %d reftests', total_imported_reftests) |
| 397 _log.info('Imported %d JS tests', total_imported_jstests) | 409 _log.info('Imported %d JS tests', total_imported_jstests) |
| 398 _log.info('Imported %d pixel/manual tests', total_imported_tests - total _imported_jstests - total_imported_reftests) | 410 _log.info('Imported %d pixel/manual tests', total_imported_tests - total _imported_jstests - total_imported_reftests) |
| 399 _log.info('') | 411 _log.info('') |
| 400 | 412 |
| 401 if total_prefixed_properties: | 413 if total_prefixed_properties: |
| 402 _log.info('Properties needing prefixes (by count):') | 414 _log.info('Properties needing prefixes (by count):') |
| 403 for prefixed_property in sorted(total_prefixed_properties, key=lambd a p: total_prefixed_properties[p]): | 415 for prefixed_property in sorted(total_prefixed_properties, key=lambd a p: total_prefixed_properties[p]): |
| 404 _log.info(' %s: %s', prefixed_property, total_prefixed_properti es[prefixed_property]) | 416 _log.info(' %s: %s', prefixed_property, total_prefixed_properti es[prefixed_property]) |
| 405 | 417 |
| 418 def path_too_long(self, source_path): | |
| 419 """Checks whether a source path is too long to import. | |
| 420 | |
| 421 Args: | |
| 422 Absolute path of file to be imported. | |
| 423 """ | |
| 424 path_from_repo_base = os.path.relpath(source_path, self.top_of_repo) | |
| 425 return len(path_from_repo_base) > MAX_PATH_LENGTH | |
| 426 | |
| 406 def setup_destination_directory(self): | 427 def setup_destination_directory(self): |
| 407 """ Creates a destination directory that mirrors that of the source dire ctory """ | 428 """ Creates a destination directory that mirrors that of the source dire ctory """ |
| 408 | 429 |
| 409 new_subpath = self.dir_to_import[len(self.top_of_repo):] | 430 new_subpath = self.dir_to_import[len(self.top_of_repo):] |
| 410 | 431 |
| 411 destination_directory = self.filesystem.join(self.destination_directory, new_subpath) | 432 destination_directory = self.filesystem.join(self.destination_directory, new_subpath) |
| 412 | 433 |
| 413 if not self.filesystem.exists(destination_directory): | 434 if not self.filesystem.exists(destination_directory): |
| 414 self.filesystem.maybe_make_directory(destination_directory) | 435 self.filesystem.maybe_make_directory(destination_directory) |
| 415 | 436 |
| 416 _log.info('Tests will be imported into: %s', destination_directory) | 437 _log.info('Tests will be imported into: %s', destination_directory) |
| OLD | NEW |