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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 return 2; | 141 return 2; |
142 } | 142 } |
143 | 143 |
144 // Regression test for StackDumpingSignalHandler async-signal unsafety. | 144 // Regression test for StackDumpingSignalHandler async-signal unsafety. |
145 // Combined with tcmalloc's debugallocation, that signal handler | 145 // Combined with tcmalloc's debugallocation, that signal handler |
146 // and e.g. mismatched new[]/delete would cause a hang because | 146 // and e.g. mismatched new[]/delete would cause a hang because |
147 // of re-entering malloc. | 147 // of re-entering malloc. |
148 TEST_F(StackTraceTest, AsyncSignalUnsafeSignalHandlerHang) { | 148 TEST_F(StackTraceTest, AsyncSignalUnsafeSignalHandlerHang) { |
149 Process child = SpawnChild("MismatchedMallocChildProcess"); | 149 Process child = SpawnChild("MismatchedMallocChildProcess"); |
150 ASSERT_TRUE(child.IsValid()); | 150 ASSERT_TRUE(child.IsValid()); |
151 ASSERT_TRUE(WaitForSingleProcess(child.Handle(), | 151 int exit_code; |
152 TestTimeouts::action_timeout())); | 152 ASSERT_TRUE(child.WaitForExitWithTimeout(TestTimeouts::action_timeout(), |
| 153 &exit_code)); |
153 } | 154 } |
154 #endif // !defined(OS_IOS) | 155 #endif // !defined(OS_IOS) |
155 | 156 |
156 namespace { | 157 namespace { |
157 | 158 |
158 std::string itoa_r_wrapper(intptr_t i, size_t sz, int base, size_t padding) { | 159 std::string itoa_r_wrapper(intptr_t i, size_t sz, int base, size_t padding) { |
159 char buffer[1024]; | 160 char buffer[1024]; |
160 CHECK_LE(sz, sizeof(buffer)); | 161 CHECK_LE(sz, sizeof(buffer)); |
161 | 162 |
162 char* result = internal::itoa_r(i, buffer, sz, base, padding); | 163 char* result = internal::itoa_r(i, buffer, sz, base, padding); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 1)); | 224 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 1)); |
224 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 2)); | 225 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 2)); |
225 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 3)); | 226 EXPECT_EQ("688", itoa_r_wrapper(0x688, 128, 16, 3)); |
226 EXPECT_EQ("0688", itoa_r_wrapper(0x688, 128, 16, 4)); | 227 EXPECT_EQ("0688", itoa_r_wrapper(0x688, 128, 16, 4)); |
227 EXPECT_EQ("00688", itoa_r_wrapper(0x688, 128, 16, 5)); | 228 EXPECT_EQ("00688", itoa_r_wrapper(0x688, 128, 16, 5)); |
228 } | 229 } |
229 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) | 230 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) |
230 | 231 |
231 } // namespace debug | 232 } // namespace debug |
232 } // namespace base | 233 } // namespace base |
OLD | NEW |