P4C
The P4 Compiler
Loading...
Searching...
No Matches
targets/ebpf/test_backend.h
1/*
2 * SPDX-FileCopyrightText: 2022 The P4 Language Consortium
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_EBPF_TEST_BACKEND_H_
8#define BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_EBPF_TEST_BACKEND_H_
9
10#include <cstdint>
11#include <filesystem>
12#include <functional>
13#include <optional>
14#include <string>
15#include <vector>
16
17#include "backends/p4tools/common/lib/model.h"
18#include "backends/p4tools/common/lib/trace_event.h"
19#include "ir/ir.h"
20#include "lib/big_int_util.h"
21
22#include "backends/p4tools/modules/testgen/core/program_info.h"
23#include "backends/p4tools/modules/testgen/core/symbolic_executor/symbolic_executor.h"
24#include "backends/p4tools/modules/testgen/lib/execution_state.h"
25#include "backends/p4tools/modules/testgen/lib/test_backend.h"
26#include "backends/p4tools/modules/testgen/lib/test_spec.h"
27
28namespace P4::P4Tools::P4Testgen::EBPF {
29
30class EBPFTestBackend : public TestBackEnd {
31 private:
36 static const int ZERO_PKT_WIDTH = 32;
37 static const big_int ZERO_PKT_VAL;
38 static const big_int ZERO_PKT_MAX;
40 static const std::vector<std::string> SUPPORTED_BACKENDS;
41
42 public:
43 explicit EBPFTestBackend(const ProgramInfo &programInfo,
44 const TestBackendConfiguration &testBackendConfiguration,
46
48 const ExecutionState *executionState, const Model *finalModel,
49 const IR::Expression *outputPacketExpr, const IR::Expression *outputPortExpr,
50 const std::vector<std::reference_wrapper<const TraceEvent>> *programTraces) override;
51
52 const TestSpec *createTestSpec(const ExecutionState *executionState, const Model *finalModel,
53 const TestInfo &testInfo) override;
54};
55
56} // namespace P4::P4Tools::P4Testgen::EBPF
57
58#endif /* BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_EBPF_TEST_BACKEND_H_ */
Definition backends/p4tools/common/lib/model.h:24
TestBackEnd::TestInfo produceTestInfo(const ExecutionState *executionState, const Model *finalModel, const IR::Expression *outputPacketExpr, const IR::Expression *outputPortExpr, const std::vector< std::reference_wrapper< const TraceEvent > > *programTraces) override
Definition targets/ebpf/test_backend.cpp:60
const TestSpec * createTestSpec(const ExecutionState *executionState, const Model *finalModel, const TestInfo &testInfo) override
Definition targets/ebpf/test_backend.cpp:84
Represents state of execution after having reached a program point.
Definition execution_state.h:40
Stores target-specific information about a P4 program.
Definition core/program_info.h:27
Definition symbolic_executor.h:27
SymbolicExecutor & symbex
Definition lib/test_backend.h:49
Definition lib/test_backend.h:77
Definition lib/test_spec.h:303
Definition test_backend_configuration.h:22