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

Pass FrontEndPolicy to unit tests #4433

Merged
merged 3 commits into from
Feb 16, 2024
Merged

Conversation

vlstill
Copy link
Contributor

@vlstill vlstill commented Feb 16, 2024

Breaking change (dev/test): Side-effects ordering is enabled in frontend tests (by #4406).

I've accidentally enabled side-effects ordering in all frontend tests throughout the code base in #4406 😢. I am sorry about this.

Arguably this could be a good thing (that is the indented use of the frotnend), but it could be surprising to downstream projects. Also, as the policy itself was not exposed, it was not possible to change this behaviour in downstream tests. This PR mitigates the second problem, it exposes frontend policy in tests so that tools can set it in any way they desire. The side-effects ordering is still enabled by default, which I think is a more reasonable default (it is the default used in frontend after all).

I don't see a way of ensuring downstream action on this without needlessly breaking interface of the tests that don't depend on either side effects ordering or annotation parsing. Therefore I just intend to ping people who I guess could be working on downstream projects here.

@vlstill vlstill added run-ubuntu18 Use this tag to trigger a Ubuntu-18 CI run. run-validation Use this tag to trigger a Validation CI run. run-sanitizer Use this tag to run a Clang+Sanitzers CI run. labels Feb 16, 2024
@vlstill vlstill force-pushed the fix-unittest-interface branch from 4163985 to faa5e59 Compare February 16, 2024 11:22
@vlstill vlstill self-assigned this Feb 16, 2024
@vlstill vlstill marked this pull request as ready for review February 16, 2024 13:27
@@ -72,12 +72,22 @@ class ParseAnnotations : public P4::ParseAnnotations {
: P4::ParseAnnotations("FrontendTest", true, {PARSE("my_anno", StringLiteral)}) {}
};

struct AnnoFEP : P4::FrontEndPolicy {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
struct AnnoFEP : P4::FrontEndPolicy {
struct AnnotationParsingPolicy : P4::FrontEndPolicy {

@fruffy
Copy link
Collaborator

fruffy commented Feb 16, 2024

I didn't see any breakage fwiw but this may affect the Tofino tests.

@vlstill
Copy link
Contributor Author

vlstill commented Feb 16, 2024

I didn't see any breakage fwiw but this may affect the Tofino tests.

It was also really easy with the old setting to accidentally test with side effects ordering disabled which I think is a mistake as presumably most of the backends will want it enabled.

Copy link
Contributor

@grg grg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vlstill vlstill merged commit a584e75 into p4lang:main Feb 16, 2024
16 checks passed
@vlstill vlstill deleted the fix-unittest-interface branch February 16, 2024 15:30
grg pushed a commit that referenced this pull request Apr 3, 2024
* Pass FrontEndPolicy to unit tests
* Move now misplaced TODO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run-sanitizer Use this tag to run a Clang+Sanitzers CI run. run-ubuntu18 Use this tag to trigger a Ubuntu-18 CI run. run-validation Use this tag to trigger a Validation CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants