diff options
author | Julien Desprez <jdesprez@google.com> | 2020-07-08 16:46:17 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-07-08 16:46:17 +0000 |
commit | 7cab0563c0fe35e261107888c681b27dc14e5d20 (patch) | |
tree | 98accefbc1cece8519713278ed1f077bf5c9ef47 | |
parent | c1109eebe2a776b66a6c5a49ba280748a33d5947 (diff) | |
parent | 282341097bd83eb72884b81cd485ee727e03968c (diff) | |
download | tradefederation-7cab0563c0fe35e261107888c681b27dc14e5d20.tar.gz |
Merge "Categorized some errors that seem to appear more" am: 282341097b
Original change: https://android-review.googlesource.com/c/platform/tools/tradefederation/+/1351664
Change-Id: I0b4df719bac5e55e96180cdcf0d19de229257024
6 files changed, 35 insertions, 7 deletions
diff --git a/src/com/android/tradefed/result/LogcatCrashResultForwarder.java b/src/com/android/tradefed/result/LogcatCrashResultForwarder.java index 5fe2ae5e9..6da0c2d9e 100644 --- a/src/com/android/tradefed/result/LogcatCrashResultForwarder.java +++ b/src/com/android/tradefed/result/LogcatCrashResultForwarder.java @@ -21,6 +21,7 @@ import com.android.loganalysis.parser.LogcatParser; import com.android.tradefed.device.ITestDevice; import com.android.tradefed.log.LogUtil.CLog; import com.android.tradefed.metrics.proto.MetricMeasurement.Metric; +import com.android.tradefed.result.error.DeviceErrorIdentifier; import com.android.tradefed.result.proto.TestRecordProto.FailureStatus; import com.android.tradefed.util.StreamUtil; @@ -103,6 +104,9 @@ public class LogcatCrashResultForwarder extends ResultForwarder { errorMessage = extractCrashAndAddToMessage(errorMessage, mLastStartTime); } error.setErrorMessage(errorMessage); + if (isCrash(errorMessage)) { + error.setErrorIdentifier(DeviceErrorIdentifier.INSTRUMENATION_CRASH); + } super.testRunFailed(error); } @@ -114,14 +118,17 @@ public class LogcatCrashResultForwarder extends ResultForwarder { /** Attempt to extract the crash from the logcat if the test was seen as started. */ private String extractCrashAndAddToMessage(String errorMessage, Long startTime) { - if ((errorMessage.contains(ERROR_MESSAGE) || errorMessage.contains(SYSTEM_CRASH_MESSAGE)) - && startTime != null) { + if (isCrash(errorMessage) && startTime != null) { mLogcatItem = extractLogcat(mDevice, startTime); errorMessage = addJavaCrashToString(mLogcatItem, errorMessage); } return errorMessage; } + private boolean isCrash(String errorMessage) { + return errorMessage.contains(ERROR_MESSAGE) || errorMessage.contains(SYSTEM_CRASH_MESSAGE); + } + /** * Extract a formatted object from the logcat snippet. * diff --git a/src/com/android/tradefed/targetprep/DeviceSetup.java b/src/com/android/tradefed/targetprep/DeviceSetup.java index a5f631697..2db82ba09 100644 --- a/src/com/android/tradefed/targetprep/DeviceSetup.java +++ b/src/com/android/tradefed/targetprep/DeviceSetup.java @@ -26,6 +26,7 @@ import com.android.tradefed.invoker.TestInformation; import com.android.tradefed.invoker.logger.InvocationMetricLogger; import com.android.tradefed.invoker.logger.InvocationMetricLogger.InvocationMetricKey; import com.android.tradefed.log.LogUtil.CLog; +import com.android.tradefed.result.error.InfraErrorIdentifier; import com.android.tradefed.util.BinaryState; import com.android.tradefed.util.MultiMap; @@ -918,7 +919,8 @@ public class DeviceSetup extends BaseTargetPreparer { String.format( "Failed to connect to wifi network %s on %s", mWifiSsid, device.getSerialNumber()), - device.getDeviceDescriptor()); + device.getDeviceDescriptor(), + InfraErrorIdentifier.WIFI_FAILED_CONNECT); } } diff --git a/src/com/android/tradefed/testtype/suite/ModuleDefinition.java b/src/com/android/tradefed/testtype/suite/ModuleDefinition.java index bd33a3055..0372eb7ef 100644 --- a/src/com/android/tradefed/testtype/suite/ModuleDefinition.java +++ b/src/com/android/tradefed/testtype/suite/ModuleDefinition.java @@ -58,6 +58,7 @@ import com.android.tradefed.result.TestDescription; import com.android.tradefed.result.TestResult; import com.android.tradefed.result.TestRunResult; import com.android.tradefed.result.error.ErrorIdentifier; +import com.android.tradefed.result.error.InfraErrorIdentifier; import com.android.tradefed.result.proto.TestRecordProto.FailureStatus; import com.android.tradefed.retry.IRetryDecision; import com.android.tradefed.retry.RetryStatistics; @@ -687,14 +688,19 @@ public class ModuleDefinition implements Comparable<ModuleDefinition>, ITestColl String.format( "Module %s only ran %d out of %d expected tests.", getId(), numResults, totalExpectedTests); - runFailureMessages.add(FailureDescription.create(error)); + FailureDescription mismatch = + FailureDescription.create(error) + .setFailureStatus(FailureStatus.TEST_FAILURE) + .setErrorIdentifier(InfraErrorIdentifier.EXPECTED_TESTS_MISMATCH); + runFailureMessages.add(mismatch); CLog.e(error); } if (tearDownException != null) { FailureDescription failure = CurrentInvocation.createFailure( - StreamUtil.getStackTrace(tearDownException), null); + StreamUtil.getStackTrace(tearDownException), null) + .setCause(tearDownException); runFailureMessages.add(failure); } // If there is any errors report them all at once diff --git a/test_framework/com/android/tradefed/targetprep/WifiPreparer.java b/test_framework/com/android/tradefed/targetprep/WifiPreparer.java index 1959a276e..1bfc63567 100644 --- a/test_framework/com/android/tradefed/targetprep/WifiPreparer.java +++ b/test_framework/com/android/tradefed/targetprep/WifiPreparer.java @@ -23,6 +23,7 @@ import com.android.tradefed.invoker.TestInformation; import com.android.tradefed.invoker.logger.InvocationMetricLogger; import com.android.tradefed.invoker.logger.InvocationMetricLogger.InvocationMetricKey; import com.android.tradefed.log.LogUtil.CLog; +import com.android.tradefed.result.error.InfraErrorIdentifier; /** * A {@link ITargetPreparer} that configures wifi on the device if necessary. @@ -77,8 +78,12 @@ public class WifiPreparer extends BaseTargetPreparer { InvocationMetricLogger.addInvocationMetrics(InvocationMetricKey.WIFI_AP_NAME, mWifiNetwork); if (!device.connectToWifiNetworkIfNeeded(mWifiNetwork, mWifiPsk)) { - throw new TargetSetupError(String.format("Failed to connect to wifi network %s on %s", - mWifiNetwork, device.getSerialNumber()), device.getDeviceDescriptor()); + throw new TargetSetupError( + String.format( + "Failed to connect to wifi network %s on %s", + mWifiNetwork, device.getSerialNumber()), + device.getDeviceDescriptor(), + InfraErrorIdentifier.WIFI_FAILED_CONNECT); } if (mMonitorNetwork) { device.enableNetworkMonitor(); diff --git a/test_result_interfaces/com/android/tradefed/result/error/DeviceErrorIdentifier.java b/test_result_interfaces/com/android/tradefed/result/error/DeviceErrorIdentifier.java index 554171986..4b19a350a 100644 --- a/test_result_interfaces/com/android/tradefed/result/error/DeviceErrorIdentifier.java +++ b/test_result_interfaces/com/android/tradefed/result/error/DeviceErrorIdentifier.java @@ -30,6 +30,8 @@ public enum DeviceErrorIdentifier implements ErrorIdentifier { SHELL_COMMAND_ERROR(30_100, FailureStatus.UNSET), DEVICE_UNEXPECTED_RESPONSE(30_101, FailureStatus.UNSET), + INSTRUMENATION_CRASH(30_200, FailureStatus.UNSET), + FAILED_TO_LAUNCH_GCE(30_500, FailureStatus.LOST_SYSTEM_UNDER_TEST), FAILED_TO_CONNECT_TO_GCE(30_501, FailureStatus.LOST_SYSTEM_UNDER_TEST), ERROR_AFTER_FLASHING(30_502, FailureStatus.LOST_SYSTEM_UNDER_TEST), diff --git a/test_result_interfaces/com/android/tradefed/result/error/InfraErrorIdentifier.java b/test_result_interfaces/com/android/tradefed/result/error/InfraErrorIdentifier.java index 1f1312121..30012319f 100644 --- a/test_result_interfaces/com/android/tradefed/result/error/InfraErrorIdentifier.java +++ b/test_result_interfaces/com/android/tradefed/result/error/InfraErrorIdentifier.java @@ -32,6 +32,12 @@ public enum InfraErrorIdentifier implements ErrorIdentifier { ARTIFACT_UNSUPPORTED_PATH(10_502, FailureStatus.INFRA_FAILURE), ARTIFACT_DOWNLOAD_ERROR(10_503, FailureStatus.INFRA_FAILURE), + // 11_001 - 11_500: environment issues: For example: lab wifi + WIFI_FAILED_CONNECT(11_001, FailureStatus.UNSET), // TODO: switch to dependency_issue + + // 12_000 - 12_100: Test issues detected by infra + EXPECTED_TESTS_MISMATCH(12_000, FailureStatus.TEST_FAILURE), + UNDETERMINED(20_000, FailureStatus.UNSET); private final long code; |