[vm/test] Show crash dump in builder logs for Android tests.

Previously we would not have any VM logs because they are were sent to the Android
system logs, which are not captured by the bots.

Also added a flag --android-log-to-stderr, which is useful for local testing
and debugging.

Change-Id: I1968b4c230d70b5546d2dd48e40fe3cfe5196def
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112250
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This commit is contained in:
Samir Jindel 2019-08-07 15:38:11 +00:00 committed by commit-bot@chromium.org
parent fa45f91f18
commit 7283827b4e
2 changed files with 20 additions and 4 deletions

View file

@ -682,6 +682,7 @@ class CommandExecutorImpl implements CommandExecutor {
[
'export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:$deviceTestDir;'
'$devicedir/dart_precompiled_runtime',
'--android-log-to-stderr'
]..addAll(arguments),
timeout: timeoutDuration));
@ -741,6 +742,7 @@ class CommandExecutorImpl implements CommandExecutor {
[
'export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:$deviceTestDir;'
'$devicedir/dart',
'--android-log-to-stderr'
]..addAll(arguments),
timeout: timeoutDuration));

View file

@ -25,6 +25,12 @@
namespace dart {
DEFINE_FLAG(bool,
android_log_to_stderr,
false,
"Send Dart VM logs to stdout and stderr instead of the Android "
"system logs.");
// Android CodeObservers.
#ifndef PRODUCT
@ -255,8 +261,12 @@ DART_NOINLINE uintptr_t OS::GetProgramCounter() {
void OS::Print(const char* format, ...) {
va_list args;
va_start(args, format);
// Forward to the Android log for remote access.
__android_log_vprint(ANDROID_LOG_INFO, "DartVM", format, args);
if (FLAG_android_log_to_stderr) {
vfprintf(stderr, format, args);
} else {
// Forward to the Android log for remote access.
__android_log_vprint(ANDROID_LOG_INFO, "DartVM", format, args);
}
va_end(args);
}
@ -332,8 +342,12 @@ void OS::RegisterCodeObservers() {
void OS::PrintErr(const char* format, ...) {
va_list args;
va_start(args, format);
// Forward to the Android log for remote access.
__android_log_vprint(ANDROID_LOG_ERROR, "DartVM", format, args);
if (FLAG_android_log_to_stderr) {
vfprintf(stderr, format, args);
} else {
// Forward to the Android log for remote access.
__android_log_vprint(ANDROID_LOG_ERROR, "DartVM", format, args);
}
va_end(args);
}