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] Fix include paths #3997

Merged
merged 3 commits into from
May 4, 2023
Merged

[P4Testgen] Fix include paths #3997

merged 3 commits into from
May 4, 2023

Conversation

fruffy
Copy link
Collaborator

@fruffy fruffy commented Apr 28, 2023

Fixes #3996.

Copy link
Contributor

@jnfoster jnfoster left a comment

Choose a reason for hiding this comment

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

A bit of a bandaid, but OK for now.

@fruffy fruffy added the p4tools Topics related to the P4Tools back end label Apr 28, 2023
@fruffy
Copy link
Collaborator Author

fruffy commented Apr 28, 2023

@vlstill Does this fix your problem?

Comment on lines 118 to 119
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_BINARY_DIR}/p4testgen ${CMAKE_BINARY_DIR}/p4testgen
COMMAND ${CMAKE_COMMAND} -E create_symlink ${P4C_BINARY_DIR_PATH_REL}/p4include ${CMAKE_CURRENT_BINARY_DIR}/p4include
Copy link
Contributor

Choose a reason for hiding this comment

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

Interestingly, this does not work for me (maybe because I have p4c embedded in other project, although it worked the recent testgen changes...). The creates symlink leads to /p4include, suggesting that ${P4C_BINARY_DIR_PATH_REL} is not set. As far as I can see, the variable is set in ebfp, bmv2 and p4test backends, but not in p4tools. It would probably need to be set in this file to work correctly.

@@ -114,7 +114,9 @@ target_link_libraries(
add_custom_target(
linkp4testgen
# Add some convenience links for invoking p4testgen.
# TODO: How to best handle includes?
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_BINARY_DIR}/p4testgen ${CMAKE_BINARY_DIR}/p4testgen
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not related to the original issue, but I've just noticed you are linking p4testgen to top-level project, even in p4c is embedded into a downstream project using it.

I would suggest symlinking p4testgen into ${P4C_BINARY_DIR} instead is a better choice (even though it can break some downstream workflow). This will leave the downstream projects to do the symlinking on their level if they so choose.

This is just a thought for future cleanup.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Iirc in the old setup of bf-p4c it was more convenient to have the binary in the top-level. This is not needed anymore, we can change it.

@fruffy fruffy force-pushed the fruffy/include_path branch from e881a38 to 4612d3d Compare May 2, 2023 12:20
@fruffy fruffy changed the title Fix include paths for testgen [P4Testgen] Fix include paths May 2, 2023
@fruffy fruffy merged commit e4fb84d into main May 4, 2023
@fruffy fruffy deleted the fruffy/include_path branch May 9, 2023 13:56
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.

Testgen does not find "buildin" include path (<core.p4>, etc.)
3 participants