summaryrefslogtreecommitdiff
path: root/meta/lib
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-08-31 00:14:24 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-30 23:26:14 +0100
commiteaa5ecd2e7ff30192e51793d1419c0198638936d (patch)
treea99d26d60b62e3fa357ad7e2a225a02f30331c58 /meta/lib
parent861ce6c5d4836df1a783be3b01d2de56117c9863 (diff)
downloadopenembedded-core-eaa5ecd2e7ff30192e51793d1419c0198638936d.tar.gz
openembedded-core-eaa5ecd2e7ff30192e51793d1419c0198638936d.tar.bz2
openembedded-core-eaa5ecd2e7ff30192e51793d1419c0198638936d.zip
oe-selftest: test generation of <image>.env
Added test case to check if <image>.env file is generated and contains bitbake variables used in wic code. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/selftest/wic.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index 117bd9dd8e..fe8a2d06f4 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -23,6 +23,7 @@
"""Test cases for wic."""
+import os
import sys
from glob import glob
@@ -168,3 +169,22 @@ class Wic(oeSelfTest):
self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.direct")))
self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.iso")))
+ def test19_image_env(self):
+ """Test generation of <image>.env files."""
+ image = 'core-image-minimal'
+ stdir = get_bb_var('STAGING_DIR_TARGET', image)
+ imgdatadir = os.path.join(stdir, 'imgdata')
+
+ basename = get_bb_var('IMAGE_BASENAME', image)
+ self.assertEqual(basename, image)
+ path = os.path.join(imgdatadir, basename) + '.env'
+ self.assertTrue(os.path.isfile(path))
+
+ wicvars = get_bb_var('WICVARS', image).split()
+ wicvars.remove('IMAGE_BOOT_FILES') # this variable is optional
+ with open(path) as envfile:
+ content = dict(line.split("=", 1) for line in envfile)
+ # test if variables used by wic present in the .env file
+ for var in wicvars:
+ self.assertTrue(var in content, "%s is not in .env file" % var)
+ self.assertTrue(content[var])