Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "Milan Shah" <milan.opensource@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: richard.purdie@linuxfoundation.org, akuster@mvista.com,
	randy.macleod@windriver.com
Subject: [OE-Core][PATCH] manifest.py: Add tests to empty image
Date: Fri, 22 Jan 2021 11:28:05 +0530	[thread overview]
Message-ID: <20210122055805.14834-1-milan.opensource@gmail.com> (raw)

An oe-selftest test is added to ensure
meta-selftest/recipes-test/images/test-empty-image.bb builds and is empty.

It is just a test that ensures that an empty image has no packages in it
(i.e. nothing in the manifest)

See [YOCTO #8455] for details.

Signed-off-by: Milan Shah <milan.opensource@gmail.com>
---
 meta/lib/oeqa/selftest/cases/manifest.py | 45 ++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/meta/lib/oeqa/selftest/cases/manifest.py b/meta/lib/oeqa/selftest/cases/manifest.py
index 5d13f35468..d9b8612628 100644
--- a/meta/lib/oeqa/selftest/cases/manifest.py
+++ b/meta/lib/oeqa/selftest/cases/manifest.py
@@ -162,3 +162,48 @@ class VerifyManifest(OESelftestTestCase):
             self.logger.debug(logmsg)
             self.logger.info(msg)
             self.fail(logmsg)
+
+class VerifyEmptyManifest(OESelftestTestCase):
+    '''Tests for the manifest files of an empty image'''
+
+    @classmethod
+    def setUpClass(self):
+
+        # the setup should bitbake test-empty-image
+        super(VerifyEmptyManifest, self).setUpClass()
+        self.buildtarget = 'test-empty-image'
+        self.classname = 'VerifyEmptyManifest'
+
+        self.logger.info("{}: doing bitbake {} as a prerequisite of the test"\
+                .format(self.classname, self.buildtarget))
+        if bitbake(self.buildtarget).status:
+            self.logger.debug("{} Failed to setup {}"\
+                    .format(self.classname, self.buildtarget))
+            self.skipTest("{}: Cannot setup testing scenario"\
+                    .format(self.classname))
+
+
+    @classmethod
+    def test_image_manifest_empty(self):
+        '''Verifying the image manifest file is empty, this may take a build'''
+
+        # get manifest location based on target to query about
+        try:
+            mdir = VerifyManifest.get_dir_from_bb_var('DEPLOY_DIR_IMAGE',
+                                                self.buildtarget)
+            mfilename = get_bb_var("IMAGE_LINK_NAME", self.buildtarget)\
+                    + ".manifest"
+            mpath = os.path.join(mdir, mfilename)
+            self.logger.info("Manifest file path is: {}" .format(mpath))
+
+            if not os.path.isfile(mpath): raise IOError
+            if not os.path.getsize(mpath) == 0: raise OSError
+
+        except OSError:
+            raise self.skipTest("{}: manifest file is not empty"\
+                .format(self.classname))
+
+        except IOError:
+                msg = "{}: Error cannot find manifests in dir:\n{}"\
+                        .format(self.classname, mdir)
+                self.fail(msg)
-- 
2.25.1


             reply	other threads:[~2021-01-22  5:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22  5:58 Milan Shah [this message]
2021-02-06  6:13 ` [OE-Core][PATCH] manifest.py: Add tests to empty image Milan Shah
2021-02-06  9:07 ` Richard Purdie
2021-02-14  6:19   ` Milan Shah
2021-02-14 11:07     ` Richard Purdie
     [not found] <20210112133626.2229251-1-milan.opensource@gmail.com>
2021-01-18  6:54 ` Milan Shah

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=20210122055805.14834-1-milan.opensource@gmail.com \
    --to=milan.opensource@gmail.com \
    --cc=akuster@mvista.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=randy.macleod@windriver.com \
    --cc=richard.purdie@linuxfoundation.org \
    /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