Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Unified Diff: base/debug/stack_trace_unittest.cc

Issue 11362048: GTTF: Make Linux stack dump signal handler async-signal safe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« base/debug/stack_trace_posix.cc ('K') | « base/debug/stack_trace_posix.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/stack_trace_unittest.cc
diff --git a/base/debug/stack_trace_unittest.cc b/base/debug/stack_trace_unittest.cc
index 6a35dac7a4bef47c779884e9c6aaaaf7904b44bc..e815e4452cb203048b97436c453e56cb2ead4d2c 100644
--- a/base/debug/stack_trace_unittest.cc
+++ b/base/debug/stack_trace_unittest.cc
@@ -7,11 +7,17 @@
#include "base/debug/stack_trace.h"
#include "base/logging.h"
+#include "base/process_util.h"
+#include "base/test/multiprocess_test.h"
+#include "base/test/test_timeouts.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/multiprocess_func_list.h"
namespace base {
namespace debug {
+typedef MultiProcessTest StackTraceTest;
+
// Note: On Linux, this test currently only fully works on Debug builds.
// See comments in the #ifdef soup if you intend to change this.
#if defined(OS_WIN)
@@ -20,7 +26,7 @@ namespace debug {
#else
#define MAYBE_OutputToStream OutputToStream
#endif
-TEST(StackTrace, MAYBE_OutputToStream) {
+TEST_F(StackTraceTest, MAYBE_OutputToStream) {
StackTrace trace;
// Dump the trace into a string.
@@ -69,7 +75,7 @@ TEST(StackTrace, MAYBE_OutputToStream) {
<< backtrace_message;
#endif
-#elif defined(__GLIBCXX__)
+#elif defined(USE_SYMBOLIZE)
// This branch is for gcc-compiled code, but not Mac due to the
// above #if.
// Expect a demangled symbol.
@@ -103,8 +109,24 @@ TEST(StackTrace, MAYBE_OutputToStream) {
#endif // define(OS_MACOSX)
}
+MULTIPROCESS_TEST_MAIN(MismatchedMallocChildProcess) {
+ char* pointer = new char[10];
+ delete pointer;
+ return 2;
+}
+
+// Regression test for StackDumpingSignalHandler async-signal unsafety.
+// Combined with tcmalloc's debugallocation, that signal handler
+// and e.g. mismatched new[]/delete would cause a hang because
+// of re-entering malloc.
+TEST_F(StackTraceTest, AsyncSignalUnsafeSignalHandlerHang) {
+ ProcessHandle child = this->SpawnChild("MismatchedMallocChildProcess", false);
+ ASSERT_NE(kNullProcessHandle, child);
+ ASSERT_TRUE(WaitForSingleProcess(child, TestTimeouts::action_timeout()));
+}
+
// The test is used for manual testing, e.g., to see the raw output.
-TEST(StackTrace, DebugOutputToStream) {
+TEST_F(StackTraceTest, DebugOutputToStream) {
StackTrace trace;
std::ostringstream os;
trace.OutputToStream(&os);
@@ -112,7 +134,7 @@ TEST(StackTrace, DebugOutputToStream) {
}
// The test is used for manual testing, e.g., to see the raw output.
-TEST(StackTrace, DebugPrintBacktrace) {
+TEST_F(StackTraceTest, DebugPrintBacktrace) {
StackTrace().PrintBacktrace();
}
« base/debug/stack_trace_posix.cc ('K') | « base/debug/stack_trace_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698