Repository navigation
Fix bitstream metadata parser path handling - #1670
Open
graemef681 wants to merge 1 commit into
Open
graemef681 wants to merge 1 commit into
graemef681 wants to merge 1 commit into
Conversation
This branch has not been deployed
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
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.
Summary
This PR fixes bitstream format detection when
.bitand.xsafiles with the same stem exist in the same directory.It also converts
Pathobjects to strings when passing.hwhand.xsapaths to theMetadataAPI.Problem
BitstreamHandler.is_xsa()currently replaces the requested file's suffix with.xsaand checks whether that neighbouring file exists.In simplified form, the existing check is:
This asks:
For example, requesting:
causes the code to check whether this file exists:
If both files exist, the requested
design.bitis incorrectly classified as an XSA.The intended check is:
This checks whether the exact path requested by the caller refers to an
.xsaor.bitfile. A neighbouring same-stem file can no longer change the classification of the requested file.Incorrect classification can select the XSA metadata path even though the caller explicitly requested the bitstream.
Change
is_xsa()now checks the suffix of the requested path itself:design.bitis classified as a bitstream.design.xsais classified as an XSA.RemoteBitstreamHandlerinheritsis_xsa()fromBitstreamHandler. The same bug therefore affects remote bitstream handling without a separate implementation inremote_device.py. Correcting the base method fixes format classification for both embedded and remote handlers.The accompanying changes in
remote_device.pysupport the corrected parser flow. Once the requested file has been classified, its.hwhor.xsapath is converted fromPathtostrbefore being passed to theMetadataAPI. This keeps the remote parser path consistent with the embedded implementation and with the input type expected byMetadata.A regression test covers the case where same-stem
.bitand.xsafiles both exist.Testing
This test does not require an FPGA or PYNQ board.
The PR contains one commit on top of the current
pynq-nextrevision. This allows the committed regression test to be run against both the previous and corrected implementations.Create an environment from a checkout of the PR branch:
pytest-covis required because the repository'spytest.iniautomatically enables coverage with--cov=pynq.Current
pynq-nextbehaviourTemporarily restore the pre-PR implementations while retaining the regression test:
Run the regression test:
Expected result: the test fails at:
The current implementation returns
Truebecause a same-stemtestbitstream.xsaexists beside the requested.bitfile.This PR
Restore the PR implementations:
Run the same test:
Expected result:
The test passes because each requested file is classified using its own suffix.
Confirm that the checkout has been fully restored:
This command should produce no output.
Signed-off-by: Graeme Fitzpatrick graemef681@gmail.com