mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
selftest/package: Add test to ensure sparse files are preserved
Add a new element to the hardlink test to check we also preseve file sparseness during the packing process. This should ensure we don't regress this issue again. (From OE-Core rev: 0a4e6974b49bf68c4a4098d339b5d655e202a3fd) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -16,4 +16,5 @@ do_install () {
|
||||
ln ${D}${bindir}/hello ${D}${bindir}/hello2
|
||||
ln ${D}${bindir}/hello ${D}${bindir}/hello3
|
||||
ln ${D}${bindir}/hello ${D}${bindir}/hello4
|
||||
dd if=/dev/zero of=${D}${bindir}/sparsetest bs=1 count=0 seek=1M
|
||||
}
|
||||
|
||||
@@ -88,6 +88,7 @@ class VersionOrdering(OESelftestTestCase):
|
||||
|
||||
class PackageTests(OESelftestTestCase):
|
||||
# Verify that a recipe which sets up hardlink files has those preserved into split packages
|
||||
# Also test file sparseness is preserved
|
||||
def test_preserve_hardlinks(self):
|
||||
result = bitbake("selftest-hardlink -c package")
|
||||
|
||||
@@ -97,3 +98,8 @@ class PackageTests(OESelftestTestCase):
|
||||
# Recipe creates 4 hardlinked files, there is a copy in package/ and a copy in packages-split/
|
||||
# so expect 8 in total.
|
||||
self.assertEqual(os.stat(dest + "/selftest-hardlink" + bindir + "/hello").st_nlink, 8)
|
||||
|
||||
# Test a sparse file remains sparse
|
||||
sparsestat = os.stat(dest + "/selftest-hardlink" + bindir + "/sparsetest")
|
||||
self.assertEqual(sparsestat.st_blocks, 0)
|
||||
self.assertEqual(sparsestat.st_size, 1048576)
|
||||
|
||||
Reference in New Issue
Block a user