diff options
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/wic.py')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/wic.py | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py index 1a67b6df51..680f99d381 100644 --- a/meta/lib/oeqa/selftest/cases/wic.py +++ b/meta/lib/oeqa/selftest/cases/wic.py | |||
@@ -153,7 +153,7 @@ class Wic(WicTestCase): | |||
153 | # create a temporary file for the WKS content | 153 | # create a temporary file for the WKS content |
154 | with NamedTemporaryFile("w", suffix=".wks") as wks: | 154 | with NamedTemporaryFile("w", suffix=".wks") as wks: |
155 | wks.write( | 155 | wks.write( |
156 | 'part --source bootimg-efi ' | 156 | 'part --source bootimg_efi ' |
157 | '--sourceparams="loader=grub-efi,install-kernel-into-boot-dir=false" ' | 157 | '--sourceparams="loader=grub-efi,install-kernel-into-boot-dir=false" ' |
158 | '--label boot --active\n' | 158 | '--label boot --active\n' |
159 | ) | 159 | ) |
@@ -186,7 +186,7 @@ class Wic(WicTestCase): | |||
186 | # create a temporary file for the WKS content | 186 | # create a temporary file for the WKS content |
187 | with NamedTemporaryFile("w", suffix=".wks") as wks: | 187 | with NamedTemporaryFile("w", suffix=".wks") as wks: |
188 | wks.write( | 188 | wks.write( |
189 | 'part --source bootimg-efi ' | 189 | 'part --source bootimg_efi ' |
190 | '--sourceparams="loader=grub-efi,install-kernel-into-boot-dir=true" ' | 190 | '--sourceparams="loader=grub-efi,install-kernel-into-boot-dir=true" ' |
191 | '--label boot --active\n' | 191 | '--label boot --active\n' |
192 | ) | 192 | ) |
@@ -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 "" |
@@ -1358,7 +1393,7 @@ class Wic2(WicTestCase): | |||
1358 | def test_biosplusefi_plugin(self): | 1393 | def test_biosplusefi_plugin(self): |
1359 | """Test biosplusefi plugin""" | 1394 | """Test biosplusefi plugin""" |
1360 | # Wic generation below may fail depending on the order of the unittests | 1395 | # Wic generation below may fail depending on the order of the unittests |
1361 | # This is because bootimg-pcbios (that bootimg-biosplusefi uses) generate its MBR inside STAGING_DATADIR directory | 1396 | # This is because bootimg_pcbios (that bootimg_biosplusefi uses) generate its MBR inside STAGING_DATADIR directory |
1362 | # which may or may not exists depending on what was built already | 1397 | # which may or may not exists depending on what was built already |
1363 | # If an image hasn't been built yet, directory ${STAGING_DATADIR}/syslinux won't exists and _get_bootimg_dir() | 1398 | # If an image hasn't been built yet, directory ${STAGING_DATADIR}/syslinux won't exists and _get_bootimg_dir() |
1364 | # will raise with "Couldn't find correct bootimg_dir" | 1399 | # will raise with "Couldn't find correct bootimg_dir" |
@@ -1370,7 +1405,7 @@ class Wic2(WicTestCase): | |||
1370 | 1405 | ||
1371 | img = 'core-image-minimal' | 1406 | img = 'core-image-minimal' |
1372 | with NamedTemporaryFile("w", suffix=".wks") as wks: | 1407 | with NamedTemporaryFile("w", suffix=".wks") as wks: |
1373 | wks.writelines(['part /boot --active --source bootimg-biosplusefi --sourceparams="loader=grub-efi"\n', | 1408 | wks.writelines(['part /boot --active --source bootimg_biosplusefi --sourceparams="loader=grub-efi"\n', |
1374 | 'part / --source rootfs --fstype=ext4 --align 1024 --use-uuid\n'\ | 1409 | 'part / --source rootfs --fstype=ext4 --align 1024 --use-uuid\n'\ |
1375 | 'bootloader --timeout=0 --append="console=ttyS0,115200n8"\n']) | 1410 | 'bootloader --timeout=0 --append="console=ttyS0,115200n8"\n']) |
1376 | wks.flush() | 1411 | wks.flush() |
@@ -1390,7 +1425,7 @@ class Wic2(WicTestCase): | |||
1390 | 1425 | ||
1391 | img = 'core-image-minimal' | 1426 | img = 'core-image-minimal' |
1392 | with NamedTemporaryFile("w", suffix=".wks") as wks: | 1427 | with NamedTemporaryFile("w", suffix=".wks") as wks: |
1393 | wks.writelines(['part /boot --source bootimg-efi --sourceparams="loader=uefi-kernel"\n' | 1428 | wks.writelines(['part /boot --source bootimg_efi --sourceparams="loader=uefi-kernel"\n' |
1394 | 'part / --source rootfs --fstype=ext4 --align 1024 --use-uuid\n'\ | 1429 | 'part / --source rootfs --fstype=ext4 --align 1024 --use-uuid\n'\ |
1395 | 'bootloader --timeout=0 --append="console=ttyS0,115200n8"\n']) | 1430 | 'bootloader --timeout=0 --append="console=ttyS0,115200n8"\n']) |
1396 | wks.flush() | 1431 | wks.flush() |