• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2018, 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"""Atest custom enum class."""
16
17from enum import Enum, IntEnum, unique
18
19
20@unique
21class DetectType(IntEnum):
22  """An Enum class for local_detect_event."""
23
24  # Detect type for local_detect_event; next expansion: 60
25  BUG_DETECTED = 0
26  ACLOUD_CREATE = 1
27  FIND_BUILD = 2
28  NO_FLAKE = 3  # Deprecated.
29  HAS_FLAKE = 4  # Deprecated.
30  TF_TEARDOWN_LOGCAT = 5
31  REBUILD_MODULE_INFO = 6
32  NOT_REBUILD_MODULE_INFO = 7
33  ONLY_BUILD_MODULE_INFO = 8
34  FUZZY_SEARCH_TIME = 9
35  PERMISSION_INCONSISTENT = 10
36  SMART_REBUILD_MODULE_INFO = 11
37  CLEAN_BUILD = 12
38  TESTABLE_MODULES = 13
39  # Tradefed exit codes v.s. exit conditions
40  # 0: NO_ERROR             1: CONFIG_EXCEPTION
41  # 2: NO_BUILD             3: DEVICE_UNRESPONSIVE
42  # 4: DEVICE_UNAVAILABLE   5: FATAL_HOST_ERROR
43  # 6: THROWABLE_EXCEPTION  7: NO_DEVICE_ALLOCATED
44  # 8: WRONG_JAVA_VERSION
45  TF_EXIT_CODE = 14
46  ATEST_CONFIG = 15
47  TEST_WITH_ARGS = 16
48  TEST_NULL_ARGS = 17
49  MODULE_MERGE = 18  # Deprecated. Use MODULE_MERGE_MS instead.
50  MODULE_INFO_INIT_TIME = 19  # Deprecated. Use MODULE_INFO_INIT_MS instead.
51  MODULE_MERGE_MS = 20
52  NATIVE_TEST_NOT_FOUND = 21
53  BAZEL_WORKSPACE_GENERATE_TIME = 22
54  MODULE_LOAD_MS = 23
55  MODULE_INFO_INIT_MS = 24
56  INIT_AND_FIND_MS = 25
57  FOUND_INSTRUMENTATION_TEST = 26
58  FOUND_TARGET_ARTIFACTS = 27
59  FIND_TEST_IN_DEPS = 28
60  FULL_GENERATE_BAZEL_WORKSPACE_TIME = 29
61  # Below detect types are used for determine build conditions:
62  # 1. *_CLEAN_OUT: when out/ dir is empty or does not exist.
63  # 2. *_BPMK_CHANGE: when any Android.bp/Android.mk has changed.
64  # 3. *_ENV_CHANGE: when build-related variable has changed.
65  # 4. *_SRC_CHANGE: when source code has changed.
66  # 5. *_OTHER: none of above reasons that triggers renewal of ninja file.
67  # 6. *_INCREMENTAL: the build doesn't need to renew ninja file.
68  MODULE_INFO_CLEAN_OUT = 30
69  MODULE_INFO_BPMK_CHANGE = 31
70  MODULE_INFO_ENV_CHANGE = 32
71  MODULE_INFO_SRC_CHANGE = 33
72  MODULE_INFO_OTHER = 34
73  MODULE_INFO_INCREMENTAL = 35
74  BUILD_CLEAN_OUT = 36
75  BUILD_BPMK_CHANGE = 37
76  BUILD_ENV_CHANGE = 38
77  BUILD_SRC_CHANGE = 39
78  BUILD_OTHER = 40
79  BUILD_INCREMENTAL = 41
80  BUILD_TIME_PER_TARGET = 42
81  MODULE_INFO_GEN_NINJA = 43
82  BUILD_GEN_NINJA = 44
83  # To indicate if the invocation is using test-mapping, send non-zero value
84  # if the invocation is test-mapping mode.
85  IS_TEST_MAPPING = 45
86  # The RBE_STATE indicates the combined state of the RBE and customized out.
87  RBE_STATE = 46
88  # Prompt the user to select multiple tests.
89  INTERACTIVE_SELECTION = 47
90  # Upload results to storage.
91  # - UPLOAD_FLOW_MS is the total of upload preparation time, includes:
92  # -- FETCH_CRED_MS: fetch credential.
93  # -- UPLOAD_PREPARE_MS: insert a new record to server.
94  UPLOAD_FLOW_MS = 48
95  FETCH_CRED_MS = 49
96  UPLOAD_PREPARE_MS = 50
97  # Time of join the index.
98  IDX_JOIN_MS = 51  # Deprecated. Use INDEX_TARGETS_MS instead.
99  IS_MINIMAL_BUILD = 52
100  # Elapsed time of the Tradefed runner.
101  TF_PREPARATION_MS = 53
102  TF_TEST_MS = 54
103  TF_TEARDOWN_MS = 55
104  TF_TOTAL_RUN_MS = 56
105  ROBOLEAF_NON_MODULE_FINDER = 57  # Deprecated.
106  ROBOLEAF_UNSUPPORTED_FLAG = 58  # Deprecated.
107  INDEX_TARGETS_MS = 59
108
109
110@unique
111class ExitCode(IntEnum):
112  """An Enum class for sys.exit()"""
113
114  SUCCESS = 0
115  ENV_NOT_SETUP = 1
116  BUILD_FAILURE = 2
117  ERROR = 3
118  TEST_NOT_FOUND = 4
119  TEST_FAILURE = 5
120  VERIFY_FAILURE = 6
121  OUTSIDE_ROOT = 7
122  AVD_CREATE_FAILURE = 8
123  AVD_INVALID_ARGS = 9
124  EXIT_BEFORE_MAIN = 10
125  DEVICE_NOT_FOUND = 11
126  MIXED_TYPE_FILTER = 12
127  INPUT_TEST_REFERENCE_ERROR = 13
128  CONFIG_INVALID_FORMAT = 14
129  INVALID_SMART_TESTING_PATH = 15  # deprecated.
130  INVALID_EXEC_MODE = 16
131  INVALID_OBSOLETE_BASELINE_ARGS = 17  # deprecated.
132  INVALID_REGRESSION_ARGS = 18  # deprecated.
133  INVALID_TM_ARGS = 19
134  INVALID_TM_FORMAT = 20
135  INSUFFICIENT_DEVICES = 21
136  # The code > 100 are reserved for collecting data only, actually the run
137  # doesn't finish at the point.
138  COLLECT_ONLY_FILE_NOT_FOUND = 101
139
140
141@unique
142class FilterType(Enum):
143  """An Enum class for filter types"""
144
145  WILDCARD_FILTER = 'wildcard class_method'
146  REGULAR_FILTER = 'regular class_method'
147