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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 std::string details(TestFailedMessage(msg)); | 201 std::string details(TestFailedMessage(msg)); |
202 | 202 |
203 bool subprocess_terminated_normally = WIFEXITED(status); | 203 bool subprocess_terminated_normally = WIFEXITED(status); |
204 ASSERT_TRUE(subprocess_terminated_normally) << details; | 204 ASSERT_TRUE(subprocess_terminated_normally) << details; |
205 int subprocess_exit_status = WEXITSTATUS(status); | 205 int subprocess_exit_status = WEXITSTATUS(status); |
206 ASSERT_EQ(kExpectedValue, subprocess_exit_status) << details; | 206 ASSERT_EQ(kExpectedValue, subprocess_exit_status) << details; |
207 bool subprocess_exited_but_printed_messages = !msg.empty(); | 207 bool subprocess_exited_but_printed_messages = !msg.empty(); |
208 EXPECT_FALSE(subprocess_exited_but_printed_messages) << details; | 208 EXPECT_FALSE(subprocess_exited_but_printed_messages) << details; |
209 } | 209 } |
210 | 210 |
| 211 void UnitTests::DeathSuccessAllowNoise(int status, |
| 212 const std::string& msg, |
| 213 const void*) { |
| 214 std::string details(TestFailedMessage(msg)); |
| 215 |
| 216 bool subprocess_terminated_normally = WIFEXITED(status); |
| 217 ASSERT_TRUE(subprocess_terminated_normally) << details; |
| 218 int subprocess_exit_status = WEXITSTATUS(status); |
| 219 ASSERT_EQ(kExpectedValue, subprocess_exit_status) << details; |
| 220 } |
| 221 |
211 void UnitTests::DeathMessage(int status, | 222 void UnitTests::DeathMessage(int status, |
212 const std::string& msg, | 223 const std::string& msg, |
213 const void* aux) { | 224 const void* aux) { |
214 std::string details(TestFailedMessage(msg)); | 225 std::string details(TestFailedMessage(msg)); |
215 const char* expected_msg = static_cast<const char*>(aux); | 226 const char* expected_msg = static_cast<const char*>(aux); |
216 | 227 |
217 bool subprocess_terminated_normally = WIFEXITED(status); | 228 bool subprocess_terminated_normally = WIFEXITED(status); |
218 ASSERT_TRUE(subprocess_terminated_normally) << details; | 229 ASSERT_TRUE(subprocess_terminated_normally) << details; |
219 int subprocess_exit_status = WEXITSTATUS(status); | 230 int subprocess_exit_status = WEXITSTATUS(status); |
220 ASSERT_EQ(kExitWithAssertionFailure, subprocess_exit_status) << details; | 231 ASSERT_EQ(kExitWithAssertionFailure, subprocess_exit_status) << details; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 fflush(stderr); | 263 fflush(stderr); |
253 _exit(kExitWithAssertionFailure); | 264 _exit(kExitWithAssertionFailure); |
254 } | 265 } |
255 | 266 |
256 void UnitTests::IgnoreThisTest() { | 267 void UnitTests::IgnoreThisTest() { |
257 fflush(stderr); | 268 fflush(stderr); |
258 _exit(kIgnoreThisTest); | 269 _exit(kIgnoreThisTest); |
259 } | 270 } |
260 | 271 |
261 } // namespace | 272 } // namespace |
OLD | NEW |