[P4Testgen] Add a test case generation API to P4Testgen. #4374
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the functionality to directly call into P4Testgen to generate tests, instead of writing the tests out to a file. This is useful for calling into P4Testgen directly in case you do not have memory constraints or consider the generated tests temporary objects. There is much more to be done to make this pleasant to use but this PR adds basic support. The newly added test
api_test.cpp
shows how this API could be used.The changes mostly involve refactoring to the test framework infrastructure. Currently, this functionality is only supported for Protobuf tests in BMv2, but can be extended to others.
This PR depends on #4372, #4369, and #4303.