OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <limits> | 5 #include <limits> |
6 #include <sstream> | 6 #include <sstream> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/debug/stack_trace.h" | 9 #include "base/debug/stack_trace.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #endif | 28 #endif |
29 | 29 |
30 // Note: On Linux, this test currently only fully works on Debug builds. | 30 // Note: On Linux, this test currently only fully works on Debug builds. |
31 // See comments in the #ifdef soup if you intend to change this. | 31 // See comments in the #ifdef soup if you intend to change this. |
32 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
33 // Always fails on Windows: crbug.com/32070 | 33 // Always fails on Windows: crbug.com/32070 |
34 #define MAYBE_OutputToStream DISABLED_OutputToStream | 34 #define MAYBE_OutputToStream DISABLED_OutputToStream |
35 #else | 35 #else |
36 #define MAYBE_OutputToStream OutputToStream | 36 #define MAYBE_OutputToStream OutputToStream |
37 #endif | 37 #endif |
| 38 #if !defined(__UCLIBC__) |
38 TEST_F(StackTraceTest, MAYBE_OutputToStream) { | 39 TEST_F(StackTraceTest, MAYBE_OutputToStream) { |
39 StackTrace trace; | 40 StackTrace trace; |
40 | 41 |
41 // Dump the trace into a string. | 42 // Dump the trace into a string. |
42 std::ostringstream os; | 43 std::ostringstream os; |
43 trace.OutputToStream(&os); | 44 trace.OutputToStream(&os); |
44 std::string backtrace_message = os.str(); | 45 std::string backtrace_message = os.str(); |
45 | 46 |
46 // ToString() should produce the same output. | 47 // ToString() should produce the same output. |
47 EXPECT_EQ(backtrace_message, trace.ToString()); | 48 EXPECT_EQ(backtrace_message, trace.ToString()); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 StackTrace trace; | 124 StackTrace trace; |
124 std::ostringstream os; | 125 std::ostringstream os; |
125 trace.OutputToStream(&os); | 126 trace.OutputToStream(&os); |
126 VLOG(1) << os.str(); | 127 VLOG(1) << os.str(); |
127 } | 128 } |
128 | 129 |
129 // The test is used for manual testing, e.g., to see the raw output. | 130 // The test is used for manual testing, e.g., to see the raw output. |
130 TEST_F(StackTraceTest, DebugPrintBacktrace) { | 131 TEST_F(StackTraceTest, DebugPrintBacktrace) { |
131 StackTrace().Print(); | 132 StackTrace().Print(); |
132 } | 133 } |
| 134 #endif // !defined(__UCLIBC__) |
133 | 135 |
134 #if defined(OS_POSIX) && !defined(OS_ANDROID) | 136 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
135 #if !defined(OS_IOS) | 137 #if !defined(OS_IOS) |
136 MULTIPROCESS_TEST_MAIN(MismatchedMallocChildProcess) { | 138 MULTIPROCESS_TEST_MAIN(MismatchedMallocChildProcess) { |
137 char* pointer = new char[10]; | 139 char* pointer = new char[10]; |
138 delete pointer; | 140 delete pointer; |
139 return 2; | 141 return 2; |
140 } | 142 } |
141 | 143 |
142 // Regression test for StackDumpingSignalHandler async-signal unsafety. | 144 // Regression test for StackDumpingSignalHandler async-signal unsafety. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 1)); | 222 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 1)); |
221 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 2)); | 223 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 2)); |
222 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 3)); | 224 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 3)); |
223 EXPECT_EQ("0688", itoa_r_wrapper(0x688, 128, 16, 4)); | 225 EXPECT_EQ("0688", itoa_r_wrapper(0x688, 128, 16, 4)); |
224 EXPECT_EQ("00688", itoa_r_wrapper(0x688, 128, 16, 5)); | 226 EXPECT_EQ("00688", itoa_r_wrapper(0x688, 128, 16, 5)); |
225 } | 227 } |
226 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) | 228 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) |
227 | 229 |
228 } // namespace debug | 230 } // namespace debug |
229 } // namespace base | 231 } // namespace base |
OLD | NEW |