1# Copyright 2017, The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15""" 16Various globals used by atest. 17""" 18 19 20MODE = 'DEFAULT' 21 22# Result server constants for atest_utils. 23RESULT_SERVER = '' 24RESULT_SERVER_ARGS = [] 25RESULT_SERVER_TIMEOUT = 5 26# Result arguments if tests are configured in TEST_MAPPING. 27TEST_MAPPING_RESULT_SERVER_ARGS = [] 28 29# Google service key for gts tests. 30GTS_GOOGLE_SERVICE_ACCOUNT = '' 31 32# Arg constants. 33WAIT_FOR_DEBUGGER = 'WAIT_FOR_DEBUGGER' 34DISABLE_INSTALL = 'DISABLE_INSTALL' 35DISABLE_TEARDOWN = 'DISABLE_TEARDOWN' 36PRE_PATCH_ITERATIONS = 'PRE_PATCH_ITERATIONS' 37POST_PATCH_ITERATIONS = 'POST_PATCH_ITERATIONS' 38PRE_PATCH_FOLDER = 'PRE_PATCH_FOLDER' 39POST_PATCH_FOLDER = 'POST_PATCH_FOLDER' 40SERIAL = 'SERIAL' 41ALL_ABI = 'ALL_ABI' 42HOST = 'HOST' 43CUSTOM_ARGS = 'CUSTOM_ARGS' 44DRY_RUN = 'DRY_RUN' 45ANDROID_SERIAL = 'ANDROID_SERIAL' 46INSTANT = 'INSTANT' 47 48# Application exit codes. 49EXIT_CODE_SUCCESS = 0 50EXIT_CODE_ENV_NOT_SETUP = 1 51EXIT_CODE_BUILD_FAILURE = 2 52EXIT_CODE_ERROR = 3 53EXIT_CODE_TEST_NOT_FOUND = 4 54EXIT_CODE_TEST_FAILURE = 5 55 56# Test finder constants. 57MODULE_CONFIG = 'AndroidTest.xml' 58MODULE_COMPATIBILITY_SUITES = 'compatibility_suites' 59MODULE_NAME = 'module_name' 60MODULE_PATH = 'path' 61MODULE_CLASS = 'class' 62MODULE_INSTALLED = 'installed' 63MODULE_CLASS_ROBOLECTRIC = 'ROBOLECTRIC' 64MODULE_CLASS_NATIVE_TESTS = 'NATIVE_TESTS' 65MODULE_CLASS_JAVA_LIBRARIES = 'JAVA_LIBRARIES' 66MODULE_TEST_CONFIG = 'test_config' 67 68# Env constants 69ANDROID_BUILD_TOP = 'ANDROID_BUILD_TOP' 70ANDROID_OUT = 'OUT' 71ANDROID_OUT_DIR = 'OUT_DIR' 72ANDROID_HOST_OUT = 'ANDROID_HOST_OUT' 73ANDROID_PRODUCT_OUT = 'ANDROID_PRODUCT_OUT' 74 75# Test Info data keys 76# Value of include-filter option. 77TI_FILTER = 'filter' 78TI_REL_CONFIG = 'rel_config' 79TI_MODULE_CLASS = 'module_class' 80# Value of module-arg option 81TI_MODULE_ARG = 'module-arg' 82 83# Google TF 84GTF_MODULE = 'google-tradefed' 85GTF_TARGET = 'google-tradefed-core' 86 87# Test group for tests in TEST_MAPPING 88TEST_GROUP_PRESUBMIT = 'presubmit' 89TEST_GROUP_POSTSUBMIT = 'postsubmit' 90TEST_GROUP_ALL = 'all' 91# Key in TEST_MAPPING file for a list of imported TEST_MAPPING file 92TEST_MAPPING_IMPORTS = 'imports' 93 94# TradeFed command line args 95TF_INCLUDE_FILTER_OPTION = 'include-filter' 96TF_EXCLUDE_FILTER_OPTION = 'exclude-filter' 97TF_INCLUDE_FILTER = '--include-filter' 98TF_EXCLUDE_FILTER = '--exclude-filter' 99TF_ATEST_INCLUDE_FILTER = '--atest-include-filter' 100TF_ATEST_INCLUDE_FILTER_VALUE_FMT = '{test_name}:{test_filter}' 101TF_MODULE_ARG = '--module-arg' 102TF_MODULE_ARG_VALUE_FMT = '{test_name}:{option_name}:{option_value}' 103TF_SUITE_FILTER_ARG_VALUE_FMT = '"{test_name} {option_value}"' 104 105# Suite Plans 106SUITE_PLANS = frozenset(['cts']) 107 108# Constants used for AtestArgParser 109HELP_DESC = 'Build, install and run Android tests locally.' 110BUILD_STEP = 'build' 111INSTALL_STEP = 'install' 112TEST_STEP = 'test' 113ALL_STEPS = [BUILD_STEP, INSTALL_STEP, TEST_STEP] 114REBUILD_MODULE_INFO_FLAG = '--rebuild-module-info' 115 116# ANSI code shift for colorful print 117BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8) 118 119# Answers equivalent to YES! 120AFFIRMATIVES = ['y', 'Y', 'yes', 'Yes', 'YES', ''] 121LD_RANGE = 2 122 123# Types of Levenshetine Distance Cost 124COST_TYPO = (1, 1, 1) 125COST_SEARCH = (8, 1, 5) 126 127# Value of TestInfo install_locations. 128DEVICELESS_TEST = 'host' 129DEVICE_TEST = 'device' 130BOTH_TEST = 'both' 131 132# Metrics 133METRICS_URL = 'http://asuite-218222.appspot.com/atest/metrics' 134EXTERNAL = 'EXTERNAL_RUN' 135INTERNAL = 'INTERNAL_RUN' 136INTERNAL_EMAIL = '@google.com' 137CONTENT_LICENSES_URL = 'https://source.android.com/setup/start/licenses' 138CONTRIBUTOR_AGREEMENT_URL = { 139 'INTERNAL': 'https://cla.developers.google.com/', 140 'EXTERNAL': 'https://opensource.google.com/docs/cla/' 141} 142PRIVACY_POLICY_URL = 'https://policies.google.com/privacy' 143TERMS_SERVICE_URL = 'https://policies.google.com/terms' 144TOOL_NAME = 'atest' 145 146# VTS plans 147VTS_STAGING_PLAN = 'vts-staging-default' 148 149# TreeHugger TEST_MAPPING SUITE_PLANS 150TEST_MAPPING_SUITES = ['device-tests', 'general-tests'] 151 152# VTS TF 153VTS_TF_MODULE = 'vts-tradefed' 154 155# ATest TF 156ATEST_TF_MODULE = 'atest-tradefed' 157