Make all.sh PSA-crypto-friendly
Introduce changes needed to run all.sh in the psa-crypto repo. Where behaviour must differ, detect that we are in the psa-crypto repo by checking for the 'core' directory. Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
parent
41d689f389
commit
9a6c45b436
1 changed files with 22 additions and 8 deletions
|
@ -123,15 +123,23 @@ set -e -o pipefail -u
|
||||||
# Enable ksh/bash extended file matching patterns
|
# Enable ksh/bash extended file matching patterns
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
|
in_psa_crypto_repo () {
|
||||||
|
test -d core
|
||||||
|
}
|
||||||
|
|
||||||
pre_check_environment () {
|
pre_check_environment () {
|
||||||
if [ -d library -a -d include -a -d tests ]; then :; else
|
if [ \( -d library -o -d core \) -a -d include -a -d tests ]; then :; else
|
||||||
echo "Must be run from mbed TLS root" >&2
|
echo "Must be run from Mbed TLS root" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
pre_initialize_variables () {
|
pre_initialize_variables () {
|
||||||
CONFIG_H='include/mbedtls/mbedtls_config.h'
|
if in_psa_crypto_repo; then
|
||||||
|
CONFIG_H='drivers/builtin/include/mbedtls/mbedtls_config.h'
|
||||||
|
else
|
||||||
|
CONFIG_H='include/mbedtls/mbedtls_config.h'
|
||||||
|
fi
|
||||||
CRYPTO_CONFIG_H='include/psa/crypto_config.h'
|
CRYPTO_CONFIG_H='include/psa/crypto_config.h'
|
||||||
CONFIG_TEST_DRIVER_H='tests/include/test/drivers/config_test_driver.h'
|
CONFIG_TEST_DRIVER_H='tests/include/test/drivers/config_test_driver.h'
|
||||||
|
|
||||||
|
@ -141,8 +149,10 @@ pre_initialize_variables () {
|
||||||
backup_suffix='.all.bak'
|
backup_suffix='.all.bak'
|
||||||
# Files clobbered by config.py
|
# Files clobbered by config.py
|
||||||
files_to_back_up="$CONFIG_H $CRYPTO_CONFIG_H $CONFIG_TEST_DRIVER_H"
|
files_to_back_up="$CONFIG_H $CRYPTO_CONFIG_H $CONFIG_TEST_DRIVER_H"
|
||||||
# Files clobbered by in-tree cmake
|
if ! in_psa_crypto_repo; then
|
||||||
files_to_back_up="$files_to_back_up Makefile library/Makefile programs/Makefile tests/Makefile programs/fuzz/Makefile"
|
# Files clobbered by in-tree cmake
|
||||||
|
files_to_back_up="$files_to_back_up Makefile library/Makefile programs/Makefile tests/Makefile programs/fuzz/Makefile"
|
||||||
|
fi
|
||||||
|
|
||||||
append_outcome=0
|
append_outcome=0
|
||||||
MEMORY=0
|
MEMORY=0
|
||||||
|
@ -299,7 +309,9 @@ EOF
|
||||||
# Does not remove generated source files.
|
# Does not remove generated source files.
|
||||||
cleanup()
|
cleanup()
|
||||||
{
|
{
|
||||||
command make clean
|
if ! in_psa_crypto_repo; then
|
||||||
|
command make clean
|
||||||
|
fi
|
||||||
|
|
||||||
# Remove CMake artefacts
|
# Remove CMake artefacts
|
||||||
find . -name .git -prune -o \
|
find . -name .git -prune -o \
|
||||||
|
@ -556,7 +568,7 @@ pre_check_git () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! git diff --quiet "$CONFIG_H"; then
|
if ! git diff --quiet "$CONFIG_H"; then
|
||||||
err_msg "Warning - the configuration file 'include/mbedtls/mbedtls_config.h' has been edited. "
|
err_msg "Warning - the configuration file '$CONFIG_H' has been edited. "
|
||||||
echo "You can either delete or preserve your work, or force the test by rerunning the"
|
echo "You can either delete or preserve your work, or force the test by rerunning the"
|
||||||
echo "script as: $0 --force"
|
echo "script as: $0 --force"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -5264,7 +5276,9 @@ pre_prepare_outcome_file
|
||||||
pre_print_configuration
|
pre_print_configuration
|
||||||
pre_check_tools
|
pre_check_tools
|
||||||
cleanup
|
cleanup
|
||||||
pre_generate_files
|
if ! in_psa_crypto_repo; then
|
||||||
|
pre_generate_files
|
||||||
|
fi
|
||||||
|
|
||||||
# Run the requested tests.
|
# Run the requested tests.
|
||||||
for ((error_test_i=1; error_test_i <= error_test; error_test_i++)); do
|
for ((error_test_i=1; error_test_i <= error_test; error_test_i++)); do
|
||||||
|
|
Loading…
Reference in a new issue