-
Notifications
You must be signed in to change notification settings - Fork 2.8k
All.sh add support for tf-psa-crypto components #9720
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
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8da0e9e
all.sh: rationalize relative path usage
mpg 3d41154
all.sh: improve check for clean config files
mpg 8bcad48
Add tf-psa-crypto's own all.sh
mpg a93f988
all.sh: wrapper for both mbedtls and tf-psa-crypto
mpg a4f0227
all.sh: prevent a silly mistake
mpg 6ffebef
New all.sh wrapper with reduced scope (CI only)
mpg d10f42f
Fix making the path of the outcomes file absolute.
mpg dea700d
all.sh: improve wrapper error reporting
mpg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,96 @@ | ||
#! /usr/bin/env bash | ||
|
||
# all.sh | ||
# all.sh (transitional wrapper) | ||
# | ||
# Copyright The Mbed TLS Contributors | ||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later | ||
|
||
# This file is executable; it is the entry point for users and the CI. | ||
# See "Files structure" in all-core.sh for other files used. | ||
# During the transition of CI associated with the repo split, | ||
# we want all.sh from the mbedtls repo to transparently run both | ||
# mbedtls and tf-psa-crypto components. | ||
# This is what this wrapper is about. | ||
# Once the transition is over, this wrapper can be removed, | ||
# and mbedtls-all.sh renamed again to all.sh. | ||
# | ||
# This wrapper is mostly for the CI's benefit. Developers probably want to | ||
# directly invoke one or two of the following commands: | ||
# - tests/scripts/mbedtls-all.sh ... | ||
# - (cd tf-psa-crypto && tests/scripts/all.sh ...) | ||
|
||
# This script must be invoked from the project's root. | ||
|
||
# The path is going to change when this is moved to the framework | ||
source tests/scripts/all-core.sh | ||
set -eu | ||
|
||
# Get the list of components available on each side. | ||
COMP_MBEDTLS=$(tests/scripts/mbedtls-all.sh --list-all-components | sort) | ||
COMP_CRYPTO=$(cd tf-psa-crypto && tests/scripts/all.sh --list-all-components | sort) | ||
|
||
# Error out if any component is available on both sides | ||
ronald-cron-arm marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
COMMON=$(comm -12 <(echo "$COMP_MBEDTLS") <(echo "$COMP_CRYPTO") | tr '\n' ' ') | ||
if [ -n "$COMMON" ]; then | ||
echo "The following components are duplicated: $COMMON" >&2 | ||
exit 2 | ||
fi | ||
|
||
# all.sh complains when a component is requested explicitly but is not | ||
# available. However, here we actually run two instances of all.sh, so when | ||
# requesting one component epxlicitly, at least one instance is not going to | ||
ronald-cron-arm marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
# know about it. So, when invoking each side, remove the other side's | ||
# components from its command line. This is safe because we know from above | ||
# that no component is on both sides. | ||
|
||
# mbedtls args are global args without the crypto components | ||
ronald-cron-arm marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
COMP_CRYPTO=$(echo $COMP_CRYPTO | tr '\n' ' ') | ||
for arg in "$@"; do | ||
case " $COMP_CRYPTO " in | ||
*" $arg "*) ;; | ||
*) mbedtls_args+=( $arg ) ;; | ||
esac | ||
done | ||
|
||
# crypto args are global args without the mbedtls components | ||
COMP_MBEDTLS=$(echo $COMP_MBEDTLS | tr '\n' ' ') | ||
for arg in "$@"; do | ||
case " $COMP_MBEDTLS " in | ||
*" $arg "*) ;; | ||
*) crypto_args+=( $arg ) ;; | ||
esac | ||
done | ||
|
||
# Note: don't print debug info on what commands are being run, because we | ||
# don't want to pollute the output especially when --list-components is used. | ||
|
||
# call mbedtls's all.sh | ||
set +e | ||
tests/scripts/mbedtls-all.sh "${mbedtls_args[@]}" | ||
mbedtls_exit=$? | ||
set -e | ||
if [ $mbedtls_exit -ne 0 ]; then | ||
echo "mbedtls-all.sh exited $mbedtls_exit" >&2 | ||
fi | ||
|
||
# if it returned non-zero, should we keep going? | ||
if [ $mbedtls_exit -ne 0 ]; then | ||
case " $@ " in | ||
*" --keep-going "*) ;; # fall through and run tf-psa-crypto's all.sh | ||
*) exit $mbedtls_exit;; | ||
esac | ||
fi | ||
|
||
# call tf-psa-crypto's all.sh | ||
set +e | ||
(cd tf-psa-crypto && tests/scripts/all.sh "${crypto_args[@]}") | ||
crypto_exit=$? | ||
set -e | ||
if [ $crypto_exit -ne 0 ]; then | ||
echo "tf-psa-crypto's all.sh exited $crypto_exit" >&2 | ||
fi | ||
|
||
main "$@" | ||
# return an appropriate exit code | ||
if [ $mbedtls_exit -ne 0 ]; then | ||
echo "mbedtls-all.sh exited $mbedtls_exit" >&2 | ||
echo "Please scroll up for a summary of errors in mbedtls-all.sh" >&2 | ||
exit $mbedtls_exit | ||
else | ||
exit $crypto_exit | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#! /usr/bin/env bash | ||
|
||
# all.sh (mbedtls part) | ||
# | ||
# Copyright The Mbed TLS Contributors | ||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later | ||
|
||
# This file is executable; it is the entry point for users and the CI. | ||
# See "Files structure" in all-core.sh for other files used. | ||
|
||
# This script must be invoked from the project's root. | ||
|
||
# The path is going to change when this is moved to the framework | ||
source tests/scripts/all-core.sh | ||
|
||
main "$@" |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this conflicts with #9293, which I hope we can merge soon since all it's missing is one approval on one backport.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also conflicts with #9286, but that's not quite ready yet, so I suggest that we go 9293, then 9720, then 9286.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm not seeing the conflict with 9293 - it seems to me that the two PRs are not touching the same files. What am I missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, there's no merge conflict with 9293 and I don't think there's a semantic conflict either. There's a potential semantic conflict with #9286 since it will error out if a component name is duplicated between mbedtls and tf-psa-crypto.
I ran a merge of something that conflicted but that must have been some different branches or with a non-up-to-date local copy and I can't find exactly what I ran yesterday anymore. I have a conflict checker script and it reports no conflict between the current state of this PR and any other PR opened in the last 6 months. #9293 only conflicts in
.gitignore
with a priority-medium PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, currently my PR also forbids component names that are duplicated between mbedtls and tf-psa-crypto, so that shouldn't be a problem. As I said earlier, I don't think we should allow components with the same name on both sides until the sides are completely separated.