Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(736)

Side by Side Diff: Tools/Scripts/webkitpy/w3c/test_importer.py

Issue 15592005: support .xht directly so we do not have to rename files during w3c imports (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 3 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
4 # 4 #
5 # Redistribution and use in source and binary forms, with or without 5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions 6 # modification, are permitted provided that the following conditions
7 # are met: 7 # are met:
8 # 8 #
9 # 1. Redistributions of source code must retain the above 9 # 1. Redistributions of source code must retain the above
10 # copyright notice, this list of conditions and the following 10 # copyright notice, this list of conditions and the following
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 It can obviously and easily be changed. 58 It can obviously and easily be changed.
59 59
60 - By default, only reftests and jstest are imported. This can be overridden with a -a or --all 60 - By default, only reftests and jstest are imported. This can be overridden with a -a or --all
61 argument 61 argument
62 62
63 - Also by default, if test files by the same name already exist in the desti nation directory, 63 - Also by default, if test files by the same name already exist in the desti nation directory,
64 they are overwritten with the idea that running this script would refresh files periodically. 64 they are overwritten with the idea that running this script would refresh files periodically.
65 This can also be overridden by a -n or --no-overwrite flag 65 This can also be overridden by a -n or --no-overwrite flag
66 66
67 - All files are converted to work in WebKit: 67 - All files are converted to work in WebKit:
68 1. .xht extensions are changed to .xhtml to make new-run-webkit-tests h appy
69 2. Paths to testharness.js files are modified point to Webkit's copy of them in 68 2. Paths to testharness.js files are modified point to Webkit's copy of them in
ojan 2013/05/22 00:22:06 Numbering needs updating.
70 LayoutTests/resources, using the correct relative path from the new location 69 LayoutTests/resources, using the correct relative path from the new location
71 3. All CSS properties requiring the -webkit-vendor prefix are prefixed - this current 70 3. All CSS properties requiring the -webkit-vendor prefix are prefixed - this current
72 list of what needs prefixes is read from Source/WebCore/CSS/CSSPrope rties.in 71 list of what needs prefixes is read from Source/WebCore/CSS/CSSPrope rties.in
73 4. Each reftest has its own copy of its reference file following the na ming conventions 72 4. Each reftest has its own copy of its reference file following the na ming conventions
74 new-run-webkit-tests expects 73 new-run-webkit-tests expects
75 5. If a reference files lives outside the directory of the test that us es it, it is checked 74 5. If a reference files lives outside the directory of the test that us es it, it is checked
76 for paths to support files as it will be imported into a different r elative position to the 75 for paths to support files as it will be imported into a different r elative position to the
77 test file (in the same directory) 76 test file (in the same directory)
78 77
79 - Upon completion, script outputs the total number tests imported, broken d own by test type 78 - Upon completion, script outputs the total number tests imported, broken d own by test type
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 orig_filepath = os.path.normpath(file_to_copy['src']) 295 orig_filepath = os.path.normpath(file_to_copy['src'])
297 296
298 assert(not os.path.isdir(orig_filepath)) 297 assert(not os.path.isdir(orig_filepath))
299 298
300 if not(os.path.exists(orig_filepath)): 299 if not(os.path.exists(orig_filepath)):
301 print 'Warning: ' + orig_filepath + ' not found. Possible er ror in the test.' 300 print 'Warning: ' + orig_filepath + ' not found. Possible er ror in the test.'
302 continue 301 continue
303 302
304 new_filepath = os.path.join(new_path, file_to_copy['dest']) 303 new_filepath = os.path.join(new_path, file_to_copy['dest'])
305 304
306 # FIXME: we should just support '.xht' directly.
307 new_filepath = new_filepath.replace('.xht', '.xhtml')
308
309 if not(os.path.exists(os.path.dirname(new_filepath))): 305 if not(os.path.exists(os.path.dirname(new_filepath))):
310 os.makedirs(os.path.dirname(new_filepath)) 306 os.makedirs(os.path.dirname(new_filepath))
311 307
312 if not self.options.overwrite and os.path.exists(new_filepath): 308 if not self.options.overwrite and os.path.exists(new_filepath):
313 print 'Skipping import of existing file ' + new_filepath 309 print 'Skipping import of existing file ' + new_filepath
314 else: 310 else:
315 # FIXME: Maybe doing a file diff is in order here for existi ng files? 311 # FIXME: Maybe doing a file diff is in order here for existi ng files?
316 # In other words, there's no sense in overwriting identical files, but 312 # In other words, there's no sense in overwriting identical files, but
317 # there's no harm in copying the identical thing. 313 # there's no harm in copying the identical thing.
318 print 'Importing:', orig_filepath 314 print 'Importing:', orig_filepath
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 for prop in prop_list: 415 for prop in prop_list:
420 import_log.write(prop + '\n') 416 import_log.write(prop + '\n')
421 else: 417 else:
422 import_log.write('None\n') 418 import_log.write('None\n')
423 import_log.write('------------------------------------------------------ ------------------\n') 419 import_log.write('------------------------------------------------------ ------------------\n')
424 import_log.write('List of files:\n') 420 import_log.write('List of files:\n')
425 for item in file_list: 421 for item in file_list:
426 import_log.write(item + '\n') 422 import_log.write(item + '\n')
427 423
428 import_log.close() 424 import_log.close()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698