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

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

Issue 670183003: Update from chromium 62675d9fb31fb8cedc40f68e78e8445a74f362e7 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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/tests/unit_tests.cc ('k') | sandbox/sandbox_export.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <signal.h>
6 #include <stdlib.h>
7 #include <sys/types.h>
8 #include <sys/wait.h>
9 #include <unistd.h>
10
11 #include "base/logging.h"
12 #include "base/posix/eintr_wrapper.h"
13 #include "sandbox/linux/tests/unit_tests.h"
14
15 namespace sandbox {
16
17 namespace {
18
19 // Let's not use any of the "magic" values used internally in unit_tests.cc,
20 // such as kExpectedValue.
21 const int kExpectedExitCode = 100;
22
23 SANDBOX_DEATH_TEST(UnitTests,
24 DeathExitCode,
25 DEATH_EXIT_CODE(kExpectedExitCode)) {
26 _exit(kExpectedExitCode);
27 }
28
29 const int kExpectedSignalNumber = SIGKILL;
30
31 SANDBOX_DEATH_TEST(UnitTests,
32 DeathBySignal,
33 DEATH_BY_SIGNAL(kExpectedSignalNumber)) {
34 raise(kExpectedSignalNumber);
35 }
36
37 SANDBOX_DEATH_TEST(UnitTests,
38 DeathWithMessage,
39 DEATH_MESSAGE("Hello")) {
40 LOG(ERROR) << "Hello";
41 _exit(1);
42 }
43
44 SANDBOX_DEATH_TEST(UnitTests,
45 SEGVDeathWithMessage,
46 DEATH_SEGV_MESSAGE("Hello")) {
47 LOG(ERROR) << "Hello";
48 while (1) {
49 volatile char* addr = reinterpret_cast<volatile char*>(NULL);
50 *addr = '\0';
51 }
52
53 _exit(2);
54 }
55
56 SANDBOX_TEST_ALLOW_NOISE(UnitTests, NoisyTest) {
57 LOG(ERROR) << "The cow says moo!";
58 }
59
60 } // namespace
61
62 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/linux/tests/unit_tests.cc ('k') | sandbox/sandbox_export.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698