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

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

Issue 1998413002: Simplify import-w3c-tests: support exactly one argument. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update usage string Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 logger = logging.getLogger() 123 logger = logging.getLogger()
124 logger.setLevel(logging.INFO) 124 logger.setLevel(logging.INFO)
125 handler = LogHandler() 125 handler = LogHandler()
126 handler.setLevel(logging.INFO) 126 handler.setLevel(logging.INFO)
127 logger.addHandler(handler) 127 logger.addHandler(handler)
128 return handler 128 return handler
129 129
130 130
131 def parse_args(): 131 def parse_args():
132 parser = optparse.OptionParser(usage='usage: %prog [options] [dir_to_import] [top_of_repo]') 132 parser = optparse.OptionParser(usage='usage: %prog [options] [dir_to_import] top_of_repo')
133 parser.add_option('-n', '--no-overwrite', dest='overwrite', action='store_fa lse', default=True, 133 parser.add_option('-n', '--no-overwrite', dest='overwrite', action='store_fa lse', default=True,
134 help='Flag to prevent duplicate test files from overwritin g existing tests. By default, they will be overwritten.') 134 help='Flag to prevent duplicate test files from overwritin g existing tests. By default, they will be overwritten.')
135 parser.add_option('-a', '--all', action='store_true', default=False, 135 parser.add_option('-a', '--all', action='store_true', default=False,
136 help='Import all tests including reftests, JS tests, and m anual/pixel tests. By default, only reftests and JS tests are imported.') 136 help='Import all tests including reftests, JS tests, and m anual/pixel tests. By default, only reftests and JS tests are imported.')
137 parser.add_option('-d', '--dest-dir', dest='destination', default='w3c', 137 parser.add_option('-d', '--dest-dir', dest='destination', default='w3c',
138 help='Import into a specified directory relative to the La youtTests root. By default, files are imported under LayoutTests/w3c.') 138 help='Import into a specified directory relative to the La youtTests root. By default, files are imported under LayoutTests/w3c.')
139 parser.add_option('--ignore-expectations', action='store_true', default=Fals e, 139 parser.add_option('--ignore-expectations', action='store_true', default=Fals e,
140 help='Ignore the W3CImportExpectations file and import eve rything.') 140 help='Ignore the W3CImportExpectations file and import eve rything.')
141 parser.add_option('--dry-run', action='store_true', default=False, 141 parser.add_option('--dry-run', action='store_true', default=False,
142 help='Dryrun only (don\'t actually write any results).') 142 help='Dryrun only (don\'t actually write any results).')
143 143
144 options, args = parser.parse_args() 144 options, args = parser.parse_args()
145 if len(args) > 2: 145 if len(args) > 2 or len(args) == 0:
Dirk Pranke 2016/05/23 20:28:24 In what situation these days do we actually specif
146 parser.error('Incorrect number of arguments') 146 parser.error('Incorrect number of arguments')
147 elif len(args) == 0:
148 # If no top-of-repo path was given, then assume that the user means to
149 # use the current working directory as the top-of-repo path.
150 # TODO(qyearsley): Remove this behavior, since it's a little confusing.
151 args = (os.getcwd(),)
152 return options, args 147 return options, args
153 148
154 149
155 class TestImporter(object): 150 class TestImporter(object):
156 151
157 def __init__(self, host, dir_to_import, top_of_repo, options): 152 def __init__(self, host, dir_to_import, top_of_repo, options):
158 self.host = host 153 self.host = host
159 self.dir_to_import = dir_to_import 154 self.dir_to_import = dir_to_import
160 self.top_of_repo = top_of_repo 155 self.top_of_repo = top_of_repo
161 self.options = options 156 self.options = options
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 """ 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 """
413 408
414 new_subpath = self.dir_to_import[len(self.top_of_repo):] 409 new_subpath = self.dir_to_import[len(self.top_of_repo):]
415 410
416 destination_directory = self.filesystem.join(self.destination_directory, new_subpath) 411 destination_directory = self.filesystem.join(self.destination_directory, new_subpath)
417 412
418 if not self.filesystem.exists(destination_directory): 413 if not self.filesystem.exists(destination_directory):
419 self.filesystem.maybe_make_directory(destination_directory) 414 self.filesystem.maybe_make_directory(destination_directory)
420 415
421 _log.info('Tests will be imported into: %s', destination_directory) 416 _log.info('Tests will be imported into: %s', destination_directory)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698