2 # Copyright (c) 2012 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.
12 BASE_URL
= 'http://src.chromium.org/chrome/trunk/'
13 DEPS_FILE
= 'bootstrap_deps'
15 SCRIPT_PATH
= os
.path
.dirname(os
.path
.abspath(__file__
))
16 # Directory containing src/ in a Chromium checkout.
17 CHECKOUT_BASE_PATH
= os
.path
.join(SCRIPT_PATH
, os
.pardir
, os
.pardir
, os
.pardir
)
18 # Directory in which to save bootstrap files.
19 BOOTSTRAP_BASE_PATH
= os
.path
.join(SCRIPT_PATH
, 'support', 'bootstrap_files')
21 CROS_DIR
= os
.path
.join('src', 'tools', 'cros')
22 PERF_DIR
= os
.path
.join('src', 'tools', 'perf')
23 TELEMETRY_DIR
= os
.path
.join('src', 'tools', 'telemetry')
24 TELEMETRY_TOOLS_DIR
= os
.path
.join('src', 'tools', 'telemetry_tools')
28 """Find the location of our Chromium or bootstrap checkout.
30 It tries to import Telemetry. If the import succeeds,
31 we assume that's the correct location.
34 The path containing the src/ directory, or None if no checkout is found.
36 module_name
= 'telemetry'
37 module_path
= TELEMETRY_DIR
40 paths
= [os
.path
.join(CHECKOUT_BASE_PATH
, module_path
)]
41 imp
.find_module(module_name
, paths
)
42 return CHECKOUT_BASE_PATH
44 raise Exception('Unnable to compute base path')
46 def ListBootstrapDeps(base_path
, subdir
):
47 """List the deps required for telemetry."""
48 sys
.path
.append(os
.path
.join(base_path
, TELEMETRY_TOOLS_DIR
))
49 import telemetry_bootstrap
51 deps_file
= os
.path
.join(base_path
, subdir
, DEPS_FILE
)
52 return telemetry_bootstrap
.ListAllDepsPaths(deps_file
)
56 new_base_path
= _GetBasePath()
57 new_perf_path
= os
.path
.join(new_base_path
, PERF_DIR
)
58 new_telemetry_path
= os
.path
.join(new_base_path
, TELEMETRY_DIR
)
60 if '--print-bootstrap-deps-cros' in sys
.argv
:
61 print ListBootstrapDeps(new_base_path
, CROS_DIR
)
64 old_benchmark_names
= {
65 "image_decoding_benchmark": "image_decoding",
66 "image_decoding_measurement": "image_decoding",
67 "loading_benchmark": "loading",
68 "loading_measurement": "loading",
69 "media_measurement": "media",
70 "memory_benchmark": "memory",
71 "memory_measurement": "memory",
72 "rasterize_and_record_benchmark": "rasterize_and_record",
73 "rasterize_and_record_measurement": "rasterize_and_record",
74 "robohornetpro": "robohornet_pro",
75 "scrolling_benchmark": "smoothness",
76 "smoothness_benchmark": "smoothness",
77 "smoothness_measurement": "smoothness",
78 "startup_benchmark": "startup_warm_blank_page",
79 "startup_measurement": "startup",
80 "tab_switching_measurement": "tab_switching",
83 sys
.path
.append(new_telemetry_path
)
84 from telemetry
.page
import page_measurement_runner
85 from telemetry
.core
import environment
86 # There are bots that are hard-coded to run some specific named tests.
87 # Convert these to the current naming conventions by overriding them
89 class MeasurementRunner(page_measurement_runner
.PageMeasurementRunner
):
90 def GetModernizedTestName(self
, arg
):
91 if arg
not in old_benchmark_names
:
94 'An old name %s was given. Please use %s in the future.\n' % (
96 old_benchmark_names
.get(arg
)))
97 return old_benchmark_names
[arg
]
99 runner
= MeasurementRunner()
100 env
= environment
.Environment([new_perf_path
])
101 return runner
.Run(env
)
104 if __name__
== '__main__':