Patchwork testimage: fail if no package manifest is found

login
register
mail settings
Submitter Stanacar, StefanX
Date Feb. 9, 2014, 10:39 a.m.
Message ID <1391942371-23953-2-git-send-email-stefanx.stanacar@intel.com>
Download mbox | patch
Permalink /patch/66511/
State New
Headers show

Comments

Stanacar, StefanX - Feb. 9, 2014, 10:39 a.m.
Sometimes we may forget to actually build the image
we want to test (when testimage task is called manually).
Instead of an ugly traceback we should fail nicely.
The manifest is written after the rootfs so this ensures
the image was actually built.

Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
---
 meta/classes/testimage.bbclass | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Patch

diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index 75ab716..48e1032 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -185,8 +185,11 @@  def testimage_main(d):
             self.imagefeatures = d.getVar("IMAGE_FEATURES", True).split()
             self.distrofeatures = d.getVar("DISTRO_FEATURES", True).split()
             manifest = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True), d.getVar("IMAGE_LINK_NAME", True) + ".manifest")
-            with open(manifest) as f:
-                self.pkgmanifest = f.read()
+            try:
+                with open(manifest) as f:
+                    self.pkgmanifest = f.read()
+            except IOError as e:
+                bb.fatal("No package manifest file found. Did you build the image?\n%s" % e)
 
     # test context
     tc = TestContext()