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

Side by Side Diff: sandbox/linux/tests/unit_tests.cc

Issue 2709203002: sandbox tests: Adapt test expectations to new CHECK() behavior (Closed)
Patch Set: Created 3 years, 10 months 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 unified diff | Download patch
« no previous file with comments | « sandbox/linux/syscall_broker/broker_file_permission_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 8 #include <stddef.h>
9 #include <stdio.h> 9 #include <stdio.h>
10 #include <sys/resource.h> 10 #include <sys/resource.h>
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 281
282 bool subprocess_terminated_normally = WIFEXITED(status); 282 bool subprocess_terminated_normally = WIFEXITED(status);
283 ASSERT_TRUE(subprocess_terminated_normally) << "Exit status: " << status 283 ASSERT_TRUE(subprocess_terminated_normally) << "Exit status: " << status
284 << " " << details; 284 << " " << details;
285 int subprocess_exit_status = WEXITSTATUS(status); 285 int subprocess_exit_status = WEXITSTATUS(status);
286 ASSERT_EQ(1, subprocess_exit_status) << details; 286 ASSERT_EQ(1, subprocess_exit_status) << details;
287 287
288 bool subprocess_exited_without_matching_message = 288 bool subprocess_exited_without_matching_message =
289 msg.find(expected_msg) == std::string::npos; 289 msg.find(expected_msg) == std::string::npos;
290 290
291 // In official builds CHECK messages are dropped, so look for SIGABRT or SIGILL. 291 // In official builds CHECK messages are dropped, look for SIGABRT or SIGTRAP.
292 // See https://crbug.com/437312 and https://crbug.com/612507. 292 // See https://crbug.com/437312 and https://crbug.com/612507.
293 #if defined(OFFICIAL_BUILD) && defined(NDEBUG) && !defined(OS_ANDROID) 293 #if defined(OFFICIAL_BUILD) && defined(NDEBUG) && !defined(OS_ANDROID)
294 if (subprocess_exited_without_matching_message) { 294 if (subprocess_exited_without_matching_message) {
295 static const char kSigIllegalMessage[] = "Received signal 4"; 295 static const char kSigTrapMessage[] = "Received signal 5";
296 static const char kSigAbortMessage[] = "Received signal 6"; 296 static const char kSigAbortMessage[] = "Received signal 6";
297 subprocess_exited_without_matching_message = 297 subprocess_exited_without_matching_message =
298 msg.find(kSigIllegalMessage) == std::string::npos && 298 msg.find(kSigTrapMessage) == std::string::npos &&
299 msg.find(kSigAbortMessage) == std::string::npos; 299 msg.find(kSigAbortMessage) == std::string::npos;
300 } 300 }
301 #endif 301 #endif
302 EXPECT_FALSE(subprocess_exited_without_matching_message) << details; 302 EXPECT_FALSE(subprocess_exited_without_matching_message) << details;
303 } 303 }
304 304
305 void UnitTests::DeathSEGVMessage(int status, 305 void UnitTests::DeathSEGVMessage(int status,
306 const std::string& msg, 306 const std::string& msg,
307 const void* aux) { 307 const void* aux) {
308 std::string details(TestFailedMessage(msg)); 308 std::string details(TestFailedMessage(msg));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 fflush(stderr); 355 fflush(stderr);
356 _exit(kExitWithAssertionFailure); 356 _exit(kExitWithAssertionFailure);
357 } 357 }
358 358
359 void UnitTests::IgnoreThisTest() { 359 void UnitTests::IgnoreThisTest() {
360 fflush(stderr); 360 fflush(stderr);
361 _exit(kIgnoreThisTest); 361 _exit(kIgnoreThisTest);
362 } 362 }
363 363
364 } // namespace 364 } // namespace
OLDNEW
« no previous file with comments | « sandbox/linux/syscall_broker/broker_file_permission_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698