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 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') | |
| 200 if dirs: | 202 if dirs: |
| 201 for d in DIRS_TO_SKIP: | 203 for d in DIRS_TO_SKIP: |
| 202 if d in dirs: | 204 if d in dirs: |
| 203 dirs.remove(d) | 205 dirs.remove(d) |
| 204 | 206 |
| 205 for path in paths_to_skip: | 207 for path in paths_to_skip: |
| 206 path_base = path.replace(self.options.destination + '/', '') | 208 path_base = path.replace(self.options.destination + '/', '') |
| 207 path_base = path_base.replace(cur_dir, '') | 209 path_base = path_base.replace(cur_dir, '') |
| 208 path_full = self.filesystem.join(root, path_base) | 210 path_full = self.filesystem.join(root, path_base) |
| 209 if path_base in dirs: | 211 if path_base in dirs: |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 233 if filename.startswith('.') or filename.endswith('.pl'): | 235 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. | 236 continue # For some reason the w3c repo contains random per l scripts we don't care about. |
| 235 | 237 |
| 236 fullpath = os.path.join(root, filename) | 238 fullpath = os.path.join(root, filename) |
| 237 | 239 |
| 238 mimetype = mimetypes.guess_type(fullpath) | 240 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]): | 241 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}) | 242 copy_list.append({'src': fullpath, 'dest': filename}) |
| 241 continue | 243 continue |
| 242 | 244 |
| 243 if root.endswith('resources'): | 245 # Need to copy all files in 'support', including HTML without me ta data. |
| 246 # http://testthewebforward.org/docs/test-format-guidelines.html# support-files | |
| 247 if root.endswith('resources') or root.endswith('support'): | |
|
jsbell
2015/06/02 19:12:00
How about:
if os.path.basename(root) in ('resourc
| |
| 244 copy_list.append({'src': fullpath, 'dest': filename}) | 248 copy_list.append({'src': fullpath, 'dest': filename}) |
| 245 continue | 249 continue |
| 246 | 250 |
| 247 test_parser = TestParser(vars(self.options), filename=fullpath) | 251 test_parser = TestParser(vars(self.options), filename=fullpath) |
| 248 test_info = test_parser.analyze_test() | 252 test_info = test_parser.analyze_test() |
| 249 if test_info is None: | 253 if test_info is None: |
| 250 continue | 254 continue |
| 251 | 255 |
| 252 if 'reference' in test_info.keys(): | 256 if 'reference' in test_info.keys(): |
| 253 reftests += 1 | 257 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 """ | 404 """ Creates a destination directory that mirrors that of the source dire ctory """ |
| 401 | 405 |
| 402 new_subpath = self.dir_to_import[len(self.top_of_repo):] | 406 new_subpath = self.dir_to_import[len(self.top_of_repo):] |
| 403 | 407 |
| 404 destination_directory = os.path.join(self.destination_directory, new_sub path) | 408 destination_directory = os.path.join(self.destination_directory, new_sub path) |
| 405 | 409 |
| 406 if not os.path.exists(destination_directory): | 410 if not os.path.exists(destination_directory): |
| 407 os.makedirs(destination_directory) | 411 os.makedirs(destination_directory) |
| 408 | 412 |
| 409 _log.info('Tests will be imported into: %s', destination_directory) | 413 _log.info('Tests will be imported into: %s', destination_directory) |
| OLD | NEW |