build: downgrade the no optimization ztest error to warning

The current approach of failing the build on ztest with no optimization
broke coverage builds, and generally raised some concerns about being
too aggressive.

Downgrade the error to a warning and rework the option to inhibit the
warning, while also dropping it automatically for POSIX (that are not
really affected by stack size) and coverage run (that always runs with
no optimization).

Will reconsider this down the road if we still see issues filed for the
tests broken with no optimization and no further tuning.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
Fabio Baltieri 2023-05-23 08:15:58 +00:00 committed by Fabio Baltieri
commit b9ea2c2705
6 changed files with 19 additions and 20 deletions

View file

@ -705,11 +705,12 @@ endif()
if(CONFIG_ZTEST)
list(APPEND SYSCALL_INCLUDE_DIRS ${ZEPHYR_BASE}/subsys/testsuite/ztest/include)
if(CONFIG_NO_OPTIMIZATIONS AND NOT CONFIG_ZTEST_ALLOW_NO_OPTIMIZATIONS)
message(FATAL_ERROR "Running tests with CONFIG_NO_OPTIMIZATIONS is not "
"supported and known to break many tests, please do not file issues about "
"it. If you really mean to do this also enable "
"CONFIG_ZTEST_ALLOW_NO_OPTIMIZATIONS.")
if(CONFIG_NO_OPTIMIZATIONS AND CONFIG_ZTEST_WARN_NO_OPTIMIZATIONS)
message(WARNING "Running tests with CONFIG_NO_OPTIMIZATIONS is generally "
"not supported and known to break in many cases due to stack overflow or "
"other problems. Please do not file issues about it unless the test is "
"specifically tuned to run in this configuration. To disable this warning "
"set CONFIG_ZTEST_WARN_NO_OPTIMIZATIONS=n.")
endif()
endif()