]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
selftest/package: Add test to ensure sparse files are preserved
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 12 Aug 2018 22:29:18 +0000 (22:29 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 15 Aug 2018 08:33:53 +0000 (09:33 +0100)
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.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb
meta/lib/oeqa/selftest/cases/package.py

index 8a0e6336aa881002fec465fb51f97f4c0a0e7043..ec330fa9fffba20d103ce6188b94bb0408fd70ca 100644 (file)
@@ -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
 }
index f288fcafdb42c39cfd1ff6f10443a4a3d851826a..4ff9b08c96ae70f971dbbb3578bd291279ba5406 100644 (file)
@@ -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)