diff --git a/include/misc/__assert.h b/include/misc/__assert.h index 6645cad7967..af93f59cc53 100644 --- a/include/misc/__assert.h +++ b/include/misc/__assert.h @@ -67,6 +67,11 @@ #endif #endif +#ifdef CONFIG_FORCE_NO_ASSERT +#undef __ASSERT_ON +#define __ASSERT_ON 0 +#endif + #ifdef __ASSERT_ON #if (__ASSERT_ON < 0) || (__ASSERT_ON > 2) #error "Invalid __ASSERT() level: must be between 0 and 2" diff --git a/subsys/debug/Kconfig b/subsys/debug/Kconfig index 6a41cf38003..bfb7bc95df2 100644 --- a/subsys/debug/Kconfig +++ b/subsys/debug/Kconfig @@ -104,6 +104,16 @@ config ASSERT_LEVEL Level 1: on + warning in every file that includes __assert.h Level 2: on + no warning +config FORCE_NO_ASSERT + bool + prompt "Force-disable no assertions" + default n + help + This boolean option disables Zephyr assertion testing even + in circumstances (sanitycheck) where it is enabled via + CFLAGS and not Kconfig. Added solely to be able to work + around compiler bugs for specific tests. + config OBJECT_TRACING bool prompt "Kernel object tracing" diff --git a/tests/crypto/mbedtls/prj.conf b/tests/crypto/mbedtls/prj.conf index d09eb270b97..ad8caebad6a 100644 --- a/tests/crypto/mbedtls/prj.conf +++ b/tests/crypto/mbedtls/prj.conf @@ -5,3 +5,4 @@ CONFIG_MBEDTLS_BUILTIN=y CONFIG_MBEDTLS_CFG_FILE="config-threadnet.h" CONFIG_MBEDTLS_TEST=y CONFIG_ZTEST=y +CONFIG_FORCE_NO_ASSERT=y