summaryrefslogtreecommitdiff
path: root/tools/bit
diff options
context:
space:
mode:
authorJoe Onorato <joeo@google.com>2019-05-01 12:51:05 -0700
committerJoe Onorato <joeo@google.com>2019-05-01 13:02:25 -0700
commit50307d9792feac5b170e0e0536ad6e2a47d5eb27 (patch)
tree9dd00aeafad43c7410f43c95925e75852642ea94 /tools/bit
parenta58591179b40ca5efafef7f612ba3be46f0187d3 (diff)
Make am instrument capture logcat during test run, and return it to the host.
Also makes bit print that logcat, if available, instead of just the stack trace. This means that when you run a test you don't also have to run logcat in some other window, and then scroll around forever looking for the one test in question. Test: bit -t GtsIncidentManagerTestCases:com.google.android.incident.gts.IncidentManagerTests\#testFail Test: bit -t GtsIncidentManagerTestCases:com.google.android.incident.gts.IncidentManagerTests\#testDoesntExist Bug: 129875642 Change-Id: I8940ff379c919482f4a545cb90d25bdbaa2b4f15
Diffstat (limited to 'tools/bit')
-rw-r--r--tools/bit/main.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/bit/main.cpp b/tools/bit/main.cpp
index 1a91f52bc6cf..d80c2e742fae 100644
--- a/tools/bit/main.cpp
+++ b/tools/bit/main.cpp
@@ -290,8 +290,14 @@ TestResults::OnTestStatus(TestStatus& status)
m_currentAction->target->name.c_str(), className.c_str(),
testName.c_str(), g_escapeEndColor);
- string stack = get_bundle_string(results, &found, "stack", NULL);
- if (found) {
+ bool stackFound;
+ string stack = get_bundle_string(results, &stackFound, "stack", NULL);
+ if (status.has_logcat()) {
+ const string logcat = status.logcat();
+ if (logcat.length() > 0) {
+ printf("%s\n", logcat.c_str());
+ }
+ } else if (stackFound) {
printf("%s\n", stack.c_str());
}
}