| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 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 """This script runs an automated Cronet performance benchmark. | 6 """This script runs an automated Cronet performance benchmark. |
| 7 | 7 |
| 8 This script: | 8 This script: |
| 9 1. Sets up "USB reverse tethering" which allow network traffic to flow from | 9 1. Sets up "USB reverse tethering" which allow network traffic to flow from |
| 10 an Android device connected to the host machine via a USB cable. | 10 an Android device connected to the host machine via a USB cable. |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 return CronetPerfTestStorySet(self._device) | 212 return CronetPerfTestStorySet(self._device) |
| 213 | 213 |
| 214 | 214 |
| 215 class QuicServer(object): | 215 class QuicServer(object): |
| 216 | 216 |
| 217 def __init__(self, quic_server_doc_root): | 217 def __init__(self, quic_server_doc_root): |
| 218 self._process = None | 218 self._process = None |
| 219 self._quic_server_doc_root = quic_server_doc_root | 219 self._quic_server_doc_root = quic_server_doc_root |
| 220 | 220 |
| 221 def StartupQuicServer(self, device): | 221 def StartupQuicServer(self, device): |
| 222 # Chromium's presubmit checks aren't smart enough to understand |
| 223 # the redirect done in build/android/pylib/pexpect.py. |
| 224 # pylint: disable=no-member |
| 222 self._process = pexpect.spawn(QUIC_SERVER, | 225 self._process = pexpect.spawn(QUIC_SERVER, |
| 223 ['--quic_in_memory_cache_dir=%s' % | 226 ['--quic_in_memory_cache_dir=%s' % |
| 224 self._quic_server_doc_root, | 227 self._quic_server_doc_root, |
| 225 '--certificate_file=%s' % QUIC_CERT, | 228 '--certificate_file=%s' % QUIC_CERT, |
| 226 '--key_file=%s' % QUIC_KEY, | 229 '--key_file=%s' % QUIC_KEY, |
| 227 '--port=%d' % QUIC_PORT]) | 230 '--port=%d' % QUIC_PORT]) |
| 228 assert self._process != None | 231 assert self._process != None |
| 229 # Wait for quic_server to start serving. | 232 # Wait for quic_server to start serving. |
| 230 waited_s = 0 | 233 waited_s = 0 |
| 231 while subprocess.call(['lsof', '-i', 'udp:%d' % QUIC_PORT, '-p', | 234 while subprocess.call(['lsof', '-i', 'udp:%d' % QUIC_PORT, '-p', |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 benchmark_runner.main(runner_config) | 338 benchmark_runner.main(runner_config) |
| 336 # Shutdown. | 339 # Shutdown. |
| 337 quic_server.ShutdownQuicServer() | 340 quic_server.ShutdownQuicServer() |
| 338 shutil.rmtree(quic_server_doc_root) | 341 shutil.rmtree(quic_server_doc_root) |
| 339 http_server.ShutdownHttpServer() | 342 http_server.ShutdownHttpServer() |
| 340 shutil.rmtree(http_server_doc_root) | 343 shutil.rmtree(http_server_doc_root) |
| 341 | 344 |
| 342 | 345 |
| 343 if __name__ == '__main__': | 346 if __name__ == '__main__': |
| 344 main() | 347 main() |
| OLD | NEW |