tests: move testsuite and configs into subsys/

Move test related code and the testsuite away from tests/ and make it a
proper subsystem.
The way tests were integrate in the tree was not obvious and actual
tests were intermixed with the testsuite code.

This will allow us to have trees with the testcode and without the
samples by just remove the folders tests/ and samples, needed for
isolating actual code from test/sample code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2019-02-19 15:45:18 -05:00
parent 7f4eb00f47
commit ccad9d0d09
38 changed files with 16 additions and 14 deletions

View file

@ -560,7 +560,6 @@ add_subdirectory(boards)
add_subdirectory(ext)
add_subdirectory(subsys)
add_subdirectory(drivers)
add_subdirectory(tests)
# Add all zephyr modules subdirectories.
message("Including module(s): ${ZEPHYR_MODULES_NAME}")

View file

@ -38,7 +38,7 @@ source "subsys/Kconfig"
source "ext/Kconfig"
source "tests/Kconfig"
source "subsys/testsuite/Kconfig"
source "$(PROJECT_BINARY_DIR)/Kconfig.modules"

View file

@ -762,7 +762,7 @@ INPUT = @ZEPHYR_BASE@/include/ \
@ZEPHYR_BASE@/include/arch/nios2/ \
@ZEPHYR_BASE@/lib/libc/minimal/include/ \
@ZEPHYR_BASE@/include/net/dns_resolve.h \
@ZEPHYR_BASE@/tests/ztest/include/ \
@ZEPHYR_BASE@/subsys/testsuite/ztest/include/ \
@ZEPHYR_BASE@/tests/kernel/
# This tag can be used to specify the character encoding of the source files

View file

@ -17,4 +17,5 @@ add_subdirectory_ifdef(CONFIG_SETTINGS settings)
add_subdirectory(fb)
add_subdirectory(power)
add_subdirectory(stats)
add_subdirectory(testsuite)
add_subdirectory_if_kconfig(jwt)

View file

@ -35,6 +35,8 @@ source "subsys/storage/Kconfig"
source "subsys/settings/Kconfig"
source "subsys/testsuite/Kconfig"
source "subsys/app_memory/Kconfig"
source "subsys/fb/Kconfig"

View file

@ -1,6 +1,6 @@
add_subdirectory_if_kconfig(ztest)
zephyr_include_directories_ifdef(CONFIG_TEST
$ENV{ZEPHYR_BASE}/tests/include
$ENV{ZEPHYR_BASE}/subsys/testsuite/include
)
add_subdirectory_ifdef(CONFIG_COVERAGE_GCOV coverage)

View file

@ -6,7 +6,7 @@
menu Testing
source "tests/ztest/Kconfig"
source "subsys/testsuite/ztest/Kconfig"
config TEST
bool "Mark project as a test"

View file

@ -26,8 +26,8 @@ add_dependencies(testbinary ${KOBJ_TYPES_H_TARGET})
gen_kobj(KOBJ_GEN_DIR)
list(APPEND INCLUDE
tests/ztest/include
tests/include
subsys/testsuite/ztest/include
subsys/testsuite/include
include
.
)
@ -61,8 +61,8 @@ if(LIBS)
endif()
target_sources(testbinary PRIVATE
$ENV{ZEPHYR_BASE}/tests/ztest/src/ztest.c
$ENV{ZEPHYR_BASE}/tests/ztest/src/ztest_mock.c
$ENV{ZEPHYR_BASE}/subsys/testsuite/ztest/src/ztest.c
$ENV{ZEPHYR_BASE}/subsys/testsuite/ztest/src/ztest_mock.c
)
target_compile_definitions(testbinary PRIVATE ZTEST_UNITTEST)

View file

@ -1,6 +1,6 @@
zephyr_include_directories(
$ENV{ZEPHYR_BASE}/tests/include
$ENV{ZEPHYR_BASE}/tests/ztest/include
$ENV{ZEPHYR_BASE}/subsys/testsuite/include
$ENV{ZEPHYR_BASE}/subsys/testsuite/ztest/include
)
zephyr_library()

View file

@ -1,3 +1,3 @@
project(crc)
include($ENV{ZEPHYR_BASE}/tests/unit/unittest.cmake)
include($ENV{ZEPHYR_BASE}/subsys/testsuite/unittest.cmake)

View file

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.13.1)
if(BOARD STREQUAL unit_testing)
list(APPEND SOURCES src/main.c)
include($ENV{ZEPHYR_BASE}/tests/unit/unittest.cmake)
include($ENV{ZEPHYR_BASE}/subsys/testsuite/unittest.cmake)
project(base)
else()
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)

View file

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.13.1)
if(BOARD STREQUAL unit_testing)
list(APPEND SOURCES src/main.c)
include($ENV{ZEPHYR_BASE}/tests/unit/unittest.cmake)
include($ENV{ZEPHYR_BASE}/subsys/testsuite/unittest.cmake)
project(mock)
else()
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)