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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/cli_wrapper.py

Issue 2719633002: Add descriptions with examples to run-blink-* scripts. (Closed)
Patch Set: Expand comment Created 3 years, 9 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
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. 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 are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 14 matching lines...) Expand all
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 """A utility module for making standalone scripts to start servers. 29 """A utility module for making standalone scripts to start servers.
30 30
31 Scripts in Tools/Scripts can use this module to start servers that 31 Scripts in Tools/Scripts can use this module to start servers that
32 are normally used for layout tests, outside of the layout test runner. 32 are normally used for layout tests, outside of the layout test runner.
33 """ 33 """
34 34
35 import argparse
35 import logging 36 import logging
36 import argparse
37 37
38 from webkitpy.common.host import Host 38 from webkitpy.common.host import Host
39 39
40 40
41 def main(server_constructor, input_fn=None, argv=None, **kwargs): 41 def main(server_constructor, input_fn=None, argv=None, description=None, **kwarg s):
42 input_fn = input_fn or raw_input 42 input_fn = input_fn or raw_input
43 43
44 parser = argparse.ArgumentParser() 44 parser = argparse.ArgumentParser(description=description, formatter_class=ar gparse.RawTextHelpFormatter)
45 parser.add_argument('--output-dir', type=str, default=None, 45 parser.add_argument('--output-dir', type=str, default=None,
46 help='output directory, for log files etc.') 46 help='output directory, for log files etc.')
47 parser.add_argument('-v', '--verbose', action='store_true', 47 parser.add_argument('-v', '--verbose', action='store_true',
48 help='print more information, including port numbers') 48 help='print more information, including port numbers')
49 args = parser.parse_args(argv) 49 args = parser.parse_args(argv)
50 50
51 logging.basicConfig() 51 logging.basicConfig()
52 logger = logging.getLogger() 52 logger = logging.getLogger()
53 logger.setLevel(logging.DEBUG if args.verbose else logging.INFO) 53 logger.setLevel(logging.DEBUG if args.verbose else logging.INFO)
54 54
55 host = Host() 55 host = Host()
56 port_obj = host.port_factory.get() 56 port_obj = host.port_factory.get()
57 if not args.output_dir: 57 if not args.output_dir:
58 args.output_dir = port_obj.default_results_directory() 58 args.output_dir = port_obj.default_results_directory()
59 59
60 # Create the output directory if it doesn't already exist. 60 # Create the output directory if it doesn't already exist.
61 port_obj.host.filesystem.maybe_make_directory(args.output_dir) 61 port_obj.host.filesystem.maybe_make_directory(args.output_dir)
62 62
63 server = server_constructor(port_obj, args.output_dir, **kwargs) 63 server = server_constructor(port_obj, args.output_dir, **kwargs)
64 server.start() 64 server.start()
65 try: 65 try:
66 _ = input_fn('Hit any key to stop the server and exit.') 66 _ = input_fn('Hit any key to stop the server and exit.')
67 except (KeyboardInterrupt, EOFError): 67 except (KeyboardInterrupt, EOFError):
68 pass 68 pass
69 69
70 server.stop() 70 server.stop()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698