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 'PERFETTO_TEST_SCRIPT': 'test/ci/linux_tests.sh', 72 }, 73 'linux-clang-x86_64-tsan': { 74 'PERFETTO_TEST_GN_ARGS': 'is_debug=false is_tsan=true', 75 'PERFETTO_TEST_SCRIPT': 'test/ci/linux_tests.sh', 76 }, 77 'linux-clang-x86_64-msan': { 78 'PERFETTO_TEST_GN_ARGS': 'is_debug=false is_msan=true', 79 'PERFETTO_TEST_SCRIPT': 'test/ci/linux_tests.sh', 80 }, 81 'linux-clang-x86_64-asan_lsan': { 82 'PERFETTO_TEST_GN_ARGS': 'is_debug=false is_asan=true is_lsan=true', 83 'PERFETTO_TEST_SCRIPT': 'test/ci/linux_tests.sh', 84 }, 85 'linux-clang-x86-asan_lsan': { 86 'PERFETTO_TEST_GN_ARGS': 'is_debug=false is_asan=true is_lsan=true ' 87 'target_cpu="x86"', 88 'PERFETTO_TEST_SCRIPT': 'test/ci/linux_tests.sh', 89 }, 90 'linux-gcc7-x86_64-release': { 91 'PERFETTO_TEST_GN_ARGS': 'is_debug=false is_clang=false ' 92 'cc="gcc-7" cxx="g++-7"', 93 'PERFETTO_TEST_SCRIPT': 'test/ci/linux_tests.sh', 94 }, 95 'android-clang-arm-release': { 96 'PERFETTO_TEST_GN_ARGS': 97 'is_debug=false target_os="android" target_cpu="arm"', 98 'PERFETTO_TEST_SCRIPT': 99 'test/ci/android_tests.sh', 100 }, 101 'android-clang-arm-asan': { 102 'PERFETTO_TEST_GN_ARGS': 'is_debug=false target_os="android" ' 103 'target_cpu="arm" is_asan=true', 104 'PERFETTO_TEST_SCRIPT': 'test/ci/android_tests.sh', 105 }, 106 'linux-clang-x86_64-libfuzzer': { 107 'PERFETTO_TEST_GN_ARGS': 'is_debug=false is_fuzzer=true is_asan=true', 108 'PERFETTO_TEST_SCRIPT': 'test/ci/fuzzer_tests.sh', 109 }, 110 'linux-clang-x86_64-bazel': { 111 'PERFETTO_TEST_GN_ARGS': '', 112 'PERFETTO_TEST_SCRIPT': 'test/ci/bazel_tests.sh', 113 }, 114 'ui-clang-x86_64-release': { 115 'PERFETTO_TEST_GN_ARGS': 'is_debug=false', 116 'PERFETTO_TEST_SCRIPT': 'test/ci/ui_tests.sh', 117 }, 118} 119 120if __name__ == '__main__': 121 import os 122 import json 123 import re 124 import sys 125 vars = dict(kv for kv in locals().items() if re.match('^[A-Z0-9_]+$', kv[0])) 126 127 if len(sys.argv) > 1 and sys.argv[1] == 'makefile': 128 deps_path = os.path.join(os.path.dirname(__file__), '.deps') 129 if not os.path.exists(deps_path): 130 os.mkdir(deps_path) 131 gen_file = os.path.join(deps_path, 'config.mk') 132 133 try: 134 literals = (int, long, basestring) 135 except NameError: 136 literals = (int, str) 137 138 with open(gen_file, 'w') as f: 139 for k, v in vars.items(): 140 if isinstance(v, literals): 141 f.write('override %s=%s\n' % (k, v)) 142 elif isinstance(v, list): 143 f.write('override %s=%s\n' % (k, ','.join(v))) 144 145 print(gen_file) 146 147 if len(sys.argv) > 1 and sys.argv[1] == 'js': 148 jsn = json.dumps(vars, indent=2) 149 print('// Auto-generated by %s, do not edit.\n' % 150 os.path.basename(__file__)) 151 print('\'use strict\';\n') 152 print('const cfg = JSON.parse(`%s`);\n' % jsn.replace(r'\"', r'\\\"')) 153