Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[P4Testgen] Add EliminateInvalidHeaders midend pass #4239

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

vlstill
Copy link
Contributor

@vlstill vlstill commented Nov 10, 2023

Previously, testgen would fail will errors like this (when #4238 is applied to make the error readable):

Internal error: In file: ./p4c/frontends/p4/typeChecking/typeChecker.cpp:172
Compiler Bug: build/init.p4(78): At this point in the compilation typechecking should not infer new types anymore, but it did: node (hdr_0_t){#}.isValid(); changed to 0;
        hdr.hdr_0 = (hdr_0_t){#};
                  ^
build/init.p4(78)
        hdr.hdr_0 = (hdr_0_t){#};
                  ^

@vlstill vlstill added the p4tools Topics related to the P4Tools back end label Nov 10, 2023
@vlstill vlstill requested a review from fruffy November 10, 2023 13:11
@vlstill vlstill self-assigned this Nov 10, 2023
@fruffy
Copy link
Collaborator

fruffy commented Nov 10, 2023

Could you add a test for this failure? Or fix existing tests to work with bmv2 etc

@vlstill
Copy link
Contributor Author

vlstill commented Nov 10, 2023

Could you add a test for this failure? Or fix existing tests to work with bmv2 etc

@fruffy, can you give me pointers where the p4c testgen tests live? I've never interacted with them before except for running them with ctest.

@fruffy
Copy link
Collaborator

fruffy commented Nov 13, 2023

Could you add a test for this failure? Or fix existing tests to work with bmv2 etc

@fruffy, can you give me pointers where the p4c testgen tests live? I've never interacted with them before except for running them with ctest.

P4Testgen will pick up all the programs in the testdata folder which include v1model.p4. So, if https://github.com/p4lang/p4c/blob/main/testdata/p4_16_samples/invalid-header.p4 is transformed into a v1model program, the test should automatically be included.

Alternatively, custom tests for BMv2 are placed in this folder:

https://github.com/p4lang/p4c/tree/main/backends/p4tools/modules/testgen/targets/bmv2/test/p4-programs

@fruffy fruffy changed the title testgen: Add EliminateInvalidHeaders midend pass [P4Testgen] Add EliminateInvalidHeaders midend pass Nov 13, 2023
@vlstill vlstill merged commit dd43a45 into p4lang:main Nov 13, 2023
13 checks passed
@vlstill vlstill deleted the testgen-invalid-hdr-lit branch November 13, 2023 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p4tools Topics related to the P4Tools back end
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants