-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use earliest latest compilers #7968
Use earliest latest compilers #7968
Conversation
This PR has a dependency on Mbed-TLS/mbedtls-test#118 |
tests/suites/test_suite_aes.function
Outdated
@@ -418,7 +418,7 @@ exit: | |||
/* END_CASE */ | |||
|
|||
/* BEGIN_CASE */ | |||
void aes_invalid_mode() | |||
void aes_invalid_mode(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to keep allowing ()
in test functions. It's a more logical syntax (which C lacks only due to backward compatibility constraint), and if we stop allowing it, we'll likely forget in new work and then get surprised when the CI fails with clang-latest
. If we do, then we don't need the massive (in terms of changed lines) changes to *.function
.
This only requires a small change in tests/scripts/generate_test_code.py
: in parse_function_code
, if args
is blank (ideally also if args
only contains comments, but that's not critical), add void
to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Will drop the *.function
changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already code in the script to accept void
as meaning no arguments, since 47e2e88. Looking at it now (I'd forgotten how it was done), it seems that we're stripping void
if it was present in the source, so we should unconditionally add it when generating. So yes, adding it in gen_from_test_data
does sound good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, there are unit tests in tests/scripts/test_generate_test_code.py
. If inserting void
breaks a unit test, please update the expected result from that test. If inserting void
doesn't break an existing unit test, please add one.
d5a84ff
to
0a08d33
Compare
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]>
0a08d33
to
2ccdc6d
Compare
Running clang-16 on mbedtls reports warnings of type "-Wstrict-prototypes". This patch fixes these warnings by adding void to functions with no arguments. The generate_test_code.py is modified to insert void into test functions with no arguments in *.function files. Signed-off-by: Gowtham Suresh Kumar <[email protected]>
2ccdc6d
to
186731b
Compare
ec4988b
to
6f1977b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor thing
tests/scripts/generate_test_code.py
Outdated
@@ -667,6 +667,11 @@ def parse_function_code(funcs_f, dependencies, suite_dependencies): | |||
code = code.replace(name, 'test_' + name, 1) | |||
name = 'test_' + name | |||
|
|||
# If a test function has no arguments then add 'void' argument to | |||
# avoid "-Wstrict-prototypes" warnings from clang-16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: not specifically clang-16. That option has been around at least as far back as Clang 3.5.
tests/scripts/all.sh
Outdated
: ${CLANG_LATEST:="clang-16"} | ||
: ${CLANG_EARLIEST:="clang-3.5"} | ||
: ${GCC_LATEST:="gcc-12"} | ||
: ${GCC_EARLIEST:="gcc-4.7"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer not to hard-code versions in all.sh
, just like we don't hard-code versions of OpenSSL. The CI setup (docker files on Linux) defines the versions we use.
: ${CLANG_LATEST:="clang-16"} | |
: ${CLANG_EARLIEST:="clang-3.5"} | |
: ${GCC_LATEST:="gcc-12"} | |
: ${GCC_EARLIEST:="gcc-4.7"} | |
: ${CLANG_LATEST:="clang-latest"} | |
: ${CLANG_EARLIEST:="clang-earlist"} | |
: ${GCC_LATEST:="gcc-latest"} | |
: ${GCC_EARLIEST:="gcc-earliest"} |
f88b48b
to
57713bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except for a typo that prevented the CI from running
tests/scripts/all.sh
Outdated
@@ -176,7 +176,10 @@ pre_initialize_variables () { | |||
: ${ARMC6_BIN_DIR:=/usr/bin} | |||
: ${ARM_NONE_EABI_GCC_PREFIX:=arm-none-eabi-} | |||
: ${ARM_LINUX_GNUEABI_GCC_PREFIX:=arm-linux-gnueabi-} | |||
|
|||
: ${CLANG_LATEST:="clang-latest"} | |||
: ${CLANG_EARLIEST:="clang-earlist"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: ${CLANG_EARLIEST:="clang-earlist"} | |
: ${CLANG_EARLIEST:="clang-earliest"} |
and likewise for gcc below.
Signed-off-by: Gowtham Suresh Kumar <[email protected]>
57713bc
to
9da40b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
: ${CLANG_LATEST:="clang-latest"} | ||
: ${CLANG_EARLIEST:="clang-earliest"} | ||
: ${GCC_LATEST:="gcc-latest"} | ||
: ${GCC_EARLIEST:="gcc-earliest"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor: there used to be a blank line here, it's still present in the 2.28 branch but not here. Not worth changing if there's nothing else to change.
scripts/config.py full | ||
test_build_opt 'full config' clang -O0 -Os -O2 | ||
test_build_opt 'full config' "$CLANG_EARLIEST" -O0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why -O0
? That's the fastest build, but -O
or -O2is faster when doing build and test. Also,
-O0` omits some warnings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I looked into the changes thoroughly and this was supposed to be -O
. :(
Its also mentioned in #7891.
For the earliest compilers, just do a -O build.
Shall I create a new PR for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix it in #9286 which is where I noticed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
Closes #7891
Needs Mbed-TLS/mbedtls-test#118 to be merged, otherwise the CI won't pass.
This PR has adds following changes:
The Ubuntu 16.04 and 22.04 docker images in mbedtls-test have been updated with earliest and latest versions of gcc and clang respectively. This PR adds the components 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.
Running clang-16 on mbedtls reports warnings of type "-Wstrict-prototypes". This patch fixes these warnings by adding void to functions with no arguments.
PR checklist