P4C
The P4 Compiler
Loading...
Searching...
No Matches
targets/tofino/test_backend.h
1/*******************************************************************************
2 * Copyright (C) 2024 Intel Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing,
11 * software distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions
14 * and limitations under the License.
15 *
16 *
17 * SPDX-License-Identifier: Apache-2.0
18 ******************************************************************************/
19
20#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_TOFINO_TEST_BACKEND_H_
21#define BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_TOFINO_TEST_BACKEND_H_
22
23#include <cstdint>
24#include <optional>
25#include <string>
26#include <vector>
27
28#include <boost/filesystem.hpp>
29
30#include "backends/p4tools/common/lib/model.h"
31#include "backends/p4tools/common/lib/trace_event.h"
32#include "ir/ir.h"
33
34#include "backends/p4tools/modules/testgen/core/program_info.h"
35#include "backends/p4tools/modules/testgen/core/symbolic_executor/symbolic_executor.h"
36#include "backends/p4tools/modules/testgen/lib/execution_state.h"
37#include "backends/p4tools/modules/testgen/lib/test_backend.h"
38#include "backends/p4tools/modules/testgen/targets/tofino/shared_program_info.h"
39#include "backends/p4tools/modules/testgen/targets/tofino/test_spec.h"
40
41namespace P4::P4Tools::P4Testgen::Tofino {
42
43class TofinoTestBackend : public TestBackEnd {
44 private:
45 static const std::vector<std::string> SUPPORTED_BACKENDS;
46
47 public:
48 explicit TofinoTestBackend(const TofinoSharedProgramInfo &programInfo,
49 const TestBackendConfiguration &testBackendConfiguration,
51
53 const ExecutionState *executionState, const Model *finalModel,
54 const IR::Expression *outputPacketExpr, const IR::Expression *outputPortExpr,
55 const std::vector<std::reference_wrapper<const TraceEvent>> *programTraces) override;
56
57 const TestSpec *createTestSpec(const ExecutionState *executionState, const Model *finalModel,
58 const TestInfo &testInfo) override;
59
60 bool printTestInfo(const ExecutionState *executionState, const TestInfo &testInfo,
61 const IR::Expression *outputPortExpr) override;
62};
63
64} // namespace P4::P4Tools::P4Testgen::Tofino
65
66#endif /* BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_TOFINO_TEST_BACKEND_H_ */
Definition backends/p4tools/common/lib/model.h:18
Represents state of execution after having reached a program point.
Definition execution_state.h:34
Definition symbolic_executor.h:21
SymbolicExecutor & symbex
Definition lib/test_backend.h:43
Definition lib/test_backend.h:71
Definition lib/test_spec.h:296
Definition tofino/shared_program_info.h:30
const TestSpec * createTestSpec(const ExecutionState *executionState, const Model *finalModel, const TestInfo &testInfo) override
Definition targets/tofino/test_backend.cpp:96
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/tofino/test_backend.cpp:84
bool printTestInfo(const ExecutionState *executionState, const TestInfo &testInfo, const IR::Expression *outputPortExpr) override
Definition targets/tofino/test_backend.cpp:73
Definition test_backend_configuration.h:16