ztest: Give error if user has not defined CONFIG_ZTEST

If user is trying to use ztest by including ztest.h but has
not defined CONFIG_ZTEST, then fail the compilation as the
result binary will not do anything.

There is no check for CONFIG_ZTEST for unit tests that are run
without qemu.

Change-Id: Ief9bba3a3a0f6acc6a264f17cde828b6d7e543a5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2017-04-07 15:59:56 +03:00 committed by Anas Nashif
parent 06685e75ae
commit 5d7a7c253a
2 changed files with 5 additions and 0 deletions

View file

@ -26,6 +26,7 @@ all: $(TARGET)
ZTEST = tests/ztest/src
LIB += $(ZTEST)/ztest.o $(ZTEST)/ztest_mock.o
CFLAGS += -DZTEST_UNITTEST
OBJS = $(addprefix $(O)/, $(OBJECTS) $(LIB))

View file

@ -17,6 +17,10 @@
* @defgroup ztest Zephyr testing suite
*/
#if !defined(CONFIG_ZTEST) && !defined(ZTEST_UNITTEST)
#error "You need to add CONFIG_ZTEST to your config file."
#endif
#ifndef KERNEL
#define CONFIG_STDOUT_CONSOLE 1
#define CONFIG_ZTEST_ASSERT_VERBOSE 1