diff options
| author | Hongxu Jia <hongxu.jia@windriver.com> | 2025-06-23 16:03:06 +0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-06-26 11:02:34 +0100 |
| commit | 2768d6f6768c0792fa5347bf12b4a5088b3a6530 (patch) | |
| tree | aae6f183bb95d477f4bdea70719be3ebcd04b446 | |
| parent | e2e709d85ed4dffada352c1fcdd048a783b81307 (diff) | |
| download | poky-2768d6f6768c0792fa5347bf12b4a5088b3a6530.tar.gz | |
wic-image-minimal, oeqa/selftest/wic: run 'wic ls/cp/rm' in bitbake task
Due to commit [2255f28b57 wic: add WIC_SECTOR_SIZE variable][1] applied,
call `wic ls|cp|rm|write' in bitbake task will hung, but we have no scenario
case to cover it
After commit [scripts/wic: fix calling wic ls|cp|rm|write hung in bitbake task] applied,
this commit run `wic cp|ls|rm' in case wic.Wic2.test_wic_image_type and wic.Wic2.test_qemu,
at post function of with do_image_wic in image wic-image-minimal, and
check if file is there
$ echo 'SANITY_TESTED_DISTROS = ""' >> conf/local.conf
$ oe-selftest -r wic.Wic2.test_wic_image_type wic.Wic2.test_qemu
...
2025-06-23 15:46:22,157 - oe-selftest - INFO - Adding: "include selftest.inc" in /buildarea5/hjia/poky/build-st/conf/local.conf
2025-06-23 15:46:22,157 - oe-selftest - INFO - Adding: "include bblayers.inc" in bblayers.conf
2025-06-23 15:46:22,157 - oe-selftest - INFO - test_qemu (wic.Wic2)
The variable 'TEST_RUNQEMUPARAMS' is not defined
2025-06-23 15:56:46,319 - oe-selftest - INFO - ... ok
2025-06-23 15:56:46,324 - oe-selftest - INFO - test_wic_image_type (wic.Wic2)
2025-06-23 15:57:17,780 - oe-selftest - INFO - ... ok
2025-06-23 15:57:17,781 - oe-selftest - INFO - ----------------------------------------------------------------------
2025-06-23 15:57:17,781 - oe-selftest - INFO - Ran 2 tests in 655.792s
2025-06-23 15:57:17,781 - oe-selftest - INFO - OK
2025-06-23 15:57:25,743 - oe-selftest - INFO - RESULTS:
2025-06-23 15:57:25,743 - oe-selftest - INFO - RESULTS - wic.Wic2.test_qemu: PASSED (624.16s)
2025-06-23 15:57:25,744 - oe-selftest - INFO - RESULTS - wic.Wic2.test_wic_image_type: PASSED (31.46s)
2025-06-23 15:57:25,746 - oe-selftest - INFO - SUMMARY:
2025-06-23 15:57:25,746 - oe-selftest - INFO - oe-selftest () - Ran 2 tests in 655.793s
2025-06-23 15:57:25,746 - oe-selftest - INFO - oe-selftest - OK - All required tests passed (successes=2, skipped=0, failures=0, errors=0)
(From OE-Core rev: 18d774eafb7fba720882fcdb945d145b82fa1dd4)
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta-selftest/recipes-test/images/wic-image-minimal.bb | 2 | ||||
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/wic.py | 35 |
2 files changed, 37 insertions, 0 deletions
diff --git a/meta-selftest/recipes-test/images/wic-image-minimal.bb b/meta-selftest/recipes-test/images/wic-image-minimal.bb index 84d3721885..89843d9b3c 100644 --- a/meta-selftest/recipes-test/images/wic-image-minimal.bb +++ b/meta-selftest/recipes-test/images/wic-image-minimal.bb | |||
| @@ -16,3 +16,5 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384 | |||
| 16 | IMAGE_ROOTFS_EXTRA_SPACE = "2000" | 16 | IMAGE_ROOTFS_EXTRA_SPACE = "2000" |
| 17 | 17 | ||
| 18 | inherit image | 18 | inherit image |
| 19 | |||
| 20 | include test_recipe.inc | ||
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py index f45608172f..680f99d381 100644 --- a/meta/lib/oeqa/selftest/cases/wic.py +++ b/meta/lib/oeqa/selftest/cases/wic.py | |||
| @@ -1021,6 +1021,18 @@ class Wic2(WicTestCase): | |||
| 1021 | """Test building wic images by bitbake""" | 1021 | """Test building wic images by bitbake""" |
| 1022 | config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "wic-image-minimal"\n'\ | 1022 | config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "wic-image-minimal"\n'\ |
| 1023 | 'MACHINE_FEATURES:append = " efi"\n' | 1023 | 'MACHINE_FEATURES:append = " efi"\n' |
| 1024 | image_recipe_append = """ | ||
| 1025 | do_image_wic[postfuncs] += "run_wic_cmd" | ||
| 1026 | run_wic_cmd() { | ||
| 1027 | echo "test" >> ${WORKDIR}/test.wic-cp | ||
| 1028 | wic cp --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" ${WORKDIR}/test.wic-cp ${IMGDEPLOYDIR}/${IMAGE_NAME}.wic:1/ | ||
| 1029 | wic ls --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" ${IMGDEPLOYDIR}/${IMAGE_NAME}.wic:1/ | ||
| 1030 | wic rm --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" ${IMGDEPLOYDIR}/${IMAGE_NAME}.wic:1/test.wic-cp | ||
| 1031 | wic cp --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" ${WORKDIR}/test.wic-cp ${IMGDEPLOYDIR}/${IMAGE_NAME}.wic:1/ | ||
| 1032 | } | ||
| 1033 | """ | ||
| 1034 | self.write_recipeinc('images', image_recipe_append) | ||
| 1035 | |||
| 1024 | self.append_config(config) | 1036 | self.append_config(config) |
| 1025 | image = 'wic-image-minimal' | 1037 | image = 'wic-image-minimal' |
| 1026 | bitbake(image) | 1038 | bitbake(image) |
| @@ -1029,6 +1041,11 @@ class Wic2(WicTestCase): | |||
| 1029 | bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image) | 1041 | bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], image) |
| 1030 | prefix = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], '%s.' % bb_vars['IMAGE_LINK_NAME']) | 1042 | prefix = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], '%s.' % bb_vars['IMAGE_LINK_NAME']) |
| 1031 | 1043 | ||
| 1044 | sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') | ||
| 1045 | # check if file is there | ||
| 1046 | result = runCmd("wic ls %s:1/ -n %s" % (prefix+"wic", sysroot)) | ||
| 1047 | self.assertIn("test.wic-cp", result.output) | ||
| 1048 | |||
| 1032 | # check if we have result image and manifests symlinks | 1049 | # check if we have result image and manifests symlinks |
| 1033 | # pointing to existing files | 1050 | # pointing to existing files |
| 1034 | for suffix in ('wic', 'manifest'): | 1051 | for suffix in ('wic', 'manifest'): |
| @@ -1044,7 +1061,25 @@ class Wic2(WicTestCase): | |||
| 1044 | config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "wic-image-minimal"\n'\ | 1061 | config = 'IMAGE_FSTYPES += "wic"\nWKS_FILE = "wic-image-minimal"\n'\ |
| 1045 | 'MACHINE_FEATURES:append = " efi"\n' | 1062 | 'MACHINE_FEATURES:append = " efi"\n' |
| 1046 | self.append_config(config) | 1063 | self.append_config(config) |
| 1064 | image_recipe_append = """ | ||
| 1065 | do_image_wic[postfuncs] += "run_wic_cmd" | ||
| 1066 | run_wic_cmd() { | ||
| 1067 | echo "test" >> ${WORKDIR}/test.wic-cp | ||
| 1068 | wic cp --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" ${WORKDIR}/test.wic-cp ${IMGDEPLOYDIR}/${IMAGE_NAME}.wic:1/ | ||
| 1069 | wic ls --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" ${IMGDEPLOYDIR}/${IMAGE_NAME}.wic:1/ | ||
| 1070 | wic rm --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" ${IMGDEPLOYDIR}/${IMAGE_NAME}.wic:1/test.wic-cp | ||
| 1071 | wic cp --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" ${WORKDIR}/test.wic-cp ${IMGDEPLOYDIR}/${IMAGE_NAME}.wic:1/ | ||
| 1072 | } | ||
| 1073 | """ | ||
| 1074 | self.write_recipeinc('images', image_recipe_append) | ||
| 1047 | bitbake('wic-image-minimal') | 1075 | bitbake('wic-image-minimal') |
| 1076 | |||
| 1077 | sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') | ||
| 1078 | bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_LINK_NAME'], "wic-image-minimal") | ||
| 1079 | image_path = os.path.join(bb_vars['DEPLOY_DIR_IMAGE'], bb_vars['IMAGE_LINK_NAME']) | ||
| 1080 | # check if file is there | ||
| 1081 | result = runCmd("wic ls %s:1/ -n %s" % (image_path+".wic", sysroot)) | ||
| 1082 | self.assertIn("test.wic-cp", result.output) | ||
| 1048 | self.remove_config(config) | 1083 | self.remove_config(config) |
| 1049 | 1084 | ||
| 1050 | runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', 'wic-image-minimal') or "" | 1085 | runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', 'wic-image-minimal') or "" |
