-
Notifications
You must be signed in to change notification settings - Fork 57
Improve cocotb_test rule #171
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Full path consist of an optional first part called `root`, and the second part which is the `short_path`. Usually for non-generated files `path` is equal to `short_path`, but this is not the case for the generated files. Documentation states that the `short_path` should be used if the file is used in the runfiles to handle both generated and standard files correctly. Internal-tag: [#46586] Signed-off-by: Robert Winkler <[email protected]>
This change allows the user to specify his installation of cocotb and prevents circular includes when the rule is imported in other repositories. However, with this change user has to explicitely add cocotb to the list of dependencies in the cocotb_test rule. Internal-tag: [#46586] Signed-off-by: Robert Winkler <[email protected]>
785e52a
to
b74f614
Compare
Make cocotb_wrapper attribute public to allow for modyfying the script for other cocotb versions or different build setups. Internal-tag: [#46586] Signed-off-by: Robert Winkler <[email protected]>
Previously, the waves attribute was the only one that was not passed to the cocotb script that ran the simulation. Internal-tag: [#46586] Signed-off-by: Robert Winkler <[email protected]>
The previous rule implementation did not check whether the test passed or failed in the cocotb runner. The additional check introduced in this commit allows the script to inform Bazel about the actual test results. Internal-tag: [#46586] Signed-off-by: Robert Winkler <[email protected]>
fe8d3c2
to
c9d3592
Compare
Is this ready to go for merging? |
The changes made in this commit include improvements that allow the `py_library` targets to be properly passed to the `cocotb_test` rule via the `deps` attribute. Now all transitive imports are properly added to `PYTHONPATH`. The `test_module` attribute, on the other hand, is intended to contain only python source files. Internal-tag: [#46586] Signed-off-by: Robert Winkler <[email protected]>
c9d3592
to
83b51f4
Compare
@QuantamHD Yes, it's ready for review and merging |
/gcbrun |
QuantamHD
approved these changes
Jul 21, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 following improvements to the existing
cocotb_test
rule:short_path
of files instead ofpath
to correctly handle the generated filescocotb_wrapper.py
dependency on thecocotb
to prevent circular imports and double dependencies when the rule is imported into other repositories. I encountered that problem when I tried to use thecocotb_bus
library in the PR to XLS repository. Thecocotb_bus
library itself relies oncocotb
, as a result, I obtained one copy of cocotb from thebazel_hdl_rules
repo and the second from thexls
repository.PYTHONPATH
to correctly handle imports from other librariescocotb_wrapper
attribute public to allow for specifying different entry for other cocotb versions or different build setups