OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <fcntl.h> | 5 #include <fcntl.h> |
6 #include <poll.h> | 6 #include <poll.h> |
7 #include <signal.h> | 7 #include <signal.h> |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <sys/resource.h> | 9 #include <sys/resource.h> |
10 #include <sys/time.h> | 10 #include <sys/time.h> |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 const char* expected_msg = static_cast<const char*>(aux); | 256 const char* expected_msg = static_cast<const char*>(aux); |
257 | 257 |
258 bool subprocess_terminated_normally = WIFEXITED(status); | 258 bool subprocess_terminated_normally = WIFEXITED(status); |
259 ASSERT_TRUE(subprocess_terminated_normally) << "Exit status: " << status | 259 ASSERT_TRUE(subprocess_terminated_normally) << "Exit status: " << status |
260 << " " << details; | 260 << " " << details; |
261 int subprocess_exit_status = WEXITSTATUS(status); | 261 int subprocess_exit_status = WEXITSTATUS(status); |
262 ASSERT_EQ(1, subprocess_exit_status) << details; | 262 ASSERT_EQ(1, subprocess_exit_status) << details; |
263 | 263 |
264 bool subprocess_exited_without_matching_message = | 264 bool subprocess_exited_without_matching_message = |
265 msg.find(expected_msg) == std::string::npos; | 265 msg.find(expected_msg) == std::string::npos; |
| 266 |
| 267 // In official builds CHECK messages are dropped, so look for SIGABRT. |
| 268 // See https://code.google.com/p/chromium/issues/detail?id=437312 |
| 269 #if defined(OFFICIAL_BUILD) && defined(NDEBUG) && !defined(OS_ANDROID) |
| 270 if (subprocess_exited_without_matching_message) { |
| 271 static const char kSigAbortMessage[] = "Received signal 6"; |
| 272 subprocess_exited_without_matching_message = |
| 273 msg.find(kSigAbortMessage) == std::string::npos; |
| 274 } |
| 275 #endif |
266 EXPECT_FALSE(subprocess_exited_without_matching_message) << details; | 276 EXPECT_FALSE(subprocess_exited_without_matching_message) << details; |
267 } | 277 } |
268 | 278 |
269 void UnitTests::DeathSEGVMessage(int status, | 279 void UnitTests::DeathSEGVMessage(int status, |
270 const std::string& msg, | 280 const std::string& msg, |
271 const void* aux) { | 281 const void* aux) { |
272 std::string details(TestFailedMessage(msg)); | 282 std::string details(TestFailedMessage(msg)); |
273 const char* expected_msg = static_cast<const char*>(aux); | 283 const char* expected_msg = static_cast<const char*>(aux); |
274 | 284 |
275 #if defined(OS_ANDROID) | 285 #if defined(OS_ANDROID) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 fflush(stderr); | 327 fflush(stderr); |
318 _exit(kExitWithAssertionFailure); | 328 _exit(kExitWithAssertionFailure); |
319 } | 329 } |
320 | 330 |
321 void UnitTests::IgnoreThisTest() { | 331 void UnitTests::IgnoreThisTest() { |
322 fflush(stderr); | 332 fflush(stderr); |
323 _exit(kIgnoreThisTest); | 333 _exit(kIgnoreThisTest); |
324 } | 334 } |
325 | 335 |
326 } // namespace | 336 } // namespace |
OLD | NEW |