diff options
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/wic.py | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py index d98af8713a..60dce33911 100644 --- a/meta/lib/oeqa/selftest/cases/wic.py +++ b/meta/lib/oeqa/selftest/cases/wic.py | |||
| @@ -538,35 +538,42 @@ part /mnt --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/whoa | |||
| 538 | def test_exclude_path_with_extra_space(self): | 538 | def test_exclude_path_with_extra_space(self): |
| 539 | """Test having --exclude-path with IMAGE_ROOTFS_EXTRA_SPACE. [Yocto #15555]""" | 539 | """Test having --exclude-path with IMAGE_ROOTFS_EXTRA_SPACE. [Yocto #15555]""" |
| 540 | 540 | ||
| 541 | with NamedTemporaryFile("w", suffix=".wks") as wks: | 541 | oldpath = os.environ['PATH'] |
| 542 | wks.writelines( | 542 | os.environ['PATH'] = get_bb_var("PATH", "wic-tools") |
| 543 | ['bootloader --ptable gpt\n', | ||
| 544 | 'part /boot --size=100M --active --fstype=ext4 --label boot\n', | ||
| 545 | 'part / --source rootfs --fstype=ext4 --label root --exclude-path boot/\n']) | ||
| 546 | wks.flush() | ||
| 547 | config = 'IMAGE_ROOTFS_EXTRA_SPACE = "500000"\n'\ | ||
| 548 | 'DEPENDS:pn-core-image-minimal += "wic-tools"\n'\ | ||
| 549 | 'IMAGE_FSTYPES += "wic"\n'\ | ||
| 550 | 'WKS_FILE = "%s"\n' % wks.name | ||
| 551 | self.append_config(config) | ||
| 552 | bitbake('core-image-minimal') | ||
| 553 | 543 | ||
| 554 | """ | 544 | try: |
| 555 | the output of "wic ls <image>.wic" will look something like: | 545 | with NamedTemporaryFile("w", suffix=".wks") as wks: |
| 556 | Num Start End Size Fstype | 546 | wks.writelines( |
| 557 | 1 17408 136332287 136314880 ext4 | 547 | ['bootloader --ptable gpt\n', |
| 558 | 2 136332288 171464703 35132416 ext4 | 548 | 'part /boot --size=100M --active --fstype=ext4 --label boot\n', |
| 559 | we are looking for the size of partition 2 | 549 | 'part / --source rootfs --fstype=ext4 --label root --exclude-path boot/\n']) |
| 560 | i.e. in this case the number 35,132,416 | 550 | wks.flush() |
| 561 | without the fix the size will be around 85,403,648 | 551 | config = 'IMAGE_ROOTFS_EXTRA_SPACE = "500000"\n'\ |
| 562 | with the fix the size should be around 799,960,064 | 552 | 'DEPENDS:pn-core-image-minimal += "wic-tools"\n'\ |
| 563 | """ | 553 | 'IMAGE_FSTYPES += "wic"\n'\ |
| 564 | bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'MACHINE'], 'core-image-minimal') | 554 | 'WKS_FILE = "%s"\n' % wks.name |
| 565 | deploy_dir = bb_vars['DEPLOY_DIR_IMAGE'] | 555 | self.append_config(config) |
| 566 | machine = bb_vars['MACHINE'] | 556 | bitbake('core-image-minimal') |
| 567 | wicout = glob(os.path.join(deploy_dir, "core-image-minimal-%s.rootfs-*.wic" % machine))[0] | 557 | |
| 568 | size_of_root_partition = int(runCmd("wic ls %s" % wicout).output.split('\n')[2].split()[3]) | 558 | """ |
| 569 | self.assertGreater(size_of_root_partition, 500000000) | 559 | the output of "wic ls <image>.wic" will look something like: |
| 560 | Num Start End Size Fstype | ||
| 561 | 1 17408 136332287 136314880 ext4 | ||
| 562 | 2 136332288 171464703 35132416 ext4 | ||
| 563 | we are looking for the size of partition 2 | ||
| 564 | i.e. in this case the number 35,132,416 | ||
| 565 | without the fix the size will be around 85,403,648 | ||
| 566 | with the fix the size should be around 799,960,064 | ||
| 567 | """ | ||
| 568 | bb_vars = get_bb_vars(['DEPLOY_DIR_IMAGE', 'MACHINE'], 'core-image-minimal') | ||
| 569 | deploy_dir = bb_vars['DEPLOY_DIR_IMAGE'] | ||
| 570 | machine = bb_vars['MACHINE'] | ||
| 571 | wicout = glob(os.path.join(deploy_dir, "core-image-minimal-%s.rootfs-*.wic" % machine))[0] | ||
| 572 | size_of_root_partition = int(runCmd("wic ls %s" % wicout).output.split('\n')[2].split()[3]) | ||
| 573 | self.assertGreater(size_of_root_partition, 500000000) | ||
| 574 | |||
| 575 | finally: | ||
| 576 | os.environ['PATH'] = oldpath | ||
| 570 | 577 | ||
| 571 | def test_include_path(self): | 578 | def test_include_path(self): |
| 572 | """Test --include-path wks option.""" | 579 | """Test --include-path wks option.""" |
