chromium/sandbox/linux/tests/unit_tests.cc

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

#include <fcntl.h>
#include <poll.h>
#include <signal.h>
#include <stddef.h>
#include <stdio.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>

#include <tuple>

#include "base/containers/contains.h"
#include "base/debug/leak_annotations.h"
#include "base/files/file_util.h"
#include "base/posix/eintr_wrapper.h"
#include "build/build_config.h"
#include "sandbox/linux/tests/unit_tests.h"

// Specifically, PNaCl toolchain does not have this flag.
#if !defined(POLLRDHUP)
#define POLLRDHUP
#endif

namespace {
std::string TestFailedMessage(const std::string& msg) {}

int GetSubProcessTimeoutTimeInSeconds() {}

// Returns the number of threads of the current process or -1.
int CountThreads() {}

}  // namespace

namespace sandbox {

bool IsAndroid() {}

bool IsArchitectureArm() {}

static const int kExpectedValue =;
static const int kIgnoreThisTest =;
static const int kExitWithAssertionFailure =;
static const int kExitForTimeout =;

static void SigAlrmHandler(int) {}

// Set a timeout with a handler that will automatically fail the
// test.
static void SetProcessTimeout(int time_in_seconds) {}

// Runs a test in a sub-process. This is necessary for most of the code
// in the BPF sandbox, as it potentially makes global state changes and as
// it also tends to raise fatal errors, if the code has been used in an
// insecure manner.
void UnitTests::RunTestInProcess(SandboxTestRunner* test_runner,
                                 DeathCheck death,
                                 const void* death_aux) {}

void UnitTests::DeathSuccess(int status, const std::string& msg, const void*) {}

void UnitTests::DeathSuccessAllowNoise(int status,
                                       const std::string& msg,
                                       const void*) {}

void UnitTests::DeathMessage(int status,
                             const std::string& msg,
                             const void* aux) {}

void UnitTests::DeathSEGVMessage(int status,
                                 const std::string& msg,
                                 const void* aux) {}

void UnitTests::DeathExitCode(int status,
                              const std::string& msg,
                              const void* aux) {}

void UnitTests::DeathBySignal(int status,
                              const std::string& msg,
                              const void* aux) {}

void UnitTests::AssertionFailure(const char* expr, const char* file, int line) {}

void UnitTests::IgnoreThisTest() {}

}  // namespace sandbox