Fix generate_config_checks.py not satisfying make_generated_files --check --root #212
No reviewers
Labels
No labels
approved
bug
dependencies
DO-NOT-MERGE
enhancement
good-first-issue
help-wanted
historical-reviewed
historical-reviewing
needs-adoption
needs-ci
needs-design-approval
needs-info
needs-preceding-pr
needs-review
needs-reviewer
needs-work
priority-high
priority-low
priority-medium
priority-scheduled
priority-very-high
single-reviewer
size-l
size-m
size-s
size-xs
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-Mbed-TLS/mbedtls-framework!212
Loading…
Reference in a new issue
No description provided.
Delete branch "config-checks-generator-framework-fix-check-generated_files"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When the current directory is the project root, have
--listprint relative paths, rather than absolute paths that start withbuild_treeguess_project_root().This is not only nice to humans, but also necessary for
make_generated_files.py --root DIR --check: it calls this script with--listand expects a path that is relative to DIR, not an absolute path that is under the project root.Fix the build in https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/404, hopefully for real this time.
PR checklist
Please add the numbers (or links) of the associated pull requests for consuming branches. You can omit branches where this pull request is not needed.
This fixes
all.sh tf_psa_crypto_check_generated_files. But it's not enough to fixall.sh check_generated_files(the mbedtls component) in https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/404.There,
scripts/make_generated_files.py --checkbelieves that the new crypto generated files exist, sincescripts/generate_config_checks.pyexists in crypto. Butmakein mbedtls doesn't yet know how to build them.Is this a hack? Yes. But also, it's solving a genuine design problem. Right now, we'll only need it temporarily between the merge of https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/404 and the merge of https://github.com/Mbed-TLS/mbedtls/pull/10340. But conceptually, we'll need it again any time we create a new generation script in TF-PSA-Crypto. That doesn't happen often, but it may well happen before we solve the design problem with generated files.
I'll file an issue about the core problem once I've had a bit of time to think about what the requirements are and whether there are incremental solutions that could help.
FWIW, I wouldn't call that a dirty hack. It's an ad hoc solution to a real problem. Is there a better solution? Perhaps. But I don't find the current state particularly dirty.
I've filed https://github.com/Mbed-TLS/mbedtls-framework/issues/215
This may still not be the final form because
tests/scripts/all.sh -k tf_psa_crypto_check_generated_filesis passing on my machine but failing on https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/404. I'm trying to figure out why. In mbedtls that can be due to insufficient cleanup but in crypto the check is done only in a fresh out-of-source build tree.No, this is the mbedtls check that's failing. And yes, it is due to insufficient cleanup, I have reproduced it. https://github.com/Mbed-TLS/mbedtls-framework/pull/212/commits/e2c15fbd66ffe5063595d6f2a3ffdbe10124c3a8 isn't doing its intended job.
looks good, two minor comments.
I also agree with @mpg that seems like a valid optional input (pun intended) to address a transitoriy edge-case.
Any reason we don't use the same logic as bellow?
if generation_script.optional and not bak_file.exists():Similarly, why are are not throwing an exception as above?
raise Exception(f"Expected generated file does not exist: {file}")Here there's also “if file does not exist then raise exception”, independently of the optional business. A file that doesn't exist here is an expected error (i.e. morally you expect the function/script to return false, not to crash) which should have a nice error message (the exception is a compromise: it was easier to patch in that
print+ keep track of the fact that an error occurred). Below, it's not expected that the backup file created earlier would no longer exist, so we just let the file function raise an error that's harder to interpret.LGTM
LGTM, thanks!
I've done an incremental review on top of Manuel's and also had a cursory look at the rest of the commits.