summaryrefslogtreecommitdiffstats
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:25 +0100
commit70534141e7df610335798fec54895a74664fc822 (patch)
tree03b7c70145f1d3b1e3c01248c7a90ca811c44a2d
parent7770281354d0d21d14961b0b5ddb945afabadf3c (diff)
downloadpoky-70534141e7df610335798fec54895a74664fc822.tar.gz
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. (From OE-Core rev: eaa5ecd2e7ff30192e51793d1419c0198638936d) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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 @@
23 23
24"""Test cases for wic.""" 24"""Test cases for wic."""
25 25
26import os
26import sys 27import sys
27 28
28from glob import glob 29from glob import glob
@@ -168,3 +169,22 @@ class Wic(oeSelfTest):
168 self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.direct"))) 169 self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.direct")))
169 self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.iso"))) 170 self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.iso")))
170 171
172 def test19_image_env(self):
173 """Test generation of <image>.env files."""
174 image = 'core-image-minimal'
175 stdir = get_bb_var('STAGING_DIR_TARGET', image)
176 imgdatadir = os.path.join(stdir, 'imgdata')
177
178 basename = get_bb_var('IMAGE_BASENAME', image)
179 self.assertEqual(basename, image)
180 path = os.path.join(imgdatadir, basename) + '.env'
181 self.assertTrue(os.path.isfile(path))
182
183 wicvars = get_bb_var('WICVARS', image).split()
184 wicvars.remove('IMAGE_BOOT_FILES') # this variable is optional
185 with open(path) as envfile:
186 content = dict(line.split("=", 1) for line in envfile)
187 # test if variables used by wic present in the .env file
188 for var in wicvars:
189 self.assertTrue(var in content, "%s is not in .env file" % var)
190 self.assertTrue(content[var])