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

Side by Side Diff: media/tools/constrained_network_server/cn.py

Issue 9127009: Constrained Network test does not fail fast under fatal conditions. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Nits. Created 8 years, 11 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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """A script for configuring constraint networks. 6 """A script for configuring constraint networks.
7 7
8 Sets up a constrained network configuration on a specific port. Traffic on this 8 Sets up a constrained network configuration on a specific port. Traffic on this
9 port will be redirected to another local server port. 9 port will be redirected to another local server port.
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 (indent_first, '', opt_width, s, COMMANDS[s].desc)) 59 (indent_first, '', opt_width, s, COMMANDS[s].desc))
60 60
61 parser.usage = ('usage: %%prog {%s} [options]\n\n%s' % 61 parser.usage = ('usage: %%prog {%s} [options]\n\n%s' %
62 ('|'.join(COMMANDS.keys()), '\n'.join(cmd_usage))) 62 ('|'.join(COMMANDS.keys()), '\n'.join(cmd_usage)))
63 63
64 parser.add_option('--port', type='int', 64 parser.add_option('--port', type='int',
65 help='The port to apply traffic control constraints to.') 65 help='The port to apply traffic control constraints to.')
66 parser.add_option('--server-port', type='int', 66 parser.add_option('--server-port', type='int',
67 help='Port to forward traffic on --port to.') 67 help='Port to forward traffic on --port to.')
68 parser.add_option('--bandwidth', type='int', 68 parser.add_option('--bandwidth', type='int',
69 help='Bandwidth of the network in kbps.') 69 help='Bandwidth of the network in kbit/s.')
70 parser.add_option('--latency', type='int', 70 parser.add_option('--latency', type='int',
71 help=('Latency (delay) added to each outgoing packet in ' 71 help=('Latency (delay) added to each outgoing packet in '
72 'ms.')) 72 'ms.'))
73 parser.add_option('--loss', type='int', 73 parser.add_option('--loss', type='int',
74 help='Packet-loss percentage on outgoing packets. ') 74 help='Packet-loss percentage on outgoing packets. ')
75 parser.add_option('--interface', type='string', 75 parser.add_option('--interface', type='string',
76 help=('Interface to setup constraints on. Use "lo" for a ' 76 help=('Interface to setup constraints on. Use "lo" for a '
77 'local client.')) 77 'local client.'))
78 parser.add_option('-v', '--verbose', action='store_true', dest='verbose', 78 parser.add_option('-v', '--verbose', action='store_true', dest='verbose',
79 default=False, help='Turn on verbose output.') 79 default=False, help='Turn on verbose output.')
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 user_cmd, config = _ParseArgs() 114 user_cmd, config = _ParseArgs()
115 115
116 try: 116 try:
117 COMMANDS[user_cmd].dispatch(config) 117 COMMANDS[user_cmd].dispatch(config)
118 except traffic_control.TrafficControlError as e: 118 except traffic_control.TrafficControlError as e:
119 logging.error('Error: %s\n\nOutput: %s', e.msg, e.error) 119 logging.error('Error: %s\n\nOutput: %s', e.msg, e.error)
120 120
121 121
122 if __name__ == '__main__': 122 if __name__ == '__main__':
123 Main() 123 Main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698