zephyr/subsys/testsuite/arch/unit_testing/Kconfig

25 lines
579 B
Plaintext
Raw Normal View History

cmake: kconfig: introduce dedicated unit testing board This commit introduces a dedicated unit testing board. Today, a dedicated Zephyr unit testing scheme exists but is different from how a Zephyr build generally works. For example Kconfig is not possible, resulting on various different hacks to pass Kconfig settings from test cases / testcase.yaml through CMake to the code. Some directly as compile definitions, some as header files with forced inclusion on sources, some with wrapper flags which again results in different define being enabled. There is even cases where a second forced header inclusion undefines previous defines. Unit test often does a manual check for the right boards, like this: > if (NOT BOARD STREQUAL unit_testing) > message(FATAL_ERROR "This project can only be used with...") > endif() Introducing a dedicated unit_testing board under `tests/root` allows us to use Kconfig in unit test samples, and thus proper `prj.conf` and extra Kconfig fragments. Generation of autoconf.h so the overall architecture follows regular Zephyr builds. Proper and uniform error messages when invalid board is selected. The unit_testing board and arch is located under: `subsys/testsuite` so that it is only available when find_package(Zephyr COMPONENTS unittest) is used, and not available for regular Zephyr builds. Kconfig generates autoconf.h which is applied as compile flag to test binary which means that kconfig defines placed in ztest.h can now be removed. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-05 17:09:26 +08:00
# Copyright (c) 2022 Nordic Semiconductor
#
# SPDX-License-Identifier: Apache-2.0
# Current the use of X86 is for consistency with old testsuite/ztest which
# defined CONFIG_X86 manually. To consider, is NATIVE_POSIX a better choice?
config X86
bool
default y
help
The unit_testing architecture identifies itself as X86 for basic
ztest and kernel support.
if CONSOLE
config POSIX_ARCH_CONSOLE
cmake: kconfig: introduce dedicated unit testing board This commit introduces a dedicated unit testing board. Today, a dedicated Zephyr unit testing scheme exists but is different from how a Zephyr build generally works. For example Kconfig is not possible, resulting on various different hacks to pass Kconfig settings from test cases / testcase.yaml through CMake to the code. Some directly as compile definitions, some as header files with forced inclusion on sources, some with wrapper flags which again results in different define being enabled. There is even cases where a second forced header inclusion undefines previous defines. Unit test often does a manual check for the right boards, like this: > if (NOT BOARD STREQUAL unit_testing) > message(FATAL_ERROR "This project can only be used with...") > endif() Introducing a dedicated unit_testing board under `tests/root` allows us to use Kconfig in unit test samples, and thus proper `prj.conf` and extra Kconfig fragments. Generation of autoconf.h so the overall architecture follows regular Zephyr builds. Proper and uniform error messages when invalid board is selected. The unit_testing board and arch is located under: `subsys/testsuite` so that it is only available when find_package(Zephyr COMPONENTS unittest) is used, and not available for regular Zephyr builds. Kconfig generates autoconf.h which is applied as compile flag to test binary which means that kconfig defines placed in ztest.h can now be removed. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-05 17:09:26 +08:00
bool
default y
select CONSOLE_HAS_DRIVER
help
The unit testing architecture is expected to always have access to a
standard terminal for printing.
endif # CONSOLE