Make RAW_LOG(FATAL) work while RT.
Generating the backtrace was allocating memory. Which would then die
again... So, drop RT permission on the way down.
Change-Id: Iaa14beb029b2d09f208179f81fdb9d62f3209163
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/realtime_test.cc b/aos/realtime_test.cc
index 951fd68..98f53e1 100644
--- a/aos/realtime_test.cc
+++ b/aos/realtime_test.cc
@@ -2,6 +2,7 @@
#include "aos/init.h"
#include "glog/logging.h"
+#include "glog/raw_logging.h"
#include "gtest/gtest.h"
DECLARE_bool(die_on_malloc);
@@ -116,6 +117,16 @@
"SIGSEGV \\(@0x0\\) received by PID.*stack trace:");
}
+// Tests that RAW_LOG(FATAL) explodes properly.
+TEST(RealtimeDeathTest, RawFatal) {
+ EXPECT_DEATH(
+ {
+ ScopedRealtime rt;
+ RAW_LOG(FATAL, "Cute message here\n");
+ },
+ "Cute message here");
+}
+
} // namespace testing
} // namespace aos