P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::P4Tools::P4Testgen::Testgen Class Reference

This is main implementation of the P4Testgen tool. More...

#include <testgen.h>

Inheritance diagram for P4::P4Tools::P4Testgen::Testgen:
[legend]

Static Public Member Functions

static std::optional< AbstractTestList > generateTests (const TestgenOptions &testgenOptions)
 
static std::optional< AbstractTestList > generateTests (std::string_view program, const TestgenOptions &testgenOptions)
 
static int writeTests (const TestgenOptions &testgenOptions)
 
static int writeTests (std::string_view program, const TestgenOptions &testgenOptions)
 

Protected Member Functions

int mainImpl (const CompilerResult &compilerResult) override
 
void registerTarget () override
 
- Protected Member Functions inherited from P4::P4Tools::AbstractP4cTool< TestgenOptions >

Additional Inherited Members

- Public Member Functions inherited from P4::P4Tools::AbstractP4cTool< TestgenOptions >
int main (std::string_view toolName, const std::vector< const char * > &args)
 

Detailed Description

This is main implementation of the P4Testgen tool.

Member Function Documentation

◆ generateTests() [1/2]

std::optional< AbstractTestList > P4::P4Tools::P4Testgen::Testgen::generateTests ( const TestgenOptions & testgenOptions)
static

Invokes P4Testgen and returns a list of abstract tests which are generated based on the input TestgenOptions. The abstract tests can be further specialized depending on the select test back end. CompilerOptions is required to invoke the correct preprocessor and P4 compiler. It is assumed that .file in the compiler options is set.

◆ generateTests() [2/2]

std::optional< AbstractTestList > P4::P4Tools::P4Testgen::Testgen::generateTests ( std::string_view program,
const TestgenOptions & testgenOptions )
static

Invokes P4Testgen and returns a list of abstract tests which are generated based on the input TestgenOptions. The abstract tests can be further specialized depending on the select test back end. CompilerOptions is required to invoke the correct P4 compiler. This function assumes that

Parameters
programis already preprocessed. P4Testgen will directly parse the input program.

◆ mainImpl()

int P4::P4Tools::P4Testgen::Testgen::mainImpl ( const CompilerResult & compilerResult)
overrideprotectedvirtual

Provides the implementation of the tool.

Parameters
programThe P4 program after mid-end processing.

Implements P4::P4Tools::AbstractP4cTool< TestgenOptions >.

◆ registerTarget()

void P4::P4Tools::P4Testgen::Testgen::registerTarget ( )
overrideprotectedvirtual

◆ writeTests() [1/2]

int P4::P4Tools::P4Testgen::Testgen::writeTests ( const TestgenOptions & testgenOptions)
static

Invokes P4Testgen and writes a list of abstract tests to a specified output directory which are generated based on the input TestgenOptions. The abstract tests can be further specialized depending on the select test back end. CompilerOptions is required to invoke the correct preprocessor and P4 compiler. It is assumed that .file in the compiler options is set.

◆ writeTests() [2/2]

int P4::P4Tools::P4Testgen::Testgen::writeTests ( std::string_view program,
const TestgenOptions & testgenOptions )
static

Invokes P4Testgen and writes a list of abstract tests to a specified output directory which are generated based on the input TestgenOptions. CompilerOptions is required to invoke the correct P4 compiler. This function assumes that

Parameters
programis already preprocessed. P4Testgen will directly parse the input program.