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.
11 #include "base/logging.h"
12 #include "base/posix/eintr_wrapper.h"
13 #include "sandbox/linux/tests/unit_tests.h"
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;
23 SANDBOX_DEATH_TEST(UnitTests
,
25 DEATH_EXIT_CODE(kExpectedExitCode
)) {
26 _exit(kExpectedExitCode
);
29 const int kExpectedSignalNumber
= SIGKILL
;
31 SANDBOX_DEATH_TEST(UnitTests
,
33 DEATH_BY_SIGNAL(kExpectedSignalNumber
)) {
34 raise(kExpectedSignalNumber
);
37 SANDBOX_DEATH_TEST(UnitTests
,
39 DEATH_MESSAGE("Hello")) {
40 LOG(ERROR
) << "Hello";
44 SANDBOX_DEATH_TEST(UnitTests
,
46 DEATH_SEGV_MESSAGE("Hello")) {
47 LOG(ERROR
) << "Hello";
49 volatile char* addr
= reinterpret_cast<volatile char*>(NULL
);
56 SANDBOX_TEST_ALLOW_NOISE(UnitTests
, NoisyTest
) {
57 LOG(ERROR
) << "The cow says moo!";
62 } // namespace sandbox