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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 self.changeset = self.host.executive.run_command(['hg', 'tip']).spli
t('changeset:')[1] | 187 self.changeset = self.host.executive.run_command(['hg', 'tip']).spli
t('changeset:')[1] |
188 except (OSError, ScriptError): | 188 except (OSError, ScriptError): |
189 self.changeset = CHANGESET_NOT_AVAILABLE | 189 self.changeset = CHANGESET_NOT_AVAILABLE |
190 | 190 |
191 def find_importable_tests(self, directory): | 191 def find_importable_tests(self, directory): |
192 # FIXME: use filesystem | 192 # FIXME: use filesystem |
193 paths_to_skip = self.find_paths_to_skip() | 193 paths_to_skip = self.find_paths_to_skip() |
194 | 194 |
195 for root, dirs, files in os.walk(directory): | 195 for root, dirs, files in os.walk(directory): |
196 cur_dir = root.replace(self.layout_tests_dir + '/', '') + '/' | 196 cur_dir = root.replace(self.layout_tests_dir + '/', '') + '/' |
197 _log.info('Scanning ' + cur_dir + '...') | 197 _log.info(' scanning ' + cur_dir + '...') |
198 total_tests = 0 | 198 total_tests = 0 |
199 reftests = 0 | 199 reftests = 0 |
200 jstests = 0 | 200 jstests = 0 |
201 | 201 |
202 # "archive" and "data" dirs are internal csswg things that live in e
very approved directory. | 202 # "archive" and "data" dirs are internal csswg things that live in e
very approved directory. |
203 # FIXME: skip 'incoming' tests for now, but we should rework the 'te
st_status' concept and | 203 # FIXME: skip 'incoming' tests for now, but we should rework the 'te
st_status' concept and |
204 # support reading them as well. | 204 # support reading them as well. |
205 DIRS_TO_SKIP = ('.git', '.hg', 'data', 'archive', 'incoming') | 205 DIRS_TO_SKIP = ('.git', '.hg', 'data', 'archive', 'incoming') |
206 if dirs: | 206 if dirs: |
207 for d in DIRS_TO_SKIP: | 207 for d in DIRS_TO_SKIP: |
208 if d in dirs: | 208 if d in dirs: |
209 dirs.remove(d) | 209 dirs.remove(d) |
210 | 210 |
211 for path in paths_to_skip: | 211 for path in paths_to_skip: |
212 path_base = path.replace(cur_dir, '') | 212 path_base = path.replace(cur_dir, '') |
213 path_full = self.filesystem.join(root, path_base) | 213 path_full = self.filesystem.join(root, path_base) |
214 if path_base in dirs: | 214 if path_base in dirs: |
215 dirs.remove(path_base) | 215 dirs.remove(path_base) |
216 if not self.options.dry_run and self.import_in_place: | 216 if not self.options.dry_run and self.import_in_place: |
217 _log.info("Pruning %s" % path_full) | 217 _log.info(" pruning %s" % path_base) |
218 self.filesystem.rmtree(path_full) | 218 self.filesystem.rmtree(path_full) |
219 | 219 |
220 copy_list = [] | 220 copy_list = [] |
221 | 221 |
222 for filename in files: | 222 for filename in files: |
223 path_full = self.filesystem.join(root, filename) | 223 path_full = self.filesystem.join(root, filename) |
224 path_base = path_full.replace(self.layout_tests_dir + '/', '') | 224 path_base = path_full.replace(self.layout_tests_dir + '/', '') |
225 if path_base in paths_to_skip: | 225 if path_base in paths_to_skip: |
226 if not self.options.dry_run and self.import_in_place: | 226 if not self.options.dry_run and self.import_in_place: |
227 _log.info("Pruning %s" % path_base) | 227 _log.info(" pruning %s" % path_base) |
228 self.filesystem.remove(path_full) | 228 self.filesystem.remove(path_full) |
229 continue | 229 continue |
230 # FIXME: This block should really be a separate function, but th
e early-continues make that difficult. | 230 # FIXME: This block should really be a separate function, but th
e early-continues make that difficult. |
231 | 231 |
232 if filename.startswith('.') or filename.endswith('.pl'): | 232 if filename.startswith('.') or filename.endswith('.pl'): |
233 continue # For some reason the w3c repo contains random per
l scripts we don't care about. | 233 continue # For some reason the w3c repo contains random per
l scripts we don't care about. |
234 | 234 |
235 fullpath = os.path.join(root, filename) | 235 fullpath = os.path.join(root, filename) |
236 | 236 |
237 mimetype = mimetypes.guess_type(fullpath) | 237 mimetype = mimetypes.guess_type(fullpath) |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 _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) |
352 continue | 352 continue |
353 | 353 |
354 new_filepath = os.path.join(new_path, file_to_copy['dest']) | 354 new_filepath = os.path.join(new_path, file_to_copy['dest']) |
355 | 355 |
356 if not(os.path.exists(os.path.dirname(new_filepath))): | 356 if not(os.path.exists(os.path.dirname(new_filepath))): |
357 if not self.import_in_place and not self.options.dry_run: | 357 if not self.import_in_place and not self.options.dry_run: |
358 os.makedirs(os.path.dirname(new_filepath)) | 358 os.makedirs(os.path.dirname(new_filepath)) |
359 | 359 |
360 if not self.options.overwrite and os.path.exists(new_filepath): | 360 if not self.options.overwrite and os.path.exists(new_filepath): |
361 _log.info('Skipping import of existing file ' + new_filepath
) | 361 _log.info(' skipping import of existing file ' + new_filepa
th) |
362 else: | 362 else: |
363 # FIXME: Maybe doing a file diff is in order here for existi
ng files? | 363 # FIXME: Maybe doing a file diff is in order here for existi
ng files? |
364 # In other words, there's no sense in overwriting identical
files, but | 364 # In other words, there's no sense in overwriting identical
files, but |
365 # there's no harm in copying the identical thing. | 365 # there's no harm in copying the identical thing. |
366 _log.info('Importing: %s', orig_filepath) | 366 _log.info(' importing %s', os.path.relpath(new_filepath, se
lf.layout_tests_dir)) |
367 _log.info(' As: %s', new_filepath) | |
368 | 367 |
369 # Only html, xml, or css should be converted | 368 # Only html, xml, or css should be converted |
370 # FIXME: Eventually, so should js when support is added for this
type of conversion | 369 # FIXME: Eventually, so should js when support is added for this
type of conversion |
371 mimetype = mimetypes.guess_type(orig_filepath) | 370 mimetype = mimetypes.guess_type(orig_filepath) |
372 if 'html' in str(mimetype[0]) or 'xml' in str(mimetype[0]) or '
css' in str(mimetype[0]): | 371 if 'html' in str(mimetype[0]) or 'xml' in str(mimetype[0]) or '
css' in str(mimetype[0]): |
373 converted_file = convert_for_webkit(new_path, filename=orig_
filepath) | 372 converted_file = convert_for_webkit(new_path, filename=orig_
filepath) |
374 | 373 |
375 if not converted_file: | 374 if not converted_file: |
376 if not self.import_in_place and not self.options.dry_run
: | 375 if not self.import_in_place and not self.options.dry_run
: |
377 shutil.copyfile(orig_filepath, new_filepath) # The
file was unmodified. | 376 shutil.copyfile(orig_filepath, new_filepath) # The
file was unmodified. |
(...skipping 10 matching lines...) Expand all Loading... |
388 else: | 387 else: |
389 if not self.import_in_place and not self.options.dry_run: | 388 if not self.import_in_place and not self.options.dry_run: |
390 shutil.copyfile(orig_filepath, new_filepath) | 389 shutil.copyfile(orig_filepath, new_filepath) |
391 | 390 |
392 copied_files.append(new_filepath.replace(self._webkit_root, '')) | 391 copied_files.append(new_filepath.replace(self._webkit_root, '')) |
393 | 392 |
394 if not self.import_in_place and not self.options.dry_run: | 393 if not self.import_in_place and not self.options.dry_run: |
395 self.remove_deleted_files(new_path, copied_files) | 394 self.remove_deleted_files(new_path, copied_files) |
396 self.write_import_log(new_path, copied_files, prefixed_propertie
s) | 395 self.write_import_log(new_path, copied_files, prefixed_propertie
s) |
397 | 396 |
| 397 _log.info('') |
398 _log.info('Import complete') | 398 _log.info('Import complete') |
399 | 399 _log.info('') |
400 _log.info('IMPORTED %d TOTAL TESTS', total_imported_tests) | 400 _log.info('IMPORTED %d TOTAL TESTS', total_imported_tests) |
401 _log.info('Imported %d reftests', total_imported_reftests) | 401 _log.info('Imported %d reftests', total_imported_reftests) |
402 _log.info('Imported %d JS tests', total_imported_jstests) | 402 _log.info('Imported %d JS tests', total_imported_jstests) |
403 _log.info('Imported %d pixel/manual tests', total_imported_tests - total
_imported_jstests - total_imported_reftests) | 403 _log.info('Imported %d pixel/manual tests', total_imported_tests - total
_imported_jstests - total_imported_reftests) |
404 _log.info('') | 404 _log.info('') |
405 _log.info('Properties needing prefixes (by count):') | 405 _log.info('Properties needing prefixes (by count):') |
406 for prefixed_property in sorted(total_prefixed_properties, key=lambda p:
total_prefixed_properties[p]): | 406 for prefixed_property in sorted(total_prefixed_properties, key=lambda p:
total_prefixed_properties[p]): |
407 _log.info(' %s: %s', prefixed_property, total_prefixed_properties[p
refixed_property]) | 407 _log.info(' %s: %s', prefixed_property, total_prefixed_properties[p
refixed_property]) |
408 | 408 |
409 def setup_destination_directory(self): | 409 def setup_destination_directory(self): |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 for prop in prop_list: | 474 for prop in prop_list: |
475 import_log.write(prop + '\n') | 475 import_log.write(prop + '\n') |
476 else: | 476 else: |
477 import_log.write('None\n') | 477 import_log.write('None\n') |
478 import_log.write('------------------------------------------------------
------------------\n') | 478 import_log.write('------------------------------------------------------
------------------\n') |
479 import_log.write('List of files:\n') | 479 import_log.write('List of files:\n') |
480 for item in file_list: | 480 for item in file_list: |
481 import_log.write(item + '\n') | 481 import_log.write(item + '\n') |
482 | 482 |
483 import_log.close() | 483 import_log.close() |
OLD | NEW |