misc: Add a FORCE_NO_ASSERT kconfig directive

The mbedtls test is hitting a compiler bug where two subtests will
soft fail on qemu_xtensa when assertions are enabled.  This is despite
the fact that:

+ The failure is entirely internal to the mbedtls suite.
+ The mbedtls code does not use zephyr asserts
+ The mbedtls code does not call into zephyr code that might assert.
+ The behavior persists even when an irq_lock() is held across the
  entire test, ruling out any asserts in interrupt/exception context.
+ And EVEN WHEN the mbedtls library blobs are bytewise identical
  between assert and non-assert cases.

The bug seems to be a layout thing where the mbedtls code behavior
differently based on code address and/or link-time optimizations
(xtensa has a few).

Unfortunately sanitycheck enables assertions by setting CFLAGS
directly and not via kconfig, so we can't fix this by turning the
feature off in an app right now.  This patch adds a simple "override"
flag that can be set by apps like this that hit bugs.

Again, note that zephyr assertions are not used nor needed by this one
test.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2018-02-09 12:24:05 -08:00 committed by Anas Nashif
parent 992ea243d5
commit 6eef2f1485
3 changed files with 16 additions and 0 deletions

View File

@ -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"

View File

@ -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"

View File

@ -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