From 730addc203111e066873ca671d4aeeb45e3eb4e3 Mon Sep 17 00:00:00 2001 From: Tom Cosgrove Date: Fri, 9 Jun 2023 14:20:18 +0100 Subject: [PATCH] Fix armc5-bin-dir and armc6-bin-dir options to all.sh ARMC5_BIN_DIR and ARMC6_BIN_DIR were set in pre_parse_command_line() and used by support_build_armcc() which is called by pre_initialize_variables() to determines SUPPORTED_COMPONENTS. As pre_initialize_variables() is called before pre_parse_command_line(), support_build_armcc() failed to use the directories set on the command line. However, we can't call pre_parse_command_line() before pre_initialize_variables() since the former needs SUPPORTED_COMPONENTS! Fix the circular dependency by parsing the command line twice, with the first pass only to get these directories. Signed-off-by: Tom Cosgrove --- tests/scripts/all.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index b1f8f0fcf..7772da9ac 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -411,6 +411,18 @@ check_tools() done } +pre_parse_command_line_for_dirs () { + # Make an early pass through the options given, so we can set directories + # for Arm compilers, before SUPPORTED_COMPONENTS is determined. + while [ $# -gt 0 ]; do + case "$1" in + --armc5-bin-dir) shift; ARMC5_BIN_DIR="$1";; + --armc6-bin-dir) shift; ARMC6_BIN_DIR="$1";; + esac + shift + done +} + pre_parse_command_line () { COMMAND_LINE_COMPONENTS= all_except=0 @@ -427,8 +439,8 @@ pre_parse_command_line () { --arm-none-eabi-gcc-prefix) shift; ARM_NONE_EABI_GCC_PREFIX="$1";; --arm-linux-gnueabi-gcc-prefix) shift; ARM_LINUX_GNUEABI_GCC_PREFIX="$1";; --armcc) no_armcc=;; - --armc5-bin-dir) shift; ARMC5_BIN_DIR="$1";; - --armc6-bin-dir) shift; ARMC6_BIN_DIR="$1";; + --armc5-bin-dir) shift; ;; # assignment to ARMC5_BIN_DIR done in pre_parse_command_line_for_dirs + --armc6-bin-dir) shift; ;; # assignment to ARMC6_BIN_DIR done in pre_parse_command_line_for_dirs --error-test) error_test=$((error_test + 1));; --except) all_except=1;; --force|-f) FORCE=1;; @@ -4447,6 +4459,7 @@ run_component () { # Preliminary setup pre_check_environment +pre_parse_command_line_for_dirs "$@" pre_initialize_variables pre_parse_command_line "$@"