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 f94291a03ecd79221021cac1232c74f73df405e5..7d0d643d54d81ea04f68562be98f556fdab80e13 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 @@ -68,6 +68,14 @@ ZEPHYRTESTS_DELETE:96b-nitrogen = "\ benchmarks/app_kernel \ benchmarks/sys_kernel \ " +# Deploy the needed files that can be executed and run on DUT using +# twister --test-only. +ARTIFACTS = "\ + twister.json \ + zephyr.hex \ + zephyr.bin \ + zephyr.elf \ +" do_compile() { if test -n "${ZEPHYRTESTS}"; then @@ -130,17 +138,21 @@ do_compile() { do_deploy () { if test -n "${ZEPHYRTESTS}"; then - # Twister '--test-only' option only needs the below files. Directory - # structure must be kept as it is. - # - zephyr.elf - # - twister.csv - twister_out="${S}/twister-out" - find ${twister_out}/ \( -type f -o -type l \) -a ! \( -name "zephyr.elf" -o -name "twister.csv" \) -print -delete - find ${twister_out}/ -empty -type d -delete - - image_name="twister-out-${MACHINE}.tar.bz2" - tar -jcvf ${image_name} -C ${S} twister-out - install -D ${image_name} ${DEPLOYDIR}/ + rm -rf "${B}/twister-out" + # Twister '--test-only' option needs the files defined in + # ARTIFACTS variable for on device testing. Directory structure + # must be kept as it is. + ( + cd "${S}" + for artifact in ${ARTIFACTS}; do + find twister-out/ \( -type f -o -type l \) \ + -name "${artifact}" \ + -exec cp --verbose --archive --parents {} "${B}" \; + done + ) + image_path="${B}/twister-out-${MACHINE}.tar.bz2" + tar -jcvf ${image_path} -C "${B}" twister-out + install -D ${image_path} ${DEPLOYDIR}/ else bbnote "Do nothing as ZEPHYRTESTS is empty." fi