P4C
The P4 Compiler
Loading...
Searching...
No Matches
bmv2/test_backend/stf.h
1/*
2 * SPDX-FileCopyrightText: 2023 Google LLC
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_BMV2_TEST_BACKEND_STF_H_
8#define BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_BMV2_TEST_BACKEND_STF_H_
9
10#include <cstddef>
11#include <string>
12#include <vector>
13
14#include <inja/inja.hpp>
15
16#include "lib/cstring.h"
17
18#include "backends/p4tools/modules/testgen/lib/test_spec.h"
19#include "backends/p4tools/modules/testgen/targets/bmv2/test_backend/common.h"
20
22
24class STF : public Bmv2TestFramework {
25 public:
26 explicit STF(const TestBackendConfiguration &testBackendConfiguration);
27
29 void writeTestToFile(const TestSpec *spec, cstring selectedBranches, size_t testId,
30 float currentCoverage) override;
31
32 private:
38 void emitTestcase(const TestSpec *testSpec, cstring selectedBranches, size_t testId,
39 const std::string &testCase, float currentCoverage);
40
42 static std::string getTestCaseTemplate();
43
44 inja::json getExpectedPacket(const TestSpec *testSpec) const override;
45
47 inja::json getSend(const TestSpec *testSpec) const override;
48
49 inja::json getControlPlaneForTable(const TableMatchMap &matches,
50 const std::vector<ActionArg> &args) const override;
51};
52
53} // namespace P4::P4Tools::P4Testgen::Bmv2
54
55#endif /* BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_BMV2_TEST_BACKEND_STF_H_ */
void writeTestToFile(const TestSpec *spec, cstring selectedBranches, size_t testId, float currentCoverage) override
Produce an STF test.
Definition bmv2/test_backend/stf.cpp:202
Definition lib/test_spec.h:303
Definition cstring.h:85
Inja.
Definition targets/bmv2/cmd_stepper.cpp:37
Definition test_backend_configuration.h:22