• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 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  */
16 package com.android.tradefed.result.error;
17 
18 import com.android.tradefed.result.proto.TestRecordProto.FailureStatus;
19 
20 import javax.annotation.Nonnull;
21 
22 /** Error Identifiers from Trade Federation infra, and dependent infra (like Build infra). */
23 public enum InfraErrorIdentifier implements ErrorIdentifier {
24 
25     // ********************************************************************************************
26     // Infra: 500_001 ~ 510_000
27     // ********************************************************************************************
28     // 500_001 - 500_500: General errors
29     ARTIFACT_NOT_FOUND(500_001, FailureStatus.DEPENDENCY_ISSUE),
30     FAIL_TO_CREATE_FILE(500_002, FailureStatus.INFRA_FAILURE),
31     INVOCATION_CANCELLED(500_003, FailureStatus.CANCELLED),
32     CODE_COVERAGE_ERROR(500_004, FailureStatus.INFRA_FAILURE),
33     MODULE_SETUP_RUNTIME_EXCEPTION(500_005, FailureStatus.CUSTOMER_ISSUE),
34     CONFIGURED_ARTIFACT_NOT_FOUND(500_006, FailureStatus.CUSTOMER_ISSUE),
35     INVOCATION_TIMEOUT(500_007, FailureStatus.TIMED_OUT),
36     OPTION_CONFIGURATION_ERROR(500_008, FailureStatus.CUSTOMER_ISSUE),
37     RUNNER_ALLOCATION_ERROR(500_009, FailureStatus.INFRA_FAILURE),
38     SCHEDULER_ALLOCATION_ERROR(500_010, FailureStatus.CUSTOMER_ISSUE),
39     HOST_BINARY_FAILURE(500_011, FailureStatus.DEPENDENCY_ISSUE),
40     MISMATCHED_BUILD_DEVICE(500_012, FailureStatus.CUSTOMER_ISSUE),
41     LAB_HOST_FILESYSTEM_ERROR(500_013, FailureStatus.INFRA_FAILURE),
42     TRADEFED_SHUTTING_DOWN(500_014, FailureStatus.INFRA_FAILURE),
43     LAB_HOST_FILESYSTEM_FULL(500_015, FailureStatus.INFRA_FAILURE),
44     TRADEFED_SKIPPED_TESTS_DURING_SHUTDOWN(500_016, FailureStatus.CANCELLED),
45     SCHEDULING_ERROR(500_017, FailureStatus.INFRA_FAILURE),
46     EVENT_PROCESSING_TIMEOUT(500_018, FailureStatus.INFRA_FAILURE),
47     OUT_OF_MEMORY_ERROR(500_019, FailureStatus.INFRA_FAILURE),
48     // Use a catch-all error during bring up of the new feature
49     INCREMENTAL_FLASHING_ERROR(500_020, FailureStatus.INFRA_FAILURE),
50     BLOCK_COMPARE_ERROR(500_021, FailureStatus.INFRA_FAILURE),
51     FLASHSTATION_CACHE_PREPARATION_ERROR(500_022, FailureStatus.INFRA_FAILURE),
52 
53     // 500_400 - 500_500: General errors - subprocess related
54     INTERRUPTED_DURING_SUBPROCESS_SHUTDOWN(500_401, FailureStatus.INFRA_FAILURE),
55 
56     // 500_501 - 501_000: Build, Artifacts download related errors
57     ARTIFACT_REMOTE_PATH_NULL(500_501, FailureStatus.INFRA_FAILURE),
58     ARTIFACT_UNSUPPORTED_PATH(500_502, FailureStatus.INFRA_FAILURE),
59     ARTIFACT_DOWNLOAD_ERROR(500_503, FailureStatus.DEPENDENCY_ISSUE),
60     GCS_ERROR(500_504, FailureStatus.DEPENDENCY_ISSUE),
61     ANDROID_PARTNER_SERVER_ERROR(500_505, FailureStatus.DEPENDENCY_ISSUE),
62     ARTIFACT_INVALID(500_506, FailureStatus.DEPENDENCY_ISSUE),
63     SANDBOX_SETUP_ERROR(500_507, FailureStatus.INFRA_FAILURE),
64 
65     // 501_001 - 501_500: environment issues: For example: lab wifi
66     WIFI_FAILED_CONNECT(501_001, FailureStatus.DEPENDENCY_ISSUE),
67     GOOGLE_ACCOUNT_SETUP_FAILED(501_002, FailureStatus.DEPENDENCY_ISSUE),
68     NO_WIFI(501_003, FailureStatus.DEPENDENCY_ISSUE),
69     NO_DISK_SPACE(501_004, FailureStatus.DEPENDENCY_ISSUE),
70     VIRTUAL_WIFI_FAILED_CONNECT(501_005, FailureStatus.DEPENDENCY_ISSUE),
71 
72     // 502_000 - 502_100: Test issues detected by infra
73     EXPECTED_TESTS_MISMATCH(502_000, FailureStatus.TEST_FAILURE),
74 
75     // 505_000 - 505_250: Acloud errors
76     // The error codes should be aligned with errors defined in
77     // tools/acloud/internal/constants.py
78     NO_ACLOUD_REPORT(505_000, FailureStatus.DEPENDENCY_ISSUE),
79     ACLOUD_UNDETERMINED(505_001, FailureStatus.DEPENDENCY_ISSUE),
80     ACLOUD_TIMED_OUT(505_002, FailureStatus.DEPENDENCY_ISSUE),
81     ACLOUD_UNRECOGNIZED_ERROR_TYPE(505_003, FailureStatus.DEPENDENCY_ISSUE),
82     ACLOUD_INIT_ERROR(505_004, FailureStatus.DEPENDENCY_ISSUE),
83     ACLOUD_CREATE_GCE_ERROR(505_005, FailureStatus.DEPENDENCY_ISSUE),
84     ACLOUD_DOWNLOAD_ARTIFACT_ERROR(505_006, FailureStatus.DEPENDENCY_ISSUE),
85     ACLOUD_BOOT_UP_ERROR(505_007, FailureStatus.LOST_SYSTEM_UNDER_TEST),
86     GCE_QUOTA_ERROR(505_008, FailureStatus.DEPENDENCY_ISSUE),
87     ACLOUD_SSH_CONNECT_ERROR(505_009, FailureStatus.DEPENDENCY_ISSUE),
88     ACLOUD_OXYGEN_LEASE_ERROR(505_010, FailureStatus.DEPENDENCY_ISSUE),
89     ACLOUD_OXYGEN_RELEASE_ERROR(505_011, FailureStatus.DEPENDENCY_ISSUE),
90     OXYGEN_DEVICE_LAUNCHER_FAILURE(505_012, FailureStatus.LOST_SYSTEM_UNDER_TEST),
91     OXYGEN_SERVER_SHUTTING_DOWN(505_013, FailureStatus.DEPENDENCY_ISSUE),
92     OXYGEN_BAD_GATEWAY_ERROR(505_014, FailureStatus.DEPENDENCY_ISSUE),
93     OXYGEN_REQUEST_TIMEOUT(505_015, FailureStatus.DEPENDENCY_ISSUE),
94     OXYGEN_RESOURCE_EXHAUSTED(505_016, FailureStatus.DEPENDENCY_ISSUE),
95     OXYGEN_SERVER_CONNECTION_FAILURE(505_017, FailureStatus.DEPENDENCY_ISSUE),
96     OXYGEN_CLIENT_BINARY_TIMEOUT(505_018, FailureStatus.INFRA_FAILURE),
97     OXYGEN_CLIENT_BINARY_ERROR(505_019, FailureStatus.INFRA_FAILURE),
98     OXYGEN_CLIENT_LEASE_ERROR(505_020, FailureStatus.INFRA_FAILURE),
99     OXYGEN_NOT_ENOUGH_RESOURCE(505_021, FailureStatus.INFRA_FAILURE),
100     OXYGEN_DEVICE_LAUNCHER_TIMEOUT(505_022, FailureStatus.INFRA_FAILURE),
101     OXYGEN_SERVER_LB_CONNECTION_ERROR(505_023, FailureStatus.INFRA_FAILURE),
102     ACLOUD_INVALID_SERVICE_ACCOUNT_KEY(505_024, FailureStatus.DEPENDENCY_ISSUE),
103     ACLOUD_QUOTA_EXCEED_GPU(505_025, FailureStatus.DEPENDENCY_ISSUE),
104 
105     // 505_251 - 505_300: Configuration errors
106     INTERNAL_CONFIG_ERROR(505_251, FailureStatus.INFRA_FAILURE),
107     CLASS_NOT_FOUND(505_252, FailureStatus.CUSTOMER_ISSUE),
108     CONFIGURATION_NOT_FOUND(505_253, FailureStatus.CUSTOMER_ISSUE),
109     UNEXPECTED_DEVICE_CONFIGURED(505_254, FailureStatus.CUSTOMER_ISSUE),
110     KEYSTORE_CONFIG_ERROR(505_255, FailureStatus.DEPENDENCY_ISSUE),
111     TEST_MAPPING_PATH_COLLISION(505_256, FailureStatus.DEPENDENCY_ISSUE),
112     TEST_MAPPING_FILE_FORMAT_ISSUE(505_257, FailureStatus.CUSTOMER_ISSUE),
113     TEST_MAPPING_FILE_NOT_EXIST(505_258, FailureStatus.CUSTOMER_ISSUE),
114 
115     UNDETERMINED(510_000, FailureStatus.UNSET);
116 
117     private final long code;
118     private final @Nonnull FailureStatus status;
119 
InfraErrorIdentifier(int code, FailureStatus status)120     InfraErrorIdentifier(int code, FailureStatus status) {
121         this.code = code;
122         this.status = (status == null ? FailureStatus.UNSET : status);
123     }
124 
125     @Override
code()126     public long code() {
127         return code;
128     }
129 
130     @Override
status()131     public @Nonnull FailureStatus status() {
132         return status;
133     }
134 }
135