[gnome-continuous-yocto/gnomeostree-3.28-rocko: 4367/8267] selftest: wic: explicitly specify output directory
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 4367/8267] selftest: wic: explicitly specify output directory
- Date: Sun, 17 Dec 2017 01:56:14 +0000 (UTC)
commit 3f21101e727c605443f06d5d2ec6a3413b4fd338
Author: Ed Bartosh <ed bartosh linux intel com>
Date: Tue Jan 24 15:43:55 2017 +0200
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>
meta/lib/oeqa/selftest/wic.py | 72 ++++++++++++++++++++++++-----------------
1 files changed, 42 insertions(+), 30 deletions(-)
---
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index b279b8c..355a69c 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
class Wic(oeSelfTest):
"""Wic test class."""
- resultdir = "/var/tmp/wic/build/"
alternate_resultdir = "/var/tmp/wic/build/alt/"
+ resultdir = "/var/tmp/wic.oe-selftest/"
image_is_ready = False
wicenv_cache = {}
@@ -56,6 +56,10 @@ class Wic(oeSelfTest):
rmtree(self.resultdir, ignore_errors=True)
+ def tearDownLocal(self):
+ """Remove resultdir as it may contain images."""
+ rmtree(self.resultdir, ignore_errors=True)
+
@testcase(1552)
def test_version(self):
"""Test wic --version"""
@@ -134,14 +138,14 @@ class Wic(oeSelfTest):
@testcase(1211)
def test_build_image_name(self):
"""Test wic create directdisk --image-name=core-image-minimal"""
- cmd = "wic create directdisk --image-name=core-image-minimal"
+ cmd = "wic create directdisk --image-name=core-image-minimal -o %s" % self.resultdir
self.assertEqual(0, runCmd(cmd).status)
self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
@testcase(1157)
def test_gpt_image(self):
"""Test creation of core-image-minimal with gpt table and UUID boot"""
- cmd = "wic create directdisk-gpt --image-name core-image-minimal"
+ cmd = "wic create directdisk-gpt --image-name core-image-minimal -o %s" % self.resultdir
self.assertEqual(0, runCmd(cmd).status)
self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
@@ -152,7 +156,7 @@ class Wic(oeSelfTest):
self.append_config(config)
bitbake('core-image-minimal')
self.remove_config(config)
- cmd = "wic create mkhybridiso --image-name core-image-minimal"
+ cmd = "wic create mkhybridiso --image-name core-image-minimal -o %s" % self.resultdir
self.assertEqual(0, runCmd(cmd).status)
self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.direct")))
self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.iso")))
@@ -160,21 +164,21 @@ class Wic(oeSelfTest):
@testcase(1348)
def test_qemux86_directdisk(self):
"""Test creation of qemux-86-directdisk image"""
- cmd = "wic create qemux86-directdisk -e core-image-minimal"
+ cmd = "wic create qemux86-directdisk -e core-image-minimal -o %s" % self.resultdir
self.assertEqual(0, runCmd(cmd).status)
self.assertEqual(1, len(glob(self.resultdir + "qemux86-directdisk-*direct")))
@testcase(1350)
def test_mkefidisk(self):
"""Test creation of mkefidisk image"""
- cmd = "wic create mkefidisk -e core-image-minimal"
+ cmd = "wic create mkefidisk -e core-image-minimal -o %s" % self.resultdir
self.assertEqual(0, runCmd(cmd).status)
self.assertEqual(1, len(glob(self.resultdir + "mkefidisk-*direct")))
@testcase(1385)
def test_directdisk_bootloader_config(self):
"""Test creation of directdisk-bootloader-config image"""
- cmd = "wic create directdisk-bootloader-config -e core-image-minimal"
+ cmd = "wic create directdisk-bootloader-config -e core-image-minimal -o %s" % self.resultdir
self.assertEqual(0, runCmd(cmd).status)
self.assertEqual(1, len(glob(self.resultdir + "directdisk-bootloader-config-*direct")))
@@ -185,14 +189,14 @@ class Wic(oeSelfTest):
self.append_config(config)
bitbake('core-image-minimal')
self.remove_config(config)
- cmd = "wic create systemd-bootdisk -e core-image-minimal"
+ cmd = "wic create systemd-bootdisk -e core-image-minimal -o %s" % self.resultdir
self.assertEqual(0, runCmd(cmd).status)
self.assertEqual(1, len(glob(self.resultdir + "systemd-bootdisk-*direct")))
@testcase(1561)
def test_sdimage_bootpart(self):
"""Test creation of sdimage-bootpart image"""
- cmd = "wic create sdimage-bootpart -e core-image-minimal"
+ cmd = "wic create sdimage-bootpart -e core-image-minimal -o %s" % self.resultdir
self.write_config('IMAGE_BOOT_FILES = "bzImage"\n')
self.assertEqual(0, runCmd(cmd).status)
self.assertEqual(1, len(glob(self.resultdir + "sdimage-bootpart-*direct")))
@@ -219,11 +223,13 @@ class Wic(oeSelfTest):
bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal'))
for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'))
bbvars['recipe_sysroot_native'] = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
+ bbvars['resultdir'] = self.resultdir
status = runCmd("wic create directdisk "
"-b %(staging_datadir)s "
"-k %(deploy_dir_image)s "
"-n %(recipe_sysroot_native)s "
- "-r %(image_rootfs)s" % bbvars).status
+ "-r %(image_rootfs)s "
+ "-o %(resultdir)s" % bbvars).status
self.assertEqual(0, status)
self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
@@ -232,7 +238,7 @@ class Wic(oeSelfTest):
"""Test compressing an image with gzip"""
self.assertEqual(0, runCmd("wic create directdisk "
"--image-name core-image-minimal "
- "-c gzip").status)
+ "-c gzip -o %s" % self.resultdir).status)
self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct.gz")))
@testcase(1265)
@@ -240,7 +246,7 @@ class Wic(oeSelfTest):
"""Test compressing an image with bzip2"""
self.assertEqual(0, runCmd("wic create directdisk "
"--image-name=core-image-minimal "
- "-c bzip2").status)
+ "-c bzip2 -o %s" % self.resultdir).status)
self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct.bz2")))
@testcase(1266)
@@ -248,7 +254,7 @@ class Wic(oeSelfTest):
"""Test compressing an image with xz"""
self.assertEqual(0, runCmd("wic create directdisk "
"--image-name=core-image-minimal "
- "--compress-with=xz").status)
+ "--compress-with=xz -o %s" % self.resultdir).status)
self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct.xz")))
@testcase(1267)
@@ -256,21 +262,22 @@ class Wic(oeSelfTest):
"""Test how wic breaks if wrong compressor is provided"""
self.assertEqual(2, runCmd("wic create directdisk "
"--image-name=core-image-minimal "
- "-c wrong", ignore_status=True).status)
+ "-c wrong -o %s" % self.resultdir,
+ ignore_status=True).status)
@testcase(1558)
def test_debug_short(self):
"""Test -D option"""
self.assertEqual(0, runCmd("wic create directdisk "
"--image-name=core-image-minimal "
- "-D").status)
+ "-D -o %s" % self.resultdir).status)
self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
def test_debug_long(self):
"""Test --debug option"""
self.assertEqual(0, runCmd("wic create directdisk "
"--image-name=core-image-minimal "
- "--debug").status)
+ "--debug -o %s" % self.resultdir).status)
self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
@testcase(1563)
@@ -278,11 +285,12 @@ class Wic(oeSelfTest):
"""Test skip build check"""
self.assertEqual(0, runCmd("wic create directdisk "
"--image-name=core-image-minimal "
- "-s").status)
+ "-s -o %s" % self.resultdir).status)
self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
self.assertEqual(0, runCmd("wic create directdisk "
"--image-name=core-image-minimal "
- "--skip-build-check").status)
+ "--skip-build-check "
+ "--outdir %s" % self.resultdir).status)
self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
@testcase(1564)
@@ -290,11 +298,12 @@ class Wic(oeSelfTest):
"""Test build rootfs"""
self.assertEqual(0, runCmd("wic create directdisk "
"--image-name=core-image-minimal "
- "-f").status)
+ "-f -o %s" % self.resultdir).status)
self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
self.assertEqual(0, runCmd("wic create directdisk "
"--image-name=core-image-minimal "
- "--build-rootfs").status)
+ "--build-rootfs "
+ "--outdir %s" % self.resultdir).status)
self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
@testcase(1268)
@@ -303,7 +312,8 @@ class Wic(oeSelfTest):
status = runCmd("wic create directdisk-multi-rootfs "
"--image-name=core-image-minimal "
"--rootfs rootfs1=core-image-minimal "
- "--rootfs rootfs2=core-image-minimal").status
+ "--rootfs rootfs2=core-image-minimal "
+ "--outdir %s" % self.resultdir).status
self.assertEqual(0, status)
self.assertEqual(1, len(glob(self.resultdir + "directdisk-multi-rootfs*.direct")))
@@ -314,25 +324,27 @@ class Wic(oeSelfTest):
for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'))
bbvars['recipe_sysroot_native'] = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools')
bbvars['wks'] = "directdisk-multi-rootfs"
+ bbvars['resultdir'] = self.resultdir
status = runCmd("wic create %(wks)s "
"--bootimg-dir=%(staging_datadir)s "
"--kernel-dir=%(deploy_dir_image)s "
"--native-sysroot=%(recipe_sysroot_native)s "
"--rootfs-dir rootfs1=%(image_rootfs)s "
- "--rootfs-dir rootfs2=%(image_rootfs)s"
- % bbvars).status
+ "--rootfs-dir rootfs2=%(image_rootfs)s "
+ "--outdir %(resultdir)s" % bbvars).status
self.assertEqual(0, status)
self.assertEqual(1, len(glob(self.resultdir + "%(wks)s-*.direct" % bbvars)))
@testcase(1496)
def test_bmap(self):
"""Test generation of .bmap file"""
- cmd = "wic create directdisk -e core-image-minimal -m"
+ cmd = "wic create directdisk -e core-image-minimal -m -o %s" % self.resultdir
status = runCmd(cmd).status
self.assertEqual(0, status)
self.assertEqual(1, len(glob(self.resultdir + "directdisk-*direct")))
self.assertEqual(1, len(glob(self.resultdir + "directdisk-*direct.bmap")))
- cmd = "wic create directdisk -e core-image-minimal --bmap"
+ rmtree(self.resultdir)
+ cmd = "wic create directdisk -e core-image-minimal --bmap -o %s" % self.resultdir
status = runCmd(cmd).status
self.assertEqual(0, status)
self.assertEqual(1, len(glob(self.resultdir + "directdisk-*direct")))
@@ -375,13 +387,13 @@ class Wic(oeSelfTest):
imgenvdir = self._get_image_env_path(image)
self.assertEqual(0, runCmd("wic create directdisk "
- "--image-name=%s "
- "-v %s"
- % (image, imgenvdir)).status)
+ "--image-name=%s -v %s -o %s"
+ % (image, imgenvdir, self.resultdir)).status)
self.assertEqual(0, runCmd("wic create directdisk "
"--image-name=%s "
- "--vars %s"
- % (image, imgenvdir)).status)
+ "--vars %s "
+ "--outdir %s"
+ % (image, imgenvdir, self.resultdir)).status)
@testcase(1351)
def test_wic_image_type(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]