Default to LS_INFO logging for release builds.

Increases default loglevel for test targets to LS_INFO, which is a no-op
for debug builds but increases logging on release builds.

This is to present better debug info on buildbots when test runs fail.

BUG=
R=henrikg@webrtc.org, kjellander@webrtc.org, stefan@webrtc.org

Review URL: https://codereview.webrtc.org/1479183002 .

Cr-Commit-Position: refs/heads/master@{#10826}
This commit is contained in:
Peter Boström 2015-11-27 17:53:22 +01:00
parent 521af4e344
commit def58203a1
3 changed files with 12 additions and 2 deletions

View File

@ -191,10 +191,10 @@ bool RunAppleScript(const std::string& script) {
AECreateDesc(typeNull, NULL, 0, &result_data);
OSAScriptError(component, kOSAErrorMessage, typeChar, &result_data);
int len = AEGetDescDataSize(&result_data);
char* data = (char*) malloc(len);
char* data = (char*)malloc(len);
if (data != NULL) {
err = AEGetDescData(&result_data, data, len);
LOG(LS_ERROR) << "Script error: " << data;
LOG(LS_ERROR) << "Script error: " << std::string(data, len);
}
AEDisposeDesc(&script_desc);
AEDisposeDesc(&result_data);

View File

@ -93,6 +93,10 @@ int main(int argc, char** argv) {
rtc::LogMessage::LogTimestamps();
if (*FLAG_log != '\0') {
rtc::LogMessage::ConfigureLogging(FLAG_log);
} else if (rtc::LogMessage::GetLogToDebug() > rtc::LS_INFO) {
// Default to LS_INFO, even for release builds to provide better test
// logging.
rtc::LogMessage::LogToDebug(rtc::LS_INFO);
}
// Initialize SSL which are used by several tests.

View File

@ -10,6 +10,7 @@
#include "gflags/gflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/logging.h"
#include "webrtc/test/field_trial.h"
#include "webrtc/test/testsupport/fileutils.h"
@ -21,6 +22,11 @@ DEFINE_string(force_fieldtrials, "",
int main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
// Default to LS_INFO, even for release builds to provide better test logging.
// TODO(pbos): Consider adding a command-line override.
if (rtc::LogMessage::GetLogToDebug() > rtc::LS_INFO)
rtc::LogMessage::LogToDebug(rtc::LS_INFO);
// AllowCommandLineParsing allows us to ignore flags passed on to us by
// Chromium build bots without having to explicitly disable them.
google::AllowCommandLineReparsing();