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""" 16Atest custom enum class. 17""" 18 19from enum import IntEnum, unique, Enum 20 21@unique 22class DetectType(IntEnum): 23 """An Enum class for local_detect_event.""" 24 # Detect type for local_detect_event; next expansion: 22 25 BUG_DETECTED = 0 26 ACLOUD_CREATE = 1 27 FIND_BUILD = 2 28 NO_FLAKE = 3 29 HAS_FLAKE = 4 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 50 MODULE_INFO_INIT_TIME = 19 51 MODULE_MERGE_MS = 20 52 NATIVE_TEST_NOT_FOUND = 21 53 54@unique 55class ExitCode(IntEnum): 56 """An Enum class for sys.exit()""" 57 SUCCESS = 0 58 ENV_NOT_SETUP = 1 59 BUILD_FAILURE = 2 60 ERROR = 3 61 TEST_NOT_FOUND = 4 62 TEST_FAILURE = 5 63 VERIFY_FAILURE = 6 64 OUTSIDE_ROOT = 7 65 AVD_CREATE_FAILURE = 8 66 AVD_INVALID_ARGS = 9 67 EXIT_BEFORE_MAIN = 10 68 DEVICE_NOT_FOUND = 11 69 MIXED_TYPE_FILTER = 12 70 71@unique 72class FilterType(Enum): 73 """An Enum class for filter types""" 74 WILDCARD_FILTER = 'wildcard class_method' 75 REGULAR_FILTER = 'regular class_method' 76 77# TODO: (b/218441706) Convert AtestEnum to a real Enum class. 78class AtestEnum(tuple): 79 """enum library isn't a Python 2.7 built-in, so roll our own.""" 80 __getattr__ = tuple.index 81