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 identifier from tests and tests runners. */ 23 public enum TestErrorIdentifier implements ErrorIdentifier { 24 MODULE_DID_NOT_EXECUTE(530_001, FailureStatus.NOT_EXECUTED), 25 INSTRUMENTATION_NULL_METHOD(530_002, FailureStatus.TEST_FAILURE), 26 INSTRUMENTATION_TIMED_OUT(530_003, FailureStatus.TIMED_OUT), 27 MODULE_CHANGED_SYSTEM_STATUS(530_004, FailureStatus.TEST_FAILURE), 28 TEST_ABORTED(530_005, FailureStatus.TEST_FAILURE), 29 OUTPUT_PARSER_ERROR(530_006, FailureStatus.TEST_FAILURE), 30 TEST_BINARY_EXIT_CODE_ERROR(530_007, FailureStatus.TEST_FAILURE), 31 TEST_BINARY_TIMED_OUT(530_008, FailureStatus.TIMED_OUT), 32 MODIFIED_FOLDABLE_STATE(530_009, FailureStatus.TEST_FAILURE), 33 UNEXPECTED_MOBLY_CONFIG(530_010, FailureStatus.CUSTOMER_ISSUE), 34 UNEXPECTED_MOBLY_BEHAVIOR(530_011, FailureStatus.CUSTOMER_ISSUE), 35 HOST_COMMAND_FAILED(530_012, FailureStatus.CUSTOMER_ISSUE), 36 TEST_PHASE_TIMED_OUT(530_013, FailureStatus.TIMED_OUT), 37 TEST_FILTER_NEEDS_UPDATE(530_014, FailureStatus.SYSTEM_UNDER_TEST_CRASHED), 38 TEST_TIMEOUT(530_015, FailureStatus.TIMED_OUT); 39 40 private final long code; 41 private final @Nonnull FailureStatus status; 42 TestErrorIdentifier(int code, FailureStatus status)43 TestErrorIdentifier(int code, FailureStatus status) { 44 this.code = code; 45 this.status = (status == null ? FailureStatus.UNSET : status); 46 } 47 48 @Override code()49 public long code() { 50 return code; 51 } 52 53 @Override status()54 public @Nonnull FailureStatus status() { 55 return status; 56 } 57 } 58