| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 # FIXME: use filesystem | 189 # FIXME: use filesystem |
| 190 paths_to_skip = self.find_paths_to_skip() | 190 paths_to_skip = self.find_paths_to_skip() |
| 191 | 191 |
| 192 for root, dirs, files in os.walk(directory): | 192 for root, dirs, files in os.walk(directory): |
| 193 cur_dir = root.replace(self.dir_above_repo + '/', '') + '/' | 193 cur_dir = root.replace(self.dir_above_repo + '/', '') + '/' |
| 194 _log.info(' scanning ' + cur_dir + '...') | 194 _log.info(' scanning ' + cur_dir + '...') |
| 195 total_tests = 0 | 195 total_tests = 0 |
| 196 reftests = 0 | 196 reftests = 0 |
| 197 jstests = 0 | 197 jstests = 0 |
| 198 | 198 |
| 199 DIRS_TO_SKIP = ('.git', '.hg', 'test-plan') | 199 # Files in 'tools' are not for browser testing (e.g., a script for g
enerating test files). |
| 200 # http://testthewebforward.org/docs/test-format-guidelines.html#tool
s |
| 201 DIRS_TO_SKIP = ('.git', '.hg', 'test-plan', 'tools') |
| 202 |
| 203 # Need to copy all files in 'support', including HTML without meta d
ata. |
| 204 # http://testthewebforward.org/docs/test-format-guidelines.html#supp
ort-files |
| 205 DIRS_TO_INCLUDE = ('resources', 'support') |
| 206 |
| 200 if dirs: | 207 if dirs: |
| 201 for d in DIRS_TO_SKIP: | 208 for d in DIRS_TO_SKIP: |
| 202 if d in dirs: | 209 if d in dirs: |
| 203 dirs.remove(d) | 210 dirs.remove(d) |
| 204 | 211 |
| 205 for path in paths_to_skip: | 212 for path in paths_to_skip: |
| 206 path_base = path.replace(self.options.destination + '/', '') | 213 path_base = path.replace(self.options.destination + '/', '') |
| 207 path_base = path_base.replace(cur_dir, '') | 214 path_base = path_base.replace(cur_dir, '') |
| 208 path_full = self.filesystem.join(root, path_base) | 215 path_full = self.filesystem.join(root, path_base) |
| 209 if path_base in dirs: | 216 if path_base in dirs: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 233 if filename.startswith('.') or filename.endswith('.pl'): | 240 if filename.startswith('.') or filename.endswith('.pl'): |
| 234 continue # For some reason the w3c repo contains random per
l scripts we don't care about. | 241 continue # For some reason the w3c repo contains random per
l scripts we don't care about. |
| 235 | 242 |
| 236 fullpath = os.path.join(root, filename) | 243 fullpath = os.path.join(root, filename) |
| 237 | 244 |
| 238 mimetype = mimetypes.guess_type(fullpath) | 245 mimetype = mimetypes.guess_type(fullpath) |
| 239 if not 'html' in str(mimetype[0]) and not 'application/xhtml+xml
' in str(mimetype[0]) and not 'application/xml' in str(mimetype[0]): | 246 if not 'html' in str(mimetype[0]) and not 'application/xhtml+xml
' in str(mimetype[0]) and not 'application/xml' in str(mimetype[0]): |
| 240 copy_list.append({'src': fullpath, 'dest': filename}) | 247 copy_list.append({'src': fullpath, 'dest': filename}) |
| 241 continue | 248 continue |
| 242 | 249 |
| 243 if root.endswith('resources'): | 250 if os.path.basename(root) in DIRS_TO_INCLUDE: |
| 244 copy_list.append({'src': fullpath, 'dest': filename}) | 251 copy_list.append({'src': fullpath, 'dest': filename}) |
| 245 continue | 252 continue |
| 246 | 253 |
| 247 test_parser = TestParser(vars(self.options), filename=fullpath) | 254 test_parser = TestParser(vars(self.options), filename=fullpath) |
| 248 test_info = test_parser.analyze_test() | 255 test_info = test_parser.analyze_test() |
| 249 if test_info is None: | 256 if test_info is None: |
| 250 continue | 257 continue |
| 251 | 258 |
| 252 if 'reference' in test_info.keys(): | 259 if 'reference' in test_info.keys(): |
| 253 reftests += 1 | 260 reftests += 1 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 """ Creates a destination directory that mirrors that of the source dire
ctory """ | 407 """ Creates a destination directory that mirrors that of the source dire
ctory """ |
| 401 | 408 |
| 402 new_subpath = self.dir_to_import[len(self.top_of_repo):] | 409 new_subpath = self.dir_to_import[len(self.top_of_repo):] |
| 403 | 410 |
| 404 destination_directory = os.path.join(self.destination_directory, new_sub
path) | 411 destination_directory = os.path.join(self.destination_directory, new_sub
path) |
| 405 | 412 |
| 406 if not os.path.exists(destination_directory): | 413 if not os.path.exists(destination_directory): |
| 407 os.makedirs(destination_directory) | 414 os.makedirs(destination_directory) |
| 408 | 415 |
| 409 _log.info('Tests will be imported into: %s', destination_directory) | 416 _log.info('Tests will be imported into: %s', destination_directory) |
| OLD | NEW |