mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-07 15:40:27 +00:00
all.sh: first define functions, then call them.
Don't interleave defining functions with running some code. The only exception is calling shopt, which needs to come first as it affects how the following function definitions are parsed. Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
parent
e21e9c33c5
commit
f7325865bb
@ -108,12 +108,15 @@
|
|||||||
#### Initialization and command line parsing
|
#### Initialization and command line parsing
|
||||||
################################################################
|
################################################################
|
||||||
|
|
||||||
|
# Enable ksh/bash extended file matching patterns.
|
||||||
|
# Must come before function definitions or some of them wouldn't parse.
|
||||||
|
shopt -s extglob
|
||||||
|
|
||||||
|
pre_set_shell_options () {
|
||||||
# Abort on errors (even on the left-hand side of a pipe).
|
# Abort on errors (even on the left-hand side of a pipe).
|
||||||
# Treat uninitialised variables as errors.
|
# Treat uninitialised variables as errors.
|
||||||
set -e -o pipefail -u
|
set -e -o pipefail -u
|
||||||
|
}
|
||||||
# Enable ksh/bash extended file matching patterns
|
|
||||||
shopt -s extglob
|
|
||||||
|
|
||||||
# For project detection
|
# For project detection
|
||||||
in_mbedtls_repo () {
|
in_mbedtls_repo () {
|
||||||
@ -1099,11 +1102,14 @@ helper_get_psa_key_type_list() {
|
|||||||
echo "$loc_list"
|
echo "$loc_list"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Must be called before pre_initialize_variables which sets ALL_COMPONENTS.
|
||||||
|
pre_load_components () {
|
||||||
# Include the components from components.sh
|
# Include the components from components.sh
|
||||||
test_script_dir="${0%/*}"
|
test_script_dir="${0%/*}"
|
||||||
for file in "$test_script_dir"/components*.sh; do
|
for file in "$test_script_dir"/components*.sh; do
|
||||||
source $file
|
source $file
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
@ -1200,8 +1206,15 @@ run_component () {
|
|||||||
unset current_component
|
unset current_component
|
||||||
}
|
}
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
#### Main (only function definitions above)
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
|
||||||
# Preliminary setup
|
# Preliminary setup
|
||||||
|
pre_set_shell_options
|
||||||
pre_check_environment
|
pre_check_environment
|
||||||
|
pre_load_components
|
||||||
pre_initialize_variables
|
pre_initialize_variables
|
||||||
pre_parse_command_line "$@"
|
pre_parse_command_line "$@"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user