diff --git a/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-test-twister.bb b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-test-twister.bb index f0e10fc90fe8833a6ddc7633153dd14e35e3ecc2..82451bc3e7301c332b519b1f96925873df7f2d99 100644 --- a/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-test-twister.bb +++ b/meta-zephyr-core/recipes-kernel/zephyr-kernel/zephyr-kernel-test-twister.bb @@ -24,13 +24,34 @@ DEPENDS += "\ python3-ply-native \ " +# Base directory for twister to recursively search for test cases. +# Build all available kernel tests by default. +ZEPHYRTESTS = "kernel" +# Specify tags of tests that does not build. +ZEPHYRTESTS_EXCLUDE_TAGS = "" +ZEPHYRTESTS_EXCLUDE_TAGS:96b-nitrogen = "fpu" +# Specify tests that should be deleted before image building using twister. +# This can be used when test tags not well defined to exclude specific tests. +# Relative path of 'tests/' at the base of zephyr tree should be used. +ZEPHYRTESTS_DELETE = "" +ZEPHYRTESTS_DELETE:96b-nitrogen = "\ + kernel/profiling \ + kernel/fatal \ +" + do_compile() { if test -n "${ZEPHYRTESTS}"; then - tc_root_options="${@' '.join(['-T tests/kernel/' + i + ' ' for i in d.getVar('ZEPHYRTESTS').split()])}" + tc_root_options="${@' '.join(['-T tests/' + i + ' ' for i in d.getVar('ZEPHYRTESTS').split()])}" bbnote "Test case root options: ${tc_root_options}" - bbnote "Generating twister-out ..." + bbnote "Excluded test tags: ${ZEPHYRTESTS_EXCLUDE_TAGS}" + exclude_tags="${@' '.join(['--exclude-tag ' + i + ' ' for i in d.getVar('ZEPHYRTESTS_EXCLUDE_TAGS').split()])}" cd ${S} + for test in ${ZEPHYRTESTS_DELETE}; do + rm -rf tests/${test} + bbnote "Deleted ${test} defined in ZEPHYRTESTS_DELETE ..." + done rm -rf twister-out + bbnote "Generating twister-out ..." # Twister runs both 'cmake' and 'cmake --build' itself to configure and # compile test images respectively. All the flags using in cmake.bbclass # should be passed to twister so that tests are configured properly. @@ -70,6 +91,7 @@ do_compile() { -p ${@d.getVar('MACHINE').replace("-", "_")} \ --build-only \ ${tc_root_options} \ + ${exclude_tags} \ -vvv else bbnote "Do nothing as ZEPHYRTESTS is empty."