1#!/usr/bin/env python
2
3"""
4This file generates all telemetry_Benchmarks control files from a master list.
5"""
6
7# This test list is a subset of telemetry benchmark tests. The full list can be
8# obtained by executing
9# /build/${BOARD}/usr/local/telemetry/src/tools/perf/list_benchmarks
10
11# PLEASE READ THIS:
12
13# PERF_TESTS: these tests run on each build: tot, tot-1, tot-2 and expensive to
14# run.
15
16# PERF_DAILY_RUN_TESTS: these tests run on a nightly build: tot. If you are
17# trying to gain confidence for a new test, adding your test in this list is a
18# good start.
19
20# For adding a new test to any of these lists, please add rohitbm, lafeenstra,
21# haddowk in the change.
22
23PERF_PER_BUILD_TESTS = (
24    'jetstream',
25    'kraken',
26    'octane',
27    'smoothness.top_25_smooth',
28    'speedometer',
29    'startup.cold.blank_page',
30)
31
32PERF_DAILY_RUN_TESTS = (
33    'dromaeo.domcoreattr',
34    'dromaeo.domcoremodify',
35    'dromaeo.domcorequery',
36    'dromaeo.domcoretraverse',
37    'image_decoding.image_decoding_measurement',
38    'memory.top_7_stress',
39    'page_cycler_v2.typical_25',
40    'robohornet_pro',
41    'smoothness.tough_animation_cases',
42    'smoothness.tough_canvas_cases',
43    'smoothness.tough_filters_cases',
44    'smoothness.tough_pinch_zoom_cases',
45    'smoothness.tough_scrolling_cases',
46    'smoothness.tough_webgl_cases',
47    'sunspider',
48    'tab_switching.top_10',
49    'webrtc.peerconnection',
50    'webrtc.stress',
51)
52
53PERF_NO_SUITE = (
54    'page_cycler.typical_25',
55)
56
57ALL_TESTS = PERF_PER_BUILD_TESTS + PERF_DAILY_RUN_TESTS + PERF_NO_SUITE
58
59CONTROLFILE_TEMPLATE = (
60"""# Copyright 2014 The Chromium OS Authors. All rights reserved.
61# Use of this source code is governed by a BSD-style license that can be
62# found in the LICENSE file.
63
64# Do not edit this file! It was created by generate_controlfiles.py.
65
66from autotest_lib.client.common_lib import utils
67
68AUTHOR = 'sbasi, achuith, rohitbm'
69NAME = 'telemetry_Benchmarks.{test}'
70{attributes}
71TIME = 'LONG'
72TEST_CATEGORY = 'Benchmark'
73TEST_CLASS = 'performance'
74TEST_TYPE = 'server'
75
76DOC = '''
77This server side test suite executes the Telemetry Benchmark:
78{test}
79This is part of Chrome for Chrome OS performance testing.
80
81Pass local=True to run with local telemetry and no AFE server.
82'''
83
84def run_benchmark(machine):
85    host = hosts.create_host(machine)
86    job.run_test('telemetry_Benchmarks', host=host,
87                 benchmark='{test}',
88                 tag='{test}',
89                 args=utils.args_to_dict(args))
90
91parallel_simple(run_benchmark, machines)""")
92
93
94def _get_suite(test):
95    if test in PERF_PER_BUILD_TESTS:
96        return 'ATTRIBUTES = \'suite:crosbolt_perf_perbuild\''
97    elif test in PERF_DAILY_RUN_TESTS:
98        return 'ATTRIBUTES = \'suite:crosbolt_perf_nightly\''
99    return ''
100
101
102for test in ALL_TESTS:
103    filename = 'control.%s' % test
104    with open(filename, 'w+') as f:
105        content = CONTROLFILE_TEMPLATE.format(
106                test=test,
107                attributes=_get_suite(test))
108        f.write(content)
109