P4C
The P4 Compiler
Loading...
Searching...
No Matches
testgen.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_TESTGEN_H_
8#define BACKENDS_P4TOOLS_MODULES_TESTGEN_TESTGEN_H_
9
10#include "backends/p4tools/common/p4ctool.h"
11
12#include "backends/p4tools/modules/testgen/core/target.h"
13#include "backends/p4tools/modules/testgen/lib/test_framework.h"
14#include "backends/p4tools/modules/testgen/options.h"
15
16namespace P4::P4Tools::P4Testgen {
17
19class Testgen : public AbstractP4cTool<TestgenOptions> {
20 protected:
21 void registerTarget() override;
22
23 int mainImpl(const CompilerResult &compilerResult) override;
24
25 public:
30 static std::optional<AbstractTestList> generateTests(const TestgenOptions &testgenOptions);
36 static std::optional<AbstractTestList> generateTests(std::string_view program,
37 const TestgenOptions &testgenOptions);
38
44 static int writeTests(const TestgenOptions &testgenOptions);
45
50 static int writeTests(std::string_view program, const TestgenOptions &testgenOptions);
51
52 virtual ~Testgen() = default;
53};
54
55} // namespace P4::P4Tools::P4Testgen
56
57#endif /* BACKENDS_P4TOOLS_MODULES_TESTGEN_TESTGEN_H_ */
Definition p4ctool.h:28
Definition common/compiler/compiler_result.h:20
This is main implementation of the P4Testgen tool.
Definition testgen.h:19
static std::optional< AbstractTestList > generateTests(const TestgenOptions &testgenOptions)
Definition testgen.cpp:225
static int writeTests(const TestgenOptions &testgenOptions)
Definition testgen.cpp:251
int mainImpl(const CompilerResult &compilerResult) override
Definition testgen.cpp:200
Encapsulates and processes command-line options for P4Testgen.
Definition backends/p4tools/modules/testgen/options.h:25