Run sample program demo scripts in all.sh#7982
Merged
gilles-peskine-arm merged 18 commits intoMbed-TLS:developmentfrom Oct 18, 2023
Merged
Run sample program demo scripts in all.sh#7982gilles-peskine-arm merged 18 commits intoMbed-TLS:developmentfrom
gilles-peskine-arm merged 18 commits intoMbed-TLS:developmentfrom
Conversation
run_demos.py is the frontend to a framework for smoke-testing the
sample programs. It runs scripts called programs/*/*_demo.sh
("demo scripts") and check that they succeed. A typical demo script
runs one sample program or a combination of sample programs to
demonstrate their usage.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
The new file programs/demo_common.sh contains initialization code, utility functions and cleanup code meant to be used by all demo scripts written in sh. Initial features: * msg: Display a message. * run, run_bad: Run a command, visibly. * $root_dir, $programs_dir: location of the mbedtls source tree. * $files_to_clean: files that are cleaned up on exit. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Demo scripts should declare their build-time dependencies, to make them more user-friendly. If a dependency is not met, users should see an explicit message rather than an incomprehensible error. Don't rely on the dependencies of individual programs because some demo scripts use multiple programs and because some scripts might have additional requirements. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Run the sample program demo scripts in builds with a configuration that is at least as complete as the default configuration. Do not run sample programs in all configurations since they are expected to fail if a required feature is missing. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Since there's no EXIT trap in plain sh, the main script must call it explicitly when it exits. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
ShebangIssueTracker implements the rule that scripts must be executable if and only if they have a shebang line. By removing PermissionIssueTracker, we now allow files with any extension to be executable (provided they have a shebang line), and allow *.sh and *.pl to be non-executable modules if they don't have a shebang line (as was already the case for *.py). Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
3 tasks
3 tasks
tom-daubney-arm
approved these changes
Aug 3, 2023
Contributor
tom-daubney-arm
left a comment
There was a problem hiding this comment.
I have given this a thorough review to the best of my ability and think it LGTM.
I am not the most experienced with bash however and can't be 100% confident about everything but I have not been able to find any issues with this PR and so I am approving.
It would be really great if the second reviewer was adept at bash to make sure there aren't issues being missed here.
davidhorstmann-arm
approved these changes
Oct 17, 2023
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.
Run sample program demo scripts (
programs/test/*_demo.sh) in a few components ofall.sh.In the long term, we should run the programs in all configurations, but this requires declaring dependencies properly. For the time being, just run the programs in a few builds (out-of-box, full config, with sanitizers, without deprecated functions).
This is a rebase of a part of #2698, adapted for the evolution of the development branch and omitting the new demo script for certificate-related programs.
programs/demo_common.shfor common logic.run_demos.pyand run it from a few components inall.sh.check_files.pybecause that part of the file has evolved.dlopen_demo.shwhich didn't exist at the time of the original PR. (It's more of a test than a demo, but I prefer to keep things conceptually simple and treat it in the same way.)PR checklist
Please tick as appropriate and edit the reasons (e.g.: "backport: not needed because this is a new feature")