Skip to content

Commit

Permalink
Add more logs to ADB exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Dyatlov committed Aug 28, 2024
1 parent ae097c0 commit d8a9c85
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ class AndroidDeviceTestRunner(private val device: DdmlibAndroidDevice) {
listener.testRunEnded(0, emptyMap())
}
} catch (e: ShellCommandUnresponsiveException) {
logger.warn(ERROR_STUCK, e)
listener.testRunFailed(ERROR_STUCK)
val errorMessage = "adb unresponsive while running tests ${testBatch.tests.map { it.toTestName() }}"
logger.error(e) { errorMessage }
listener.testRunFailed(errorMessage)
} catch (e: TimeoutException) {
logger.warn(ERROR_STUCK, e)
listener.testRunFailed(ERROR_STUCK)
val errorMessage = "adb timed out while running tests ${testBatch.tests.map { it.toTestName() }}"
logger.error(e) { errorMessage }
listener.testRunFailed(errorMessage)
} catch (e: AdbCommandRejectedException) {
val errorMessage = "adb error while running tests ${testBatch.tests.map { it.toTestName() }}"
logger.error(e) { errorMessage }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ class DdmlibAndroidDevice(
try {
ddmsDevice.safeExecuteShellCommand(command, nullOutputReceiver)
} catch (e: TimeoutException) {
logger.error(errorMessage, e)
logger.error("$errorMessage while executing $command", e)
} catch (e: AdbCommandRejectedException) {
logger.error(errorMessage, e)
logger.error("$errorMessage while executing $command", e)
} catch (e: ShellCommandUnresponsiveException) {
logger.error(errorMessage, e)
logger.error("$errorMessage while executing $command", e)
} catch (e: IOException) {
logger.error(errorMessage, e)
logger.error("$errorMessage while executing $command", e)
}
}

Expand Down

0 comments on commit d8a9c85

Please sign in to comment.