[oe-commits] [openembedded-core] 15/17: selftest/package: Add test to ensure sparse files are preserved

git at git.openembedded.org git at git.openembedded.org
Tue Aug 14 15:35:50 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit cd1fb12f8ea7f64e44766b47e616d8011cf7655d
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Sun Aug 12 22:29:18 2018 +0000

    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.
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb | 1 +
 meta/lib/oeqa/selftest/cases/package.py                           | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb b/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb
index 8a0e633..ec330fa 100644
--- a/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb
+++ b/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb
@@ -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
 }
diff --git a/meta/lib/oeqa/selftest/cases/package.py b/meta/lib/oeqa/selftest/cases/package.py
index f288fca..4ff9b08 100644
--- a/meta/lib/oeqa/selftest/cases/package.py
+++ b/meta/lib/oeqa/selftest/cases/package.py
@@ -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)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list