diff options
-rw-r--r-- | meta/lib/oeqa/selftest/wic.py | 20 |
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 | ||
26 | import os | ||
26 | import sys | 27 | import sys |
27 | 28 | ||
28 | from glob import glob | 29 | from 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]) | ||