def main(): parser = optparse.OptionParser() parser.add_option('--output-format', default='html', help='The output format of the results file.') parser.add_option( '--output-dir', default=None, help='The directory for the output file. Default value is ' 'the base directory of this script.') options, _ = parser.parse_args() constants.SetBuildType(perf_test_utils.BUILD_TYPE) # Install APK device = GetDevice() device.EnableRoot() device.Install(perf_test_utils.APP_APK) # Start USB reverse tethering. android_rndis_forwarder.AndroidRndisForwarder( device, perf_test_utils.GetAndroidRndisConfig(device)) # Start HTTP server. http_server_doc_root = perf_test_utils.GenerateHttpTestResources() config_file = tempfile.NamedTemporaryFile() http_server = lighttpd_server.LighttpdServer( http_server_doc_root, port=perf_test_utils.HTTP_PORT, base_config_path=config_file.name) perf_test_utils.GenerateLighttpdConfig(config_file, http_server_doc_root, http_server) assert http_server.StartupHttpServer() config_file.close() # Start QUIC server. quic_server_doc_root = perf_test_utils.GenerateQuicTestResources(device) quic_server = perf_test_utils.QuicServer(quic_server_doc_root) quic_server.StartupQuicServer(device) # Launch Telemetry's benchmark_runner on CronetPerfTestBenchmark. # By specifying this file's directory as the benchmark directory, it will # allow benchmark_runner to in turn open this file up and find the # CronetPerfTestBenchmark class to run the benchmark. top_level_dir = os.path.dirname(os.path.realpath(__file__)) expectations_file = os.path.join(top_level_dir, 'expectations.config') runner_config = chromium_config.ChromiumConfig( top_level_dir=top_level_dir, benchmark_dirs=[top_level_dir], expectations_file=expectations_file) sys.argv.insert(1, 'run') sys.argv.insert(2, 'run.CronetPerfTestBenchmark') sys.argv.insert(3, '--browser=android-system-chrome') sys.argv.insert(4, '--output-format=' + options.output_format) if options.output_dir: sys.argv.insert(5, '--output-dir=' + options.output_dir) benchmark_runner.main(runner_config) # Shutdown. quic_server.ShutdownQuicServer() shutil.rmtree(quic_server_doc_root) http_server.ShutdownHttpServer() shutil.rmtree(http_server_doc_root)
def main(): constants.SetBuildType(BUILD_TYPE) # Install APK device = GetDevice() device.EnableRoot() device.Install(APP_APK) # Start USB reverse tethering. android_rndis_forwarder.AndroidRndisForwarder( device, GetAndroidRndisConfig(device)) # Start HTTP server. http_server_doc_root = GenerateHttpTestResources() config_file = tempfile.NamedTemporaryFile() http_server = lighttpd_server.LighttpdServer( http_server_doc_root, port=HTTP_PORT, base_config_path=config_file.name) GenerateLighttpdConfig(config_file, http_server_doc_root, http_server) assert http_server.StartupHttpServer() config_file.close() # Start QUIC server. quic_server_doc_root = GenerateQuicTestResources(device) quic_server = QuicServer(quic_server_doc_root) quic_server.StartupQuicServer(device) # Launch Telemetry's benchmark_runner on CronetPerfTestBenchmark. # By specifying this file's directory as the benchmark directory, it will # allow benchmark_runner to in turn open this file up and find the # CronetPerfTestBenchmark class to run the benchmark. top_level_dir = os.path.dirname(os.path.realpath(__file__)) # The perf config file is required to continue using dependencies on the # Chromium checkout in Telemetry. perf_config_file = os.path.join(REPOSITORY_ROOT, 'tools', 'perf', 'core', 'binary_dependencies.json') with open(perf_config_file, "w") as config_file: config_file.write('{"config_type": "BaseConfig"}') runner_config = project_config.ProjectConfig( top_level_dir=top_level_dir, benchmark_dirs=[top_level_dir], client_configs=[perf_config_file], default_chrome_root=REPOSITORY_ROOT) sys.argv.insert(1, 'run') sys.argv.insert(2, 'run.CronetPerfTestBenchmark') benchmark_runner.main(runner_config) # Shutdown. quic_server.ShutdownQuicServer() shutil.rmtree(quic_server_doc_root) http_server.ShutdownHttpServer() shutil.rmtree(http_server_doc_root)