• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2# Copyright (C) 2019 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15'''Project-wide configuration
16
17This file is either imported from other python scripts or executed to generate
18makefile dumps of the variables. This is so all vars can live in one place.
19'''
20
21from __future__ import print_function
22
23# Gerrit config
24GERRIT_HOST = 'android-review.googlesource.com'
25GERRIT_PROJECT = 'platform/external/perfetto'
26GERRIT_REVIEW_URL = ('https://android-review.googlesource.com/c/' +
27                     GERRIT_PROJECT)
28REPO_URL = 'https://android.googlesource.com/' + GERRIT_PROJECT
29GERRIT_POLL_SEC = 15
30GERRIT_VOTING_ENABLED = True
31LOGLEVEL = 'info'
32
33# Cloud config (GCE = Google Compute Engine, GAE = Google App Engine)
34PROJECT = 'perfetto-ci'
35GAE_VERSION = 'prod'
36DB_ROOT = 'https://%s.firebaseio.com' % PROJECT
37DB = DB_ROOT + '/ci'
38SANDBOX_IMG = 'eu.gcr.io/%s/sandbox' % PROJECT
39WORKER_IMG = 'eu.gcr.io/%s/worker' % PROJECT
40CI_SITE = 'https://ci.perfetto.dev'
41GCS_ARTIFACTS = 'perfetto-ci-artifacts'
42
43JOB_TIMEOUT_SEC = 45 * 60
44CL_TIMEOUT_SEC = 60 * 60 * 3
45LOGS_TTL_DAYS = 15
46TRUSTED_EMAILS = '^.*@google.com$'
47
48GCE_ZONES = 'us-central1-b us-east1-b us-west1-b'
49GCE_VM_NAME = 'ci-worker'
50GCE_VM_TYPE = 'c2-standard-8'
51GCE_TEMPLATE = 'ci-worker-template'
52GCE_GROUP_NAME = 'ci'
53NUM_VMS = 3
54NUM_WORKERS_PER_VM = 2
55
56GCE_SCOPES = [
57    'https://www.googleapis.com/auth/cloud-platform',
58    'https://www.googleapis.com/auth/devstorage.read_write',
59    'https://www.googleapis.com/auth/firebase.database',
60    'https://www.googleapis.com/auth/logging.write',
61    'https://www.googleapis.com/auth/monitoring.write',
62    'https://www.googleapis.com/auth/trace.append',
63    'https://www.googleapis.com/auth/userinfo.email',
64]
65
66# Only variables starting with PERFETTO_ are propagated into the sandbox.
67JOB_CONFIGS = {
68    'linux-clang-x86_64-debug': {
69        'PERFETTO_TEST_GN_ARGS': 'is_debug=true is_hermetic_clang=false '
70                                 'non_hermetic_clang_stdlib="libc++" '
71                                 'enable_perfetto_merged_protos_check=true',
72        'PERFETTO_TEST_SCRIPT': 'test/ci/linux_tests.sh',
73    },
74    'linux-clang-x86_64-tsan': {
75        'PERFETTO_TEST_GN_ARGS': 'is_debug=false is_tsan=true',
76        'PERFETTO_TEST_SCRIPT': 'test/ci/linux_tests.sh',
77    },
78    'linux-clang-x86_64-msan': {
79        'PERFETTO_TEST_GN_ARGS': 'is_debug=false is_msan=true',
80        'PERFETTO_TEST_SCRIPT': 'test/ci/linux_tests.sh',
81    },
82    'linux-clang-x86_64-asan_lsan': {
83        'PERFETTO_TEST_GN_ARGS': 'is_debug=false is_asan=true is_lsan=true',
84        'PERFETTO_TEST_SCRIPT': 'test/ci/linux_tests.sh',
85    },
86    'linux-clang-x86-asan_lsan': {
87        'PERFETTO_TEST_GN_ARGS': 'is_debug=false is_asan=true is_lsan=true '
88                                 'target_cpu="x86"',
89        'PERFETTO_TEST_SCRIPT': 'test/ci/linux_tests.sh',
90    },
91    'linux-gcc7-x86_64-release': {
92        'PERFETTO_TEST_GN_ARGS': 'is_debug=false is_clang=false '
93                                 'cc="gcc-7" cxx="g++-7"',
94        'PERFETTO_TEST_SCRIPT': 'test/ci/linux_tests.sh',
95    },
96    'android-clang-arm-release': {
97        'PERFETTO_TEST_GN_ARGS':
98            'is_debug=false target_os="android" target_cpu="arm"',
99        'PERFETTO_TEST_SCRIPT':
100            'test/ci/android_tests.sh',
101    },
102    'linux-clang-x86_64-libfuzzer': {
103        'PERFETTO_TEST_GN_ARGS': 'is_debug=false is_fuzzer=true is_asan=true',
104        'PERFETTO_TEST_SCRIPT': 'test/ci/fuzzer_tests.sh',
105    },
106    'linux-clang-x86_64-bazel': {
107        'PERFETTO_TEST_GN_ARGS': '',
108        'PERFETTO_TEST_SCRIPT': 'test/ci/bazel_tests.sh',
109    },
110    'ui-clang-x86_64-release': {
111        'PERFETTO_TEST_GN_ARGS': 'is_debug=false',
112        'PERFETTO_TEST_SCRIPT': 'test/ci/ui_tests.sh',
113    },
114}
115
116if __name__ == '__main__':
117  import os
118  import json
119  import re
120  import sys
121  vars = dict(kv for kv in locals().items() if re.match('^[A-Z0-9_]+$', kv[0]))
122
123  if len(sys.argv) > 1 and sys.argv[1] == 'makefile':
124    deps_path = os.path.join(os.path.dirname(__file__), '.deps')
125    if not os.path.exists(deps_path):
126      os.mkdir(deps_path)
127    gen_file = os.path.join(deps_path, 'config.mk')
128
129    try:
130      literals = (int, long, basestring)
131    except NameError:
132      literals = (int, str)
133
134    with open(gen_file, 'w') as f:
135      for k, v in vars.items():
136        if isinstance(v, literals):
137          f.write('override %s=%s\n' % (k, v))
138        elif isinstance(v, list):
139          f.write('override %s=%s\n' % (k, ','.join(v)))
140
141    print(gen_file)
142
143  if len(sys.argv) > 1 and sys.argv[1] == 'js':
144    jsn = json.dumps(vars, indent=2)
145    print('// Auto-generated by %s, do not edit.\n' %
146          os.path.basename(__file__))
147    print('\'use strict\';\n')
148    print('const cfg = JSON.parse(`%s`);\n' % jsn.replace(r'\"', r'\\\"'))
149