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
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(ext)
add_subdirectory(subsys) add_subdirectory(subsys)
add_subdirectory(drivers) add_subdirectory(drivers)
add_subdirectory(tests)
# Add all zephyr modules subdirectories. # Add all zephyr modules subdirectories.
message("Including module(s): ${ZEPHYR_MODULES_NAME}") message("Including module(s): ${ZEPHYR_MODULES_NAME}")

View file

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

View file

@ -762,7 +762,7 @@ INPUT = @ZEPHYR_BASE@/include/ \
@ZEPHYR_BASE@/include/arch/nios2/ \ @ZEPHYR_BASE@/include/arch/nios2/ \
@ZEPHYR_BASE@/lib/libc/minimal/include/ \ @ZEPHYR_BASE@/lib/libc/minimal/include/ \
@ZEPHYR_BASE@/include/net/dns_resolve.h \ @ZEPHYR_BASE@/include/net/dns_resolve.h \
@ZEPHYR_BASE@/tests/ztest/include/ \ @ZEPHYR_BASE@/subsys/testsuite/ztest/include/ \
@ZEPHYR_BASE@/tests/kernel/ @ZEPHYR_BASE@/tests/kernel/
# This tag can be used to specify the character encoding of the source files # 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(fb)
add_subdirectory(power) add_subdirectory(power)
add_subdirectory(stats) add_subdirectory(stats)
add_subdirectory(testsuite)
add_subdirectory_if_kconfig(jwt) add_subdirectory_if_kconfig(jwt)

View file

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

View file

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

View file

@ -6,7 +6,7 @@
menu Testing menu Testing
source "tests/ztest/Kconfig" source "subsys/testsuite/ztest/Kconfig"
config TEST config TEST
bool "Mark project as a 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) gen_kobj(KOBJ_GEN_DIR)
list(APPEND INCLUDE list(APPEND INCLUDE
tests/ztest/include subsys/testsuite/ztest/include
tests/include subsys/testsuite/include
include include
. .
) )
@ -61,8 +61,8 @@ if(LIBS)
endif() endif()
target_sources(testbinary PRIVATE target_sources(testbinary PRIVATE
$ENV{ZEPHYR_BASE}/tests/ztest/src/ztest.c $ENV{ZEPHYR_BASE}/subsys/testsuite/ztest/src/ztest.c
$ENV{ZEPHYR_BASE}/tests/ztest/src/ztest_mock.c $ENV{ZEPHYR_BASE}/subsys/testsuite/ztest/src/ztest_mock.c
) )
target_compile_definitions(testbinary PRIVATE ZTEST_UNITTEST) target_compile_definitions(testbinary PRIVATE ZTEST_UNITTEST)

View file

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

View file

@ -1,3 +1,3 @@
project(crc) 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) if(BOARD STREQUAL unit_testing)
list(APPEND SOURCES src/main.c) list(APPEND SOURCES src/main.c)
include($ENV{ZEPHYR_BASE}/tests/unit/unittest.cmake) include($ENV{ZEPHYR_BASE}/subsys/testsuite/unittest.cmake)
project(base) project(base)
else() else()
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) 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) if(BOARD STREQUAL unit_testing)
list(APPEND SOURCES src/main.c) list(APPEND SOURCES src/main.c)
include($ENV{ZEPHYR_BASE}/tests/unit/unittest.cmake) include($ENV{ZEPHYR_BASE}/subsys/testsuite/unittest.cmake)
project(mock) project(mock)
else() else()
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)