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. # Port map is ignored for tethering; must create one to placate assertions. named_port_pair_map = { 'http': (forwarders.PortPair(0, 0)), 'https': None, 'dns': None } port_pairs = forwarders.PortPairs(**named_port_pair_map) forwarder = GetForwarderFactory(device).Create(port_pairs) # 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 = benchmark_runner.ProjectConfig( top_level_dir=top_level_dir, benchmark_dirs=[top_level_dir], client_config=perf_config_file, default_chrome_root=REPOSITORY_ROOT) sys.argv.insert(1, 'run') sys.argv.insert(2, 'run.CronetPerfTestBenchmark') sys.argv.insert(3, '--android-rndis') 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. # Port map is ignored for tethering; must create one to placate assertions. named_port_pair_map = {'http': (forwarders.PortPair(0, 0)), 'https': None, 'dns': None} port_pairs = forwarders.PortPairs(**named_port_pair_map) forwarder = GetForwarderFactory(device).Create(port_pairs) # 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') sys.argv.insert(3, '--android-rndis') 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. # Port map is ignored for tethering; must create one to placate assertions. named_port_pair_map = { 'http': (forwarders.PortPair(0, 0)), 'https': None, 'dns': None } port_pairs = forwarders.PortPairs(**named_port_pair_map) forwarder = GetForwarderFactory(device).Create(port_pairs) # 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__)) runner_config = benchmark_runner.ProjectConfig( top_level_dir=top_level_dir, benchmark_dirs=[top_level_dir]) sys.argv.insert(1, 'run') sys.argv.insert(2, 'run.CronetPerfTestBenchmark') sys.argv.insert(3, '--android-rndis') 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(): config = chromium_config.ChromiumConfig( benchmark_dirs=[ path_util.GetOfficialBenchmarksDir(), path_util.GetContribDir() ], top_level_dir=path_util.GetPerfDir(), expectations_files=[path_util.GetExpectationsPath()]) return benchmark_runner.main(config)
def main(): constants.SetBuildType(BUILD_TYPE) # Install APK device = GetDevice() device.EnableRoot() device.Install(APP_APK) # Start USB reverse tethering. # Port map is ignored for tethering; must create one to placate assertions. named_port_pair_map = {'http': (forwarders.PortPair(0, 0)), 'https': None, 'dns': None} port_pairs = forwarders.PortPairs(**named_port_pair_map) forwarder = GetForwarderFactory(device).Create(port_pairs) # 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__)) runner_config = benchmark_runner.ProjectConfig( top_level_dir=top_level_dir, benchmark_dirs=[top_level_dir]) sys.argv.insert(1, 'run') sys.argv.insert(2, 'run.CronetPerfTestBenchmark') sys.argv.insert(3, '--android-rndis') benchmark_runner.main(runner_config) # Shutdown. quic_server.ShutdownQuicServer() shutil.rmtree(quic_server_doc_root) http_server.ShutdownHttpServer() shutil.rmtree(http_server_doc_root)
us at launch time. This function is called when the flag --spawn-dbus is given, and if _LaunchDBus(), above, actually spawned the dbus-daemon. """ import signal if 'DBUS_SESSION_BUS_PID' in os.environ: dbus_pid = os.environ['DBUS_SESSION_BUS_PID'] try: os.kill(int(dbus_pid), signal.SIGTERM) print ' killed dbus-daemon with PID %s' % dbus_pid except OSError as e: print ' error killing dbus-daemon with PID %s: %s' % (dbus_pid, e) # Try to clean up any stray DBUS_SESSION_BUS_ADDRESS environment # variable too. Some of the bots seem to re-invoke runtest.py in a # way that this variable sticks around from run to run. if 'DBUS_SESSION_BUS_ADDRESS' in os.environ: del os.environ['DBUS_SESSION_BUS_ADDRESS'] print ' cleared DBUS_SESSION_BUS_ADDRESS environment variable' if __name__ == '__main__': did_launch_dbus = _LaunchDBus() try: retcode = benchmark_runner.main(gpu_project_config.CONFIG) finally: if did_launch_dbus: _ShutdownDBus() sys.exit(retcode)
#!/usr/bin/env python # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, 'tools', 'telemetry')) from telemetry import benchmark_runner from telemetry.core import environment if __name__ == '__main__': base_dir = os.path.dirname(os.path.realpath(__file__)) benchmark_runner.config = environment.Environment([base_dir]) sys.exit(benchmark_runner.main())
def testDependentStoryIsDependent(self, exit_mock): with mock.patch.object( sys, 'argv', ['foo', 'check_independent', 'dependent']): benchmark_runner.main(self.config) exit_mock.assert_called_with(1)
def main(): config = MyConfig() extra_commands = [RecordTrace] return benchmark_runner.main(config, extra_commands=extra_commands)
def main(): return benchmark_runner.main(media_router_config.Config(['benchmarks']))
def testDependentStoryIsDependent(self, exit_mock): with mock.patch.object(sys, 'argv', ['foo', 'check_independent', 'dependent']): benchmark_runner.main(self.config) exit_mock.assert_called_with(1)
import signal if 'DBUS_SESSION_BUS_PID' in os.environ: dbus_pid = os.environ['DBUS_SESSION_BUS_PID'] try: os.kill(int(dbus_pid), signal.SIGTERM) print ' killed dbus-daemon with PID %s' % dbus_pid except OSError as e: print ' error killing dbus-daemon with PID %s: %s' % (dbus_pid, e) # Try to clean up any stray DBUS_SESSION_BUS_ADDRESS environment # variable too. Some of the bots seem to re-invoke runtest.py in a # way that this variable sticks around from run to run. if 'DBUS_SESSION_BUS_ADDRESS' in os.environ: del os.environ['DBUS_SESSION_BUS_ADDRESS'] print ' cleared DBUS_SESSION_BUS_ADDRESS environment variable' if __name__ == '__main__': top_level_dir = os.path.dirname(os.path.realpath(__file__)) config = benchmark_runner.ProjectConfig( top_level_dir=top_level_dir, benchmark_dirs=[os.path.join(top_level_dir, 'gpu_tests')]) did_launch_dbus = _LaunchDBus() try: retcode = benchmark_runner.main(config) finally: if did_launch_dbus: _ShutdownDBus() sys.exit(retcode)
_LaunchDBus(), above, actually spawned the dbus-daemon. """ import signal if 'DBUS_SESSION_BUS_PID' in os.environ: dbus_pid = os.environ['DBUS_SESSION_BUS_PID'] try: os.kill(int(dbus_pid), signal.SIGTERM) print ' killed dbus-daemon with PID %s' % dbus_pid except OSError as e: print ' error killing dbus-daemon with PID %s: %s' % (dbus_pid, e) # Try to clean up any stray DBUS_SESSION_BUS_ADDRESS environment # variable too. Some of the bots seem to re-invoke runtest.py in a # way that this variable sticks around from run to run. if 'DBUS_SESSION_BUS_ADDRESS' in os.environ: del os.environ['DBUS_SESSION_BUS_ADDRESS'] print ' cleared DBUS_SESSION_BUS_ADDRESS environment variable' if __name__ == '__main__': base_dir = os.path.dirname(os.path.realpath(__file__)) benchmark_runner.config = environment.Environment([base_dir]) did_launch_dbus = _LaunchDBus() try: retcode = benchmark_runner.main() finally: if did_launch_dbus: _ShutdownDBus() sys.exit(retcode)
import signal if 'DBUS_SESSION_BUS_PID' in os.environ: dbus_pid = os.environ['DBUS_SESSION_BUS_PID'] try: os.kill(int(dbus_pid), signal.SIGTERM) print ' killed dbus-daemon with PID %s' % dbus_pid except OSError as e: print ' error killing dbus-daemon with PID %s: %s' % (dbus_pid, e) # Try to clean up any stray DBUS_SESSION_BUS_ADDRESS environment # variable too. Some of the bots seem to re-invoke runtest.py in a # way that this variable sticks around from run to run. if 'DBUS_SESSION_BUS_ADDRESS' in os.environ: del os.environ['DBUS_SESSION_BUS_ADDRESS'] print ' cleared DBUS_SESSION_BUS_ADDRESS environment variable' if __name__ == '__main__': top_level_dir = os.path.dirname(os.path.realpath(__file__)) environment = benchmark_runner.Environment( top_level_dir=top_level_dir, benchmark_dirs=[os.path.join(top_level_dir, 'gpu_tests')]) did_launch_dbus = _LaunchDBus() try: retcode = benchmark_runner.main(environment) finally: if did_launch_dbus: _ShutdownDBus() sys.exit(retcode)