chromium/sandbox/linux/bpf_dsl/codegen_unittest.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 "sandbox/linux/bpf_dsl/codegen.h"

#include <stddef.h>
#include <stdint.h>

#include <map>
#include <string_view>
#include <utility>
#include <vector>

#include "base/hash/md5.h"
#include "sandbox/linux/system_headers/linux_filter.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace sandbox {
namespace {

// Hash provides an abstraction for building "hash trees" from BPF
// control flow graphs, and efficiently identifying equivalent graphs.
//
// For simplicity, we use MD5, because base happens to provide a
// convenient API for its use. However, any collision-resistant hash
// should suffice.
class Hash {};

const Hash Hash::kZero;

// Sanity check that equality and inequality work on Hash as required.
TEST(CodeGen, HashSanity) {}

// ProgramTest provides a fixture for writing compiling sample
// programs with CodeGen and verifying the linearized output matches
// the input DAG.
class ProgramTest : public ::testing::Test {};

TEST_F(ProgramTest, OneInstruction) {}

TEST_F(ProgramTest, SimpleBranch) {}

TEST_F(ProgramTest, AtypicalBranch) {}

TEST_F(ProgramTest, Complex) {}

TEST_F(ProgramTest, ConfusingTails) {}

TEST_F(ProgramTest, ConfusingTailsBasic) {}

TEST_F(ProgramTest, ConfusingTailsMergeable) {}

TEST_F(ProgramTest, InstructionFolding) {}

TEST_F(ProgramTest, FarBranches) {}

TEST_F(ProgramTest, JumpReuse) {}

}  // namespace
}  // namespace sandbox