1#!/usr/bin/env python 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 = ( 27 'https://android-review.googlesource.com/c/' + 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' 35ZONE = 'us-west1-b' 36GAE_VERSION = 'prod' 37DB_ROOT = 'https://%s.firebaseio.com' % PROJECT 38DB = DB_ROOT + '/ci' 39SANDBOX_IMG = 'eu.gcr.io/%s/sandbox' % PROJECT 40WORKER_IMG = 'eu.gcr.io/%s/worker' % PROJECT 41CI_SITE = 'https://ci.perfetto.dev' 42GCS_ARTIFACTS = 'perfetto-ci-artifacts' 43 44JOB_TIMEOUT_SEC = 60 * 30 45CL_TIMEOUT_SEC = 60 * 60 * 3 46LOGS_TTL_DAYS = 15 47TRUSTED_EMAILS = '^.*@google.com$' 48 49GCE_VM_NAME = 'ci-worker' 50GCE_VM_TYPE = 'e2-standard-16' 51GCE_TEMPLATE = 'ci-worker-template' 52GCE_GROUP_NAME = 'ci' 53NUM_VMS = 6 54NUM_WORKERS_PER_VM = 5 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 'PERFETTO_TEST_SCRIPT': 'test/ci/linux_tests.sh', 71 }, 72 'linux-clang-x86_64-tsan': { 73 'PERFETTO_TEST_GN_ARGS': 'is_debug=false is_tsan=true', 74 'PERFETTO_TEST_SCRIPT': 'test/ci/linux_tests.sh', 75 }, 76 'linux-clang-x86_64-msan': { 77 'PERFETTO_TEST_GN_ARGS': 'is_debug=false is_msan=true', 78 'PERFETTO_TEST_SCRIPT': 'test/ci/linux_tests.sh', 79 }, 80 'linux-clang-x86_64-asan_lsan': { 81 'PERFETTO_TEST_GN_ARGS': 'is_debug=false is_asan=true is_lsan=true', 82 'PERFETTO_TEST_SCRIPT': 'test/ci/linux_tests.sh', 83 }, 84 'linux-clang-x86-asan_lsan': { 85 'PERFETTO_TEST_GN_ARGS': 'is_debug=false is_asan=true is_lsan=true ' 86 'target_cpu="x86"', 87 'PERFETTO_TEST_SCRIPT': 'test/ci/linux_tests.sh', 88 }, 89 'linux-gcc7-x86_64-release': { 90 'PERFETTO_TEST_GN_ARGS': 'is_debug=false is_clang=false ' 91 'cc="gcc-7" cxx="g++-7"', 92 'PERFETTO_TEST_SCRIPT': 'test/ci/linux_tests.sh', 93 }, 94 'android-clang-arm-release': { 95 'PERFETTO_TEST_GN_ARGS': 96 'is_debug=false target_os="android" target_cpu="arm"', 97 'PERFETTO_TEST_SCRIPT': 98 'test/ci/android_tests.sh', 99 }, 100 'android-clang-arm-asan': { 101 'PERFETTO_TEST_GN_ARGS': 'is_debug=false target_os="android" ' 102 'target_cpu="arm" is_asan=true', 103 'PERFETTO_TEST_SCRIPT': 'test/ci/android_tests.sh', 104 }, 105 'linux-clang-x86_64-libfuzzer': { 106 'PERFETTO_TEST_GN_ARGS': 'is_debug=false is_fuzzer=true is_asan=true', 107 'PERFETTO_TEST_SCRIPT': 'test/ci/fuzzer_tests.sh', 108 }, 109 'linux-clang-x86_64-bazel': { 110 'PERFETTO_TEST_GN_ARGS': '', 111 'PERFETTO_TEST_SCRIPT': 'test/ci/bazel_tests.sh', 112 }, 113 'ui-clang-x86_64-debug': { 114 'PERFETTO_TEST_GN_ARGS': 'is_debug=true', 115 'PERFETTO_TEST_SCRIPT': 'test/ci/ui_tests.sh', 116 }, 117 'ui-clang-x86_64-release': { 118 'PERFETTO_TEST_GN_ARGS': 'is_debug=false', 119 'PERFETTO_TEST_SCRIPT': 'test/ci/ui_tests.sh', 120 }, 121} 122 123if __name__ == '__main__': 124 import os 125 import json 126 import re 127 import sys 128 vars = dict(kv for kv in locals().items() if re.match('^[A-Z0-9_]+$', kv[0])) 129 130 if len(sys.argv) > 1 and sys.argv[1] == 'makefile': 131 deps_path = os.path.join(os.path.dirname(__file__), '.deps') 132 if not os.path.exists(deps_path): 133 os.mkdir(deps_path) 134 gen_file = os.path.join(deps_path, 'config.mk') 135 136 try: 137 literals = (int, long, basestring) 138 except NameError: 139 literals = (int, str) 140 141 with open(gen_file, 'w') as f: 142 for k, v in vars.items(): 143 if isinstance(v, literals): 144 f.write('override %s=%s\n' % (k, v)) 145 elif isinstance(v, list): 146 f.write('override %s=%s\n' % (k, ','.join(v))) 147 148 print(gen_file) 149 150 if len(sys.argv) > 1 and sys.argv[1] == 'js': 151 jsn = json.dumps(vars, indent=2) 152 print('// Auto-generated by %s, do not edit.\n' % __file__) 153 print('\'use strict\';\n') 154 print('const cfg = JSON.parse(`%s`);\n' % jsn.replace(r'\"', r'\\\"')) 155