chromium/sandbox/linux/services/namespace_sandbox_unittest.cc

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "sandbox/linux/services/namespace_sandbox.h"

#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>

#include <string>
#include <utility>

#include "base/check_op.h"
#include "base/command_line.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
#include "base/process/launch.h"
#include "base/process/process.h"
#include "base/test/multiprocess_test.h"
#include "sandbox/linux/services/credentials.h"
#include "sandbox/linux/services/namespace_utils.h"
#include "sandbox/linux/services/proc_util.h"
#include "sandbox/linux/tests/unit_tests.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/multiprocess_func_list.h"

namespace sandbox {

namespace {

bool RootDirectoryIsEmpty() {}

class NamespaceSandboxTest : public base::MultiProcessTest {};

MULTIPROCESS_TEST_MAIN(SimpleChildProcess) {}

TEST_F(NamespaceSandboxTest, BasicUsage) {}

MULTIPROCESS_TEST_MAIN(PidNsOnlyChildProcess) {}


TEST_F(NamespaceSandboxTest, BasicUsageWithOptions) {}

MULTIPROCESS_TEST_MAIN(ChrootMe) {}

// Temporarily disabled on ASAN due to crbug.com/451603.
// Disabled on MSAN due to crbug.com/1180105
TEST_F(NamespaceSandboxTest, DISABLE_ON_SANITIZERS(ChrootAndDropCapabilities)) {}

MULTIPROCESS_TEST_MAIN(NestedNamespaceSandbox) {}

TEST_F(NamespaceSandboxTest, NestedNamespaceSandbox) {}

const int kNormalExitCode =;

// Ensure that CHECK(false) is distinguishable from _exit(kNormalExitCode).
// Allowing noise since CHECK(false) will write a stack trace to stderr.
SANDBOX_TEST_ALLOW_NOISE(ForkInNewPidNamespace, CheckDoesNotReturnZero) {}

SANDBOX_TEST(ForkInNewPidNamespace, BasicUsage) {}

SANDBOX_TEST(ForkInNewPidNamespace, ExitWithSignal) {}

volatile sig_atomic_t signal_handler_called;
void ExitSuccessfully(int sig) {}

SANDBOX_TEST(InstallTerminationSignalHandler, DoesNotOverrideExistingHandlers) {}

}  // namespace

}  // namespace sandbox