Automatically write logs if file is specified
Change-Id: Ib41d64d8bc5084ab735a418b87fa1a2a0e5652e6
diff --git a/aos/testing/gtest_main.cc b/aos/testing/gtest_main.cc
index ef63293..e2ba564 100644
--- a/aos/testing/gtest_main.cc
+++ b/aos/testing/gtest_main.cc
@@ -40,7 +40,8 @@
" -p, --print-logs\n"
" Print the log messages as they are being generated.\n"
" -o, --log-file=FILE\n"
- " Print all log messages to FILE instead of standard output\n"
+ " Print all log messages to FILE instead of standard output.\n"
+ " This implies -p.\n"
);
break;
@@ -51,6 +52,9 @@
break;
case 'o':
+ if (::aos::testing::ForcePrintLogsDuringTests) {
+ ::aos::testing::ForcePrintLogsDuringTests();
+ }
if (::aos::testing::SetLogFileName) {
::aos::testing::SetLogFileName(optarg);
}