summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-08-12 22:29:18 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-08-15 09:33:53 +0100
commit0a4e6974b49bf68c4a4098d339b5d655e202a3fd (patch)
tree225fd18c4dc068793f714a7752a2875e568346ff
parent8f5f23a5a985f5d48973f27c143b0d5edb8ca797 (diff)
downloadopenembedded-core-contrib-0a4e6974b49bf68c4a4098d339b5d655e202a3fd.tar.gz
openembedded-core-contrib-0a4e6974b49bf68c4a4098d339b5d655e202a3fd.tar.bz2
openembedded-core-contrib-0a4e6974b49bf68c4a4098d339b5d655e202a3fd.zip
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@linuxfoundation.org>
-rw-r--r--meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb1
-rw-r--r--meta/lib/oeqa/selftest/cases/package.py6
2 files changed, 7 insertions, 0 deletions
diff --git a/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb b/meta-selftest/recipes-test/selftest-hardlink/selftest-hardlink.bb
index 8a0e6336aa..ec330fa9ff 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 f288fcafdb..4ff9b08c96 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)