1#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_TEST_GTEST_UTILS_H_
2#define BACKENDS_P4TOOLS_MODULES_TESTGEN_TEST_GTEST_UTILS_H_
4#include <gtest/gtest.h>
10#include "frontends/common/options.h"
12#include "lib/compile_context.h"
14#include "backends/p4tools/modules/testgen/core/target.h"
15#include "backends/p4tools/modules/testgen/register.h"
16#include "backends/p4tools/modules/testgen/toolname.h"
18namespace P4::P4Tools::Test {
24 static std::optional<const P4ToolsTestCase>
create(std::string deviceName, std::string archName,
25 CompilerOptions::FrontendVersion langVersion,
26 const std::string &source);
29 static std::optional<const P4ToolsTestCase>
create_14(std::string deviceName,
31 const std::string &source);
34 static std::optional<const P4ToolsTestCase>
create_16(std::string deviceName,
36 const std::string &source);
41 [[nodiscard]]
const IR::P4Program &
getProgram()
const;
49 std::reference_wrapper<const P4Tools::CompilerResult> compilerResults;
52 static void ensureInit();
57 [[nodiscard]]
static std::unique_ptr<AutoCompileContext>
SetUp(std::string_view target,
58 std::string_view archName) {
59 P4Tools::P4Testgen::registerTestgenTargets();
65 if (!ctxOpt.has_value()) {
68 return std::make_unique<AutoCompileContext>(ctxOpt.value());
75 const IR::SymbolicVariable *preorder(IR::Member *member)
override;