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

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

Issue 1994303002: sandbox: fix DeathMessage tests in official builds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | 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. 291 // In official builds CHECK messages are dropped, so look for SIGABRT or SIGILL.
292 // See https://code.google.com/p/chromium/issues/detail?id=437312 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 kSigAbortMessage[] = "Received signal 6"; 296 static const char kSigAbortMessage[] = "Received signal 6";
296 subprocess_exited_without_matching_message = 297 subprocess_exited_without_matching_message =
298 msg.find(kSigIllegalMessage) == std::string::npos &&
297 msg.find(kSigAbortMessage) == std::string::npos; 299 msg.find(kSigAbortMessage) == std::string::npos;
298 } 300 }
299 #endif 301 #endif
300 EXPECT_FALSE(subprocess_exited_without_matching_message) << details; 302 EXPECT_FALSE(subprocess_exited_without_matching_message) << details;
301 } 303 }
302 304
303 void UnitTests::DeathSEGVMessage(int status, 305 void UnitTests::DeathSEGVMessage(int status,
304 const std::string& msg, 306 const std::string& msg,
305 const void* aux) { 307 const void* aux) {
306 std::string details(TestFailedMessage(msg)); 308 std::string details(TestFailedMessage(msg));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 fflush(stderr); 355 fflush(stderr);
354 _exit(kExitWithAssertionFailure); 356 _exit(kExitWithAssertionFailure);
355 } 357 }
356 358
357 void UnitTests::IgnoreThisTest() { 359 void UnitTests::IgnoreThisTest() {
358 fflush(stderr); 360 fflush(stderr);
359 _exit(kIgnoreThisTest); 361 _exit(kIgnoreThisTest);
360 } 362 }
361 363
362 } // namespace 364 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698