@@ -176,7 +176,10 @@ pre_initialize_variables () {
176176 : ${ARMC6_BIN_DIR:=/ usr/ bin}
177177 : ${ARM_NONE_EABI_GCC_PREFIX:= arm-none-eabi-}
178178 : ${ARM_LINUX_GNUEABI_GCC_PREFIX:= arm-linux-gnueabi-}
179-
179+ : ${CLANG_LATEST:= " clang-latest" }
180+ : ${CLANG_EARLIEST:= " clang-earliest" }
181+ : ${GCC_LATEST:= " gcc-latest" }
182+ : ${GCC_EARLIEST:= " gcc-earliest" }
180183 # if MAKEFLAGS is not set add the -j option to speed up invocations of make
181184 if [ -z " ${MAKEFLAGS+set} " ]; then
182185 export MAKEFLAGS=" -j$( all_sh_nproc) "
@@ -191,9 +194,7 @@ pre_initialize_variables () {
191194
192195 # Gather the list of available components. These are the functions
193196 # defined in this script whose name starts with "component_".
194- # Parse the script with sed. This way we get the functions in the order
195- # they are defined.
196- ALL_COMPONENTS=$( sed -n ' s/^ *component_\([0-9A-Z_a-z]*\) *().*/\1/p' < " $0 " )
197+ ALL_COMPONENTS=$( compgen -A function component_ | sed ' s/component_//' )
197198
198199 # Exclude components that are not supported on this platform.
199200 SUPPORTED_COMPONENTS=
@@ -275,6 +276,10 @@ General options:
275276Tool path options:
276277 --armc5-bin-dir=<ARMC5_bin_dir_path> ARM Compiler 5 bin directory.
277278 --armc6-bin-dir=<ARMC6_bin_dir_path> ARM Compiler 6 bin directory.
279+ --clang-earliest=<Clang_earliest_path> Earliest version of clang available
280+ --clang-latest=<Clang_latest_path> Latest version of clang available
281+ --gcc-earliest=<GCC_earliest_path> Earliest version of GCC available
282+ --gcc-latest=<GCC_latest_path> Latest version of GCC available
278283 --gnutls-cli=<GnuTLS_cli_path> GnuTLS client executable to use for most tests.
279284 --gnutls-serv=<GnuTLS_serv_path> GnuTLS server executable to use for most tests.
280285 --gnutls-legacy-cli=<GnuTLS_cli_path> GnuTLS client executable to use for legacy tests.
@@ -441,9 +446,13 @@ pre_parse_command_line () {
441446 --armcc) no_armcc=;;
442447 --armc5-bin-dir) shift ; ;; # assignment to ARMC5_BIN_DIR done in pre_parse_command_line_for_dirs
443448 --armc6-bin-dir) shift ; ;; # assignment to ARMC6_BIN_DIR done in pre_parse_command_line_for_dirs
449+ --clang-earliest) shift ; CLANG_EARLIEST=" $1 " ;;
450+ --clang-latest) shift ; CLANG_LATEST=" $1 " ;;
444451 --error-test) error_test=$(( error_test + 1 )) ;;
445452 --except) all_except=1;;
446453 --force|-f) FORCE=1;;
454+ --gcc-earliest) shift ; GCC_EARLIEST=" $1 " ;;
455+ --gcc-latest) shift ; GCC_LATEST=" $1 " ;;
447456 --gnutls-cli) shift ; GNUTLS_CLI=" $1 " ;;
448457 --gnutls-legacy-cli) shift ; GNUTLS_LEGACY_CLI=" $1 " ;;
449458 --gnutls-legacy-serv) shift ; GNUTLS_LEGACY_SERV=" $1 " ;;
@@ -4023,6 +4032,7 @@ component_test_cmake_shared () {
40234032
40244033test_build_opt () {
40254034 info=$1 cc=$2 ; shift 2
4035+ $cc --version
40264036 for opt in " $@ " ; do
40274037 msg " build/test: $cc $opt , $info " # ~ 30s
40284038 make CC=" $cc " CFLAGS=" $opt -std=c99 -pedantic -Wall -Wextra -Werror"
@@ -4035,14 +4045,45 @@ test_build_opt () {
40354045 done
40364046}
40374047
4038- component_test_clang_opt () {
4048+ # For FreeBSD we invoke the function by name so this condition is added
4049+ # to disable the existing test_clang_opt function for linux.
4050+ if [[ $( uname) != " Linux" ]]; then
4051+ component_test_clang_opt () {
4052+ scripts/config.py full
4053+ test_build_opt ' full config' clang -O0 -Os -O2
4054+ }
4055+ fi
4056+
4057+ component_test_clang_latest_opt () {
4058+ scripts/config.py full
4059+ test_build_opt ' full config' " $CLANG_LATEST " -O0 -Os -O2
4060+ }
4061+ support_test_clang_latest_opt () {
4062+ type " $CLANG_LATEST " > /dev/null 2> /dev/null
4063+ }
4064+
4065+ component_test_clang_earliest_opt () {
40394066 scripts/config.py full
4040- test_build_opt ' full config' clang -O0 -Os -O2
4067+ test_build_opt ' full config' " $CLANG_EARLIEST " -O0
4068+ }
4069+ support_test_clang_earliest_opt () {
4070+ type " $CLANG_EARLIEST " > /dev/null 2> /dev/null
40414071}
40424072
4043- component_test_gcc_opt () {
4073+ component_test_gcc_latest_opt () {
40444074 scripts/config.py full
4045- test_build_opt ' full config' gcc -O0 -Os -O2
4075+ test_build_opt ' full config' " $GCC_LATEST " -O0 -Os -O2
4076+ }
4077+ support_test_gcc_latest_opt () {
4078+ type " $GCC_LATEST " > /dev/null 2> /dev/null
4079+ }
4080+
4081+ component_test_gcc_earliest_opt () {
4082+ scripts/config.py full
4083+ test_build_opt ' full config' " $GCC_EARLIEST " -O0
4084+ }
4085+ support_test_gcc_earliest_opt () {
4086+ type " $GCC_EARLIEST " > /dev/null 2> /dev/null
40464087}
40474088
40484089component_build_mbedtls_config_file () {
0 commit comments