OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # |
| 3 # Copyright 2010 Google Inc. All Rights Reserved. |
| 4 |
| 5 """Script for test playback. |
| 6 |
| 7 Prerequisites: |
| 8 1. OpenSSL library - http://www.openssl.org/ |
| 9 2. Python interface to the OpenSSL library - https://launchpad.net/pyopenssl |
| 10 |
| 11 Example usage: |
| 12 python run.py -t <test_dir> |
| 13 """ |
| 14 |
| 15 from optparse import OptionParser |
| 16 |
| 17 import playback_driver |
| 18 import proxy_handler |
| 19 |
| 20 |
| 21 def Run(options): |
| 22 driver = playback_driver.PlaybackRequestHandler(options.test_dir) |
| 23 httpd = proxy_handler.CreateServer(driver, options.port) |
| 24 sa = httpd.socket.getsockname() |
| 25 print "Serving HTTP on", sa[0], "port", sa[1], "..." |
| 26 httpd.serve_forever() |
| 27 |
| 28 |
| 29 if __name__ == '__main__': |
| 30 parser = OptionParser() |
| 31 parser.add_option("-t", "--test-dir", dest="test_dir", |
| 32 help="directory containing recorded test data") |
| 33 parser.add_option("-p", "--port", dest="port", type="int", default=8000) |
| 34 options = parser.parse_args()[0] |
| 35 if not options.test_dir: |
| 36 raise Exception('please specify test directory') |
| 37 |
| 38 Run(options) |
| 39 |
OLD | NEW |