From fb28060367c9d868cd02bb2947e26bf3da46bb7f Mon Sep 17 00:00:00 2001 From: Chase Qi <chase.qi@linaro.org> Date: Thu, 11 Aug 2022 12:14:21 +0800 Subject: [PATCH] zephyr-kernel-test-twister: fix image deployment for zephyr v3.1.0 Twister switched data format from csv to json in v3.1.0. Signed-off-by: Chase Qi <chase.qi@linaro.org> --- .../zephyr-kernel-test-twister.bb | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) 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 f94291a..7d0d643 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 -- GitLab