summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-01-24 15:43:55 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-31 14:38:32 +0000
commit3f21101e727c605443f06d5d2ec6a3413b4fd338 (patch)
tree48f23329e5b373629bff9f97a9362c21a1b6a465 /meta
parent6d78ff1144642c17d36ec3b1365059257152819c (diff)
downloadpoky-3f21101e727c605443f06d5d2ec6a3413b4fd338.tar.gz
selftest: wic: explicitly specify output directory
wic started to use current directory as a default output dir. Specified output directory in wic command line to make tests more predictable and easier to maintain. (From OE-Core rev: 0f205aed90edd90fcba0a565a6cadfe96339b410) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/selftest/wic.py72
1 files changed, 42 insertions, 30 deletions
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index b279b8ccb7..355a69ca1c 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -36,8 +36,8 @@ from oeqa.utils.decorators import testcase
36class Wic(oeSelfTest): 36class Wic(oeSelfTest):
37 """Wic test class.""" 37 """Wic test class."""
38 38
39 resultdir = "/var/tmp/wic/build/"
40 alternate_resultdir = "/var/tmp/wic/build/alt/" 39 alternate_resultdir = "/var/tmp/wic/build/alt/"
40 resultdir = "/var/tmp/wic.oe-selftest/"
41 image_is_ready = False 41 image_is_ready = False
42 wicenv_cache = {} 42 wicenv_cache = {}
43 43
@@ -56,6 +56,10 @@ class Wic(oeSelfTest):
56 56
57 rmtree(self.resultdir, ignore_errors=True) 57 rmtree(self.resultdir, ignore_errors=True)
58 58
59 def tearDownLocal(self):
60 """Remove resultdir as it may contain images."""
61 rmtree(self.resultdir, ignore_errors=True)
62
59 @testcase(1552) 63 @testcase(1552)
60 def test_version(self): 64 def test_version(self):
61 """Test wic --version""" 65 """Test wic --version"""
@@ -134,14 +138,14 @@ class Wic(oeSelfTest):
134 @testcase(1211) 138 @testcase(1211)
135 def test_build_image_name(self): 139 def test_build_image_name(self):
136 """Test wic create directdisk --image-name=core-image-minimal""" 140 """Test wic create directdisk --image-name=core-image-minimal"""
137 cmd = "wic create directdisk --image-name=core-image-minimal" 141 cmd = "wic create directdisk --image-name=core-image-minimal -o %s" % self.resultdir
138 self.assertEqual(0, runCmd(cmd).status) 142 self.assertEqual(0, runCmd(cmd).status)
139 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) 143 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
140 144
141 @testcase(1157) 145 @testcase(1157)
142 def test_gpt_image(self): 146 def test_gpt_image(self):
143 """Test creation of core-image-minimal with gpt table and UUID boot""" 147 """Test creation of core-image-minimal with gpt table and UUID boot"""
144 cmd = "wic create directdisk-gpt --image-name core-image-minimal" 148 cmd = "wic create directdisk-gpt --image-name core-image-minimal -o %s" % self.resultdir
145 self.assertEqual(0, runCmd(cmd).status) 149 self.assertEqual(0, runCmd(cmd).status)
146 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) 150 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
147 151
@@ -152,7 +156,7 @@ class Wic(oeSelfTest):
152 self.append_config(config) 156 self.append_config(config)
153 bitbake('core-image-minimal') 157 bitbake('core-image-minimal')
154 self.remove_config(config) 158 self.remove_config(config)
155 cmd = "wic create mkhybridiso --image-name core-image-minimal" 159 cmd = "wic create mkhybridiso --image-name core-image-minimal -o %s" % self.resultdir
156 self.assertEqual(0, runCmd(cmd).status) 160 self.assertEqual(0, runCmd(cmd).status)
157 self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.direct"))) 161 self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.direct")))
158 self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.iso"))) 162 self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.iso")))
@@ -160,21 +164,21 @@ class Wic(oeSelfTest):
160 @testcase(1348) 164 @testcase(1348)
161 def test_qemux86_directdisk(self): 165 def test_qemux86_directdisk(self):
162 """Test creation of qemux-86-directdisk image""" 166 """Test creation of qemux-86-directdisk image"""
163 cmd = "wic create qemux86-directdisk -e core-image-minimal" 167 cmd = "wic create qemux86-directdisk -e core-image-minimal -o %s" % self.resultdir
164 self.assertEqual(0, runCmd(cmd).status) 168 self.assertEqual(0, runCmd(cmd).status)
165 self.assertEqual(1, len(glob(self.resultdir + "qemux86-directdisk-*direct"))) 169 self.assertEqual(1, len(glob(self.resultdir + "qemux86-directdisk-*direct")))
166 170
167 @testcase(1350) 171 @testcase(1350)
168 def test_mkefidisk(self): 172 def test_mkefidisk(self):
169 """Test creation of mkefidisk image""" 173 """Test creation of mkefidisk image"""
170 cmd = "wic create mkefidisk -e core-image-minimal" 174 cmd = "wic create mkefidisk -e core-image-minimal -o %s" % self.resultdir
171 self.assertEqual(0, runCmd(cmd).status) 175 self.assertEqual(0, runCmd(cmd).status)
172 self.assertEqual(1, len(glob(self.resultdir + "mkefidisk-*direct"))) 176 self.assertEqual(1, len(glob(self.resultdir + "mkefidisk-*direct")))
173 177
174 @testcase(1385) 178 @testcase(1385)
175 def test_directdisk_bootloader_config(self): 179 def test_directdisk_bootloader_config(self):
176 """Test creation of directdisk-bootloader-config image""" 180 """Test creation of directdisk-bootloader-config image"""
177 cmd = "wic create directdisk-bootloader-config -e core-image-minimal" 181 cmd = "wic create directdisk-bootloader-config -e core-image-minimal -o %s" % self.resultdir
178 self.assertEqual(0, runCmd(cmd).status) 182 self.assertEqual(0, runCmd(cmd).status)
179 self.assertEqual(1, len(glob(self.resultdir + "directdisk-bootloader-config-*direct"))) 183 self.assertEqual(1, len(glob(self.resultdir + "directdisk-bootloader-config-*direct")))
180 184
@@ -185,14 +189,14 @@ class Wic(oeSelfTest):
185 self.append_config(config) 189 self.append_config(config)
186 bitbake('core-image-minimal') 190 bitbake('core-image-minimal')
187 self.remove_config(config) 191 self.remove_config(config)
188 cmd = "wic create systemd-bootdisk -e core-image-minimal" 192 cmd = "wic create systemd-bootdisk -e core-image-minimal -o %s" % self.resultdir
189 self.assertEqual(0, runCmd(cmd).status) 193 self.assertEqual(0, runCmd(cmd).status)
190 self.assertEqual(1, len(glob(self.resultdir + "systemd-bootdisk-*direct"))) 194 self.assertEqual(1, len(glob(self.resultdir + "systemd-bootdisk-*direct")))
191 195
192 @testcase(1561) 196 @testcase(1561)
193 def test_sdimage_bootpart(self): 197 def test_sdimage_bootpart(self):
194 """Test creation of sdimage-bootpart image""" 198 """Test creation of sdimage-bootpart image"""
195 cmd = "wic create sdimage-bootpart -e core-image-minimal" 199 cmd = "wic create sdimage-bootpart -e core-image-minimal -o %s" % self.resultdir
196 self.write_config('IMAGE_BOOT_FILES = "bzImage"\n') 200 self.write_config('IMAGE_BOOT_FILES = "bzImage"\n')
197 self.assertEqual(0, runCmd(cmd).status) 201 self.assertEqual(0, runCmd(cmd).status)
198 self.assertEqual(1, len(glob(self.resultdir + "sdimage-bootpart-*direct"))) 202 self.assertEqual(1, len(glob(self.resultdir + "sdimage-bootpart-*direct")))
@@ -219,11 +223,13 @@ class Wic(oeSelfTest):
219 bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) 223 bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal'))
220 for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS')) 224 for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'))
221 bbvars['recipe_sysroot_native'] = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') 225 bbvars['recipe_sysroot_native'] = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
226 bbvars['resultdir'] = self.resultdir
222 status = runCmd("wic create directdisk " 227 status = runCmd("wic create directdisk "
223 "-b %(staging_datadir)s " 228 "-b %(staging_datadir)s "
224 "-k %(deploy_dir_image)s " 229 "-k %(deploy_dir_image)s "
225 "-n %(recipe_sysroot_native)s " 230 "-n %(recipe_sysroot_native)s "
226 "-r %(image_rootfs)s" % bbvars).status 231 "-r %(image_rootfs)s "
232 "-o %(resultdir)s" % bbvars).status
227 self.assertEqual(0, status) 233 self.assertEqual(0, status)
228 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) 234 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
229 235
@@ -232,7 +238,7 @@ class Wic(oeSelfTest):
232 """Test compressing an image with gzip""" 238 """Test compressing an image with gzip"""
233 self.assertEqual(0, runCmd("wic create directdisk " 239 self.assertEqual(0, runCmd("wic create directdisk "
234 "--image-name core-image-minimal " 240 "--image-name core-image-minimal "
235 "-c gzip").status) 241 "-c gzip -o %s" % self.resultdir).status)
236 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct.gz"))) 242 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct.gz")))
237 243
238 @testcase(1265) 244 @testcase(1265)
@@ -240,7 +246,7 @@ class Wic(oeSelfTest):
240 """Test compressing an image with bzip2""" 246 """Test compressing an image with bzip2"""
241 self.assertEqual(0, runCmd("wic create directdisk " 247 self.assertEqual(0, runCmd("wic create directdisk "
242 "--image-name=core-image-minimal " 248 "--image-name=core-image-minimal "
243 "-c bzip2").status) 249 "-c bzip2 -o %s" % self.resultdir).status)
244 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct.bz2"))) 250 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct.bz2")))
245 251
246 @testcase(1266) 252 @testcase(1266)
@@ -248,7 +254,7 @@ class Wic(oeSelfTest):
248 """Test compressing an image with xz""" 254 """Test compressing an image with xz"""
249 self.assertEqual(0, runCmd("wic create directdisk " 255 self.assertEqual(0, runCmd("wic create directdisk "
250 "--image-name=core-image-minimal " 256 "--image-name=core-image-minimal "
251 "--compress-with=xz").status) 257 "--compress-with=xz -o %s" % self.resultdir).status)
252 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct.xz"))) 258 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct.xz")))
253 259
254 @testcase(1267) 260 @testcase(1267)
@@ -256,21 +262,22 @@ class Wic(oeSelfTest):
256 """Test how wic breaks if wrong compressor is provided""" 262 """Test how wic breaks if wrong compressor is provided"""
257 self.assertEqual(2, runCmd("wic create directdisk " 263 self.assertEqual(2, runCmd("wic create directdisk "
258 "--image-name=core-image-minimal " 264 "--image-name=core-image-minimal "
259 "-c wrong", ignore_status=True).status) 265 "-c wrong -o %s" % self.resultdir,
266 ignore_status=True).status)
260 267
261 @testcase(1558) 268 @testcase(1558)
262 def test_debug_short(self): 269 def test_debug_short(self):
263 """Test -D option""" 270 """Test -D option"""
264 self.assertEqual(0, runCmd("wic create directdisk " 271 self.assertEqual(0, runCmd("wic create directdisk "
265 "--image-name=core-image-minimal " 272 "--image-name=core-image-minimal "
266 "-D").status) 273 "-D -o %s" % self.resultdir).status)
267 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) 274 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
268 275
269 def test_debug_long(self): 276 def test_debug_long(self):
270 """Test --debug option""" 277 """Test --debug option"""
271 self.assertEqual(0, runCmd("wic create directdisk " 278 self.assertEqual(0, runCmd("wic create directdisk "
272 "--image-name=core-image-minimal " 279 "--image-name=core-image-minimal "
273 "--debug").status) 280 "--debug -o %s" % self.resultdir).status)
274 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) 281 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
275 282
276 @testcase(1563) 283 @testcase(1563)
@@ -278,11 +285,12 @@ class Wic(oeSelfTest):
278 """Test skip build check""" 285 """Test skip build check"""
279 self.assertEqual(0, runCmd("wic create directdisk " 286 self.assertEqual(0, runCmd("wic create directdisk "
280 "--image-name=core-image-minimal " 287 "--image-name=core-image-minimal "
281 "-s").status) 288 "-s -o %s" % self.resultdir).status)
282 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) 289 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
283 self.assertEqual(0, runCmd("wic create directdisk " 290 self.assertEqual(0, runCmd("wic create directdisk "
284 "--image-name=core-image-minimal " 291 "--image-name=core-image-minimal "
285 "--skip-build-check").status) 292 "--skip-build-check "
293 "--outdir %s" % self.resultdir).status)
286 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) 294 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
287 295
288 @testcase(1564) 296 @testcase(1564)
@@ -290,11 +298,12 @@ class Wic(oeSelfTest):
290 """Test build rootfs""" 298 """Test build rootfs"""
291 self.assertEqual(0, runCmd("wic create directdisk " 299 self.assertEqual(0, runCmd("wic create directdisk "
292 "--image-name=core-image-minimal " 300 "--image-name=core-image-minimal "
293 "-f").status) 301 "-f -o %s" % self.resultdir).status)
294 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) 302 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
295 self.assertEqual(0, runCmd("wic create directdisk " 303 self.assertEqual(0, runCmd("wic create directdisk "
296 "--image-name=core-image-minimal " 304 "--image-name=core-image-minimal "
297 "--build-rootfs").status) 305 "--build-rootfs "
306 "--outdir %s" % self.resultdir).status)
298 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) 307 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
299 308
300 @testcase(1268) 309 @testcase(1268)
@@ -303,7 +312,8 @@ class Wic(oeSelfTest):
303 status = runCmd("wic create directdisk-multi-rootfs " 312 status = runCmd("wic create directdisk-multi-rootfs "
304 "--image-name=core-image-minimal " 313 "--image-name=core-image-minimal "
305 "--rootfs rootfs1=core-image-minimal " 314 "--rootfs rootfs1=core-image-minimal "
306 "--rootfs rootfs2=core-image-minimal").status 315 "--rootfs rootfs2=core-image-minimal "
316 "--outdir %s" % self.resultdir).status
307 self.assertEqual(0, status) 317 self.assertEqual(0, status)
308 self.assertEqual(1, len(glob(self.resultdir + "directdisk-multi-rootfs*.direct"))) 318 self.assertEqual(1, len(glob(self.resultdir + "directdisk-multi-rootfs*.direct")))
309 319
@@ -314,25 +324,27 @@ class Wic(oeSelfTest):
314 for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS')) 324 for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'))
315 bbvars['recipe_sysroot_native'] = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') 325 bbvars['recipe_sysroot_native'] = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
316 bbvars['wks'] = "directdisk-multi-rootfs" 326 bbvars['wks'] = "directdisk-multi-rootfs"
327 bbvars['resultdir'] = self.resultdir
317 status = runCmd("wic create %(wks)s " 328 status = runCmd("wic create %(wks)s "
318 "--bootimg-dir=%(staging_datadir)s " 329 "--bootimg-dir=%(staging_datadir)s "
319 "--kernel-dir=%(deploy_dir_image)s " 330 "--kernel-dir=%(deploy_dir_image)s "
320 "--native-sysroot=%(recipe_sysroot_native)s " 331 "--native-sysroot=%(recipe_sysroot_native)s "
321 "--rootfs-dir rootfs1=%(image_rootfs)s " 332 "--rootfs-dir rootfs1=%(image_rootfs)s "
322 "--rootfs-dir rootfs2=%(image_rootfs)s" 333 "--rootfs-dir rootfs2=%(image_rootfs)s "
323 % bbvars).status 334 "--outdir %(resultdir)s" % bbvars).status
324 self.assertEqual(0, status) 335 self.assertEqual(0, status)
325 self.assertEqual(1, len(glob(self.resultdir + "%(wks)s-*.direct" % bbvars))) 336 self.assertEqual(1, len(glob(self.resultdir + "%(wks)s-*.direct" % bbvars)))
326 337
327 @testcase(1496) 338 @testcase(1496)
328 def test_bmap(self): 339 def test_bmap(self):
329 """Test generation of .bmap file""" 340 """Test generation of .bmap file"""
330 cmd = "wic create directdisk -e core-image-minimal -m" 341 cmd = "wic create directdisk -e core-image-minimal -m -o %s" % self.resultdir
331 status = runCmd(cmd).status 342 status = runCmd(cmd).status
332 self.assertEqual(0, status) 343 self.assertEqual(0, status)
333 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*direct"))) 344 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*direct")))
334 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*direct.bmap"))) 345 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*direct.bmap")))
335 cmd = "wic create directdisk -e core-image-minimal --bmap" 346 rmtree(self.resultdir)
347 cmd = "wic create directdisk -e core-image-minimal --bmap -o %s" % self.resultdir
336 status = runCmd(cmd).status 348 status = runCmd(cmd).status
337 self.assertEqual(0, status) 349 self.assertEqual(0, status)
338 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*direct"))) 350 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*direct")))
@@ -375,13 +387,13 @@ class Wic(oeSelfTest):
375 imgenvdir = self._get_image_env_path(image) 387 imgenvdir = self._get_image_env_path(image)
376 388
377 self.assertEqual(0, runCmd("wic create directdisk " 389 self.assertEqual(0, runCmd("wic create directdisk "
378 "--image-name=%s " 390 "--image-name=%s -v %s -o %s"
379 "-v %s" 391 % (image, imgenvdir, self.resultdir)).status)
380 % (image, imgenvdir)).status)
381 self.assertEqual(0, runCmd("wic create directdisk " 392 self.assertEqual(0, runCmd("wic create directdisk "
382 "--image-name=%s " 393 "--image-name=%s "
383 "--vars %s" 394 "--vars %s "
384 % (image, imgenvdir)).status) 395 "--outdir %s"
396 % (image, imgenvdir, self.resultdir)).status)
385 397
386 @testcase(1351) 398 @testcase(1351)
387 def test_wic_image_type(self): 399 def test_wic_image_type(self):