From: Benjamin Esquivel <benjamin.esquivel@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Cc: paul.eggleton@linux.intel.com
Subject: [PATCH] selftest/manifest.py: Test to verify rootfs manifest
Date: Wed, 26 Aug 2015 12:26:02 +0000 [thread overview]
Message-ID: <1440591962-35348-1-git-send-email-benjamin.esquivel@linux.intel.com> (raw)
Adding a new test to verify if the packages in the
manifest files actually exists in pkgdata.
-adding a setUpClass for when more tests get created here
-check for the paths and fail gracefully if not there
-skip the test when there are no manifest files to check
-debug prints for failure analysis
[YOCTO#8028]
Signed-off-by: Benjamin Esquivel <benjamin.esquivel@linux.intel.com>
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
---
meta/lib/oeqa/selftest/manifest.py | 52 ++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
create mode 100644 meta/lib/oeqa/selftest/manifest.py
diff --git a/meta/lib/oeqa/selftest/manifest.py b/meta/lib/oeqa/selftest/manifest.py
new file mode 100644
index 0000000..c2bc945
--- /dev/null
+++ b/meta/lib/oeqa/selftest/manifest.py
@@ -0,0 +1,52 @@
+import unittest
+import os
+from glob import glob
+
+from oeqa.selftest.base import oeSelfTest
+from oeqa.utils.commands import get_bb_var
+from oeqa.utils.decorators import testcase
+
+class VerifyManifest(oeSelfTest):
+ '''Tests for the manifest files and contents of an image'''
+
+ @classmethod
+ def setUpClass(self):
+
+ # get directory locations from variable values and check them
+ self.deploy_dir_image = get_bb_var('DEPLOY_DIR_IMAGE');
+ if not self.deploy_dir_image \
+ or not os.path.isdir(self.deploy_dir_image):
+ raise unittest.SkipTest("{}: DEPLOY_DIR_IMAGE does not exist: {}"\
+ .format("VerifyManifest", self.deploy_dir_image))
+
+ self.pkgdata_dir = get_bb_var('PKGDATA_DIR');
+ if not self.pkgdata_dir \
+ or not os.path.isdir(self.pkgdata_dir):
+ raise unittest.SkipTest("{}: PKGDATA_DIR does not exist: {}"\
+ .format("VerifyManifest", self.pkgdata_dir))
+
+ # get the manifest files
+ # no need to try: since glob would return an empty list if
+ # the path is non-existant
+ self.manifest_files = glob("%s/*.manifest" % self.deploy_dir_image)
+ self.log.debug("manifest files: {}".format(self.manifest_files))
+ if not self.manifest_files:
+ raise unittest.SkipTest("{}: No manifest files found in: {}"\
+ .format("VerifyManifest", self.deploy_dir_image))
+
+
+ def test_manifest_entries(self):
+ '''Verifying the manifest entries as packages '''
+ testname = self.id().split('.')[-1]
+ rundir = os.path.join(self.pkgdata_dir, "runtime-reverse")
+
+ errmsg = "ERROR: Package %s is in manifest but not in pkgdata"
+ for manifest in self.manifest_files:
+ with open(manifest, "r") as mfile:
+ for manifest_entries in mfile:
+ pkg = manifest_entries.split()[0]
+ pkgfile = os.path.join(rundir, pkg)
+ self.log.debug("{}: looking for {}"\
+ .format(testname, pkgfile))
+ self.assertTrue(os.path.isfile(pkgfile),
+ errmsg % pkg)
--
2.3.0
next reply other threads:[~2015-08-26 20:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-26 12:26 Benjamin Esquivel [this message]
2015-08-27 8:34 ` [PATCH] selftest/manifest.py: Test to verify rootfs manifest Paul Eggleton
2015-08-27 15:50 ` Benjamin Esquivel
2015-08-28 9:18 ` Paul Eggleton
2015-09-02 20:18 ` [PATCH v2] selftest/manifest.py: Test support for manifests Benjamin Esquivel
2015-09-10 9:52 ` Burton, Ross
2015-09-10 21:41 ` Benjamin Esquivel
2015-10-07 19:41 ` [PATCH V3] " Benjamin Esquivel
2015-10-16 16:20 ` Burton, Ross
2015-10-16 20:05 ` Benjamin Esquivel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1440591962-35348-1-git-send-email-benjamin.esquivel@linux.intel.com \
--to=benjamin.esquivel@linux.intel.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=paul.eggleton@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox