Only fsync leveldb's directory when the manifest is being updated.
[chromium-blink-merge.git] / tools / playback_benchmark / run.py
blob04ed12bc0d3bc993f8c5f1633d0ce4df2965fefb
1 #!/usr/bin/env python
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
4 # found in the LICENSE file.
6 """Tests playback.
8 Prerequisites:
9 1. OpenSSL library - http://www.openssl.org/
10 2. Python interface to the OpenSSL library - https://launchpad.net/pyopenssl
12 Example usage:
13 python run.py -t <test_dir>
14 """
16 from optparse import OptionParser
17 import sys
19 import playback_driver
20 import proxy_handler
23 def Run(options):
24 driver = playback_driver.PlaybackRequestHandler(options.test_dir)
25 httpd = proxy_handler.CreateServer(driver, options.port)
26 sa = httpd.socket.getsockname()
27 print "Serving HTTP on", sa[0], "port", sa[1], "..."
28 httpd.serve_forever()
31 def main():
32 parser = OptionParser()
33 parser.add_option("-t", "--test-dir", dest="test_dir",
34 help="directory containing recorded test data")
35 parser.add_option("-p", "--port", dest="port", type="int", default=8000)
36 options = parser.parse_args()[0]
37 if not options.test_dir:
38 raise Exception('please specify test directory')
40 Run(options)
43 if __name__ == '__main__':
44 sys.exit(main())