summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-08-14 17:24:14 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-08-15 09:33:53 +0100
commitfe5b37c07b6d07c350516ab6bf849d6d86a84004 (patch)
tree1ab44cdd205cc7a191c7005ada2633a4e43414d3
parent055402e5504f041c346571e243c7cf0894955cad (diff)
downloadopenembedded-core-contrib-fe5b37c07b6d07c350516ab6bf849d6d86a84004.tar.gz
openembedded-core-contrib-fe5b37c07b6d07c350516ab6bf849d6d86a84004.tar.bz2
openembedded-core-contrib-fe5b37c07b6d07c350516ab6bf849d6d86a84004.zip
selftest/package: Improve test to cover sparseness and hardlinking from sstate
The sparseness test was sometimes working and sometimes failing depending on whether sstate was valid. This adds an explict test of sstate to the test for both hardlinking and sparseness. Tweak the test name to cover the fact its tests sparseness too. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/selftest/cases/package.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/meta/lib/oeqa/selftest/cases/package.py b/meta/lib/oeqa/selftest/cases/package.py
index 4ff9b08c96..ee6430a184 100644
--- a/meta/lib/oeqa/selftest/cases/package.py
+++ b/meta/lib/oeqa/selftest/cases/package.py
@@ -89,17 +89,26 @@ 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")
+ def test_preserve_sparse_hardlinks(self):
+ bitbake("selftest-hardlink -c package")
dest = get_bb_var('PKGDEST', 'selftest-hardlink')
bindir = get_bb_var('bindir', 'selftest-hardlink')
- # 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)
+ def checkfiles():
+ # 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)
+ # 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)
+
+ checkfiles()
+
+ # Clean and reinstall so its now definitely from sstate, then retest.
+ bitbake("selftest-hardlink -c clean")
+ bitbake("selftest-hardlink -c package")
+
+ checkfiles()