Skip to content

Commit c12fc7d

Browse files
committed
Update test scripts to use latest/earliest compilers
The Ubuntu 16.04 and 22.04 docker images have been updated with earliest and latest versions of gcc and clang respectively. This patch adds the necessary component and support functions required for the CI to run these compilers. For FreeBSD we invoke the function by name so a condition is added to disable the existing test_clang_opt function for linux. Signed-off-by: Gowtham Suresh Kumar <[email protected]>
1 parent 7fa27a1 commit c12fc7d

File tree

2 files changed

+55
-4
lines changed

2 files changed

+55
-4
lines changed

scripts/output_env.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,21 @@ echo
105105
print_version "gcc" "--version" "" "head -n 1"
106106
echo
107107

108+
print_version "gcc-earliest" "--version" "" "head -n 1"
109+
echo
110+
111+
print_version "gcc-latest" "--version" "" "head -n 1"
112+
echo
113+
108114
print_version "clang" "--version" "" "head -n 2"
109115
echo
110116

117+
print_version "clang-earliest" "--version" "" "head -n 2"
118+
echo
119+
120+
print_version "clang-latest" "--version" "" "head -n 2"
121+
echo
122+
111123
print_version "ldd" "--version" "" "head -n 1"
112124
echo
113125

tests/scripts/all.sh

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,13 @@ pre_initialize_variables () {
195195
# they are defined.
196196
ALL_COMPONENTS=$(sed -n 's/^ *component_\([0-9A-Z_a-z]*\) *().*/\1/p' <"$0")
197197

198+
# For Linux platforms we run latest/earliest versions of clang and the
199+
# test_clang_opt function is only for FreeBSD. This condition removes
200+
# test_clang_opt element from the ALL_COMPONENTS array for Linux.
201+
if [[ $(uname) == "Linux" ]]; then
202+
ALL_COMPONENTS=( "${ALL_COMPONENTS[@]/test_clang_opt}" )
203+
fi
204+
198205
# Exclude components that are not supported on this platform.
199206
SUPPORTED_COMPONENTS=
200207
for component in $ALL_COMPONENTS; do
@@ -3993,6 +4000,7 @@ component_test_cmake_shared () {
39934000

39944001
test_build_opt () {
39954002
info=$1 cc=$2; shift 2
4003+
$cc --version
39964004
for opt in "$@"; do
39974005
msg "build/test: $cc $opt, $info" # ~ 30s
39984006
make CC="$cc" CFLAGS="$opt -std=c99 -pedantic -Wall -Wextra -Werror"
@@ -4005,14 +4013,45 @@ test_build_opt () {
40054013
done
40064014
}
40074015

4008-
component_test_clang_opt () {
4016+
# For FreeBSD we invoke the function by name so this condition is added
4017+
# to disable the existing test_clang_opt function for linux.
4018+
if [[ $(uname) != "Linux" ]]; then
4019+
component_test_clang_opt () {
4020+
scripts/config.py full
4021+
test_build_opt 'full config' clang -O0 -Os -O2
4022+
}
4023+
fi
4024+
4025+
component_test_clang_latest_opt () {
40094026
scripts/config.py full
4010-
test_build_opt 'full config' clang -O0 -Os -O2
4027+
test_build_opt 'full config' clang-latest -O0 -Os -O2
4028+
}
4029+
support_test_clang_latest_opt () {
4030+
type clang-latest >/dev/null 2>/dev/null
40114031
}
40124032

4013-
component_test_gcc_opt () {
4033+
component_test_clang_earliest_opt () {
40144034
scripts/config.py full
4015-
test_build_opt 'full config' gcc -O0 -Os -O2
4035+
test_build_opt 'full config' clang-earliest -O0
4036+
}
4037+
support_test_clang_earliest_opt () {
4038+
type clang-earliest >/dev/null 2>/dev/null
4039+
}
4040+
4041+
component_test_gcc_latest_opt () {
4042+
scripts/config.py full
4043+
test_build_opt 'full config' gcc-latest -O0 -Os -O2
4044+
}
4045+
support_test_gcc_latest_opt () {
4046+
type gcc-latest >/dev/null 2>/dev/null
4047+
}
4048+
4049+
component_test_gcc_earliest_opt () {
4050+
scripts/config.py full
4051+
test_build_opt 'full config' gcc-earliest -O0
4052+
}
4053+
support_test_gcc_earliest_opt () {
4054+
type gcc-earliest >/dev/null 2>/dev/null
40164055
}
40174056

40184057
component_build_mbedtls_config_file () {

0 commit comments

Comments
 (0)