[P4Testgen] Improve library support for P4Testgen and the P4Tools framework. #4294
Open
Description
It should be possible to link P4Testgen or P4Tools in general as a library. Currently, we can only call it as a binary. For that to be possible several things need to happen first.
- Move ProgramInfo into
common
. ProgramInfo will become a first-class construct of the framework. - Remove the Singleton patterns from
Target
andAbstractP4cToolOptions
. No construct in the framework should be a static global singleton. Instead they will be members of ProgramInfo ([P4Testgen] Reduce the use of static objects in P4Testgen #4286). - Split the options into compiler options and ToolsOptions. These options are currently conflated, which makes it hard to make clean library calls to the tool.
- Finally, build the P4Testgen library, which takes in CompilerOptions and P4TestgenOptions as arguments and generates tests based on these two classes.