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 = ( 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' 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 '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-release': { 114 'PERFETTO_TEST_GN_ARGS': 'is_debug=false', 115 'PERFETTO_TEST_SCRIPT': 'test/ci/ui_tests.sh', 116 }, 117} 118 119if __name__ == '__main__': 120 import os 121 import json 122 import re 123 import sys 124 vars = dict(kv for kv in locals().items() if re.match('^[A-Z0-9_]+$', kv[0])) 125 126 if len(sys.argv) > 1 and sys.argv[1] == 'makefile': 127 deps_path = os.path.join(os.path.dirname(__file__), '.deps') 128 if not os.path.exists(deps_path): 129 os.mkdir(deps_path) 130 gen_file = os.path.join(deps_path, 'config.mk') 131 132 try: 133 literals = (int, long, basestring) 134 except NameError: 135 literals = (int, str) 136 137 with open(gen_file, 'w') as f: 138 for k, v in vars.items(): 139 if isinstance(v, literals): 140 f.write('override %s=%s\n' % (k, v)) 141 elif isinstance(v, list): 142 f.write('override %s=%s\n' % (k, ','.join(v))) 143 144 print(gen_file) 145 146 if len(sys.argv) > 1 and sys.argv[1] == 'js': 147 jsn = json.dumps(vars, indent=2) 148 print('// Auto-generated by %s, do not edit.\n' % 149 os.path.basename(__file__)) 150 print('\'use strict\';\n') 151 print('const cfg = JSON.parse(`%s`);\n' % jsn.replace(r'\"', r'\\\"')) 152