All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/6] wic: bugfixes & --fixed-size support, tests, oe-selftest: minor fixes
@ 2016-11-24  7:08 Maciej Borzecki
       [not found] ` <cover.1479971185.git.maciej.borzecki@rndity.com>
  2016-12-13  8:07 ` [PATCH v5 0/6] wic: bugfixes & --fixed-size support, tests, oe-selftest: minor fixes Maciej Borzęcki
  0 siblings, 2 replies; 20+ messages in thread
From: Maciej Borzecki @ 2016-11-24  7:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Eggleton, Maciej Borzecki

v5 of a patch series previously posted here [1].

Changes since v4:

* dropped `wic: selftest: do not repeat core-image-minimal` & rebased
  dependant patches

* minor formatting fix in `wic: selftest: add tests for --fixed-size
  partition flags`

[1]. http://lists.openembedded.org/pipermail/openembedded-core/2016-November/129103.html

Maciej Borzecki (6):
  oe-selftest: enforce en_US.UTF-8 locale
  oeqa/utils/commands.py: allow use of binaries from native sysroot
  wic: add --fixed-size wks option
  wic: selftest: avoid COMPATIBLE_HOST issues
  wic: selftest: do not assume bzImage kernel image
  wic: selftest: add tests for --fixed-size partition flags

 meta/lib/oeqa/selftest/wic.py          | 123 +++++++++++++++++++++++++++++++--
 meta/lib/oeqa/utils/commands.py        |   9 ++-
 scripts/lib/wic/help.py                |  14 +++-
 scripts/lib/wic/imager/direct.py       |   2 +-
 scripts/lib/wic/ksparser.py            |  41 +++++++++--
 scripts/lib/wic/partition.py           |  88 ++++++++++++++---------
 scripts/lib/wic/utils/partitionedfs.py |   2 +-
 scripts/oe-selftest                    |   3 +
 8 files changed, 234 insertions(+), 48 deletions(-)

-- 
2.5.0



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v5 1/6] oe-selftest: enforce en_US.UTF-8 locale
       [not found] ` <cover.1479971185.git.maciej.borzecki@rndity.com>
@ 2016-11-24  7:08   ` Maciej Borzecki
  2016-11-24  7:08   ` [PATCH v5 2/6] oeqa/utils/commands.py: allow use of binaries from native sysroot Maciej Borzecki
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 20+ messages in thread
From: Maciej Borzecki @ 2016-11-24  7:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Eggleton, Maciej Borzecki

Replicate bitbake and eforce en_US.UTF-8 locale so that ouptut of locale-aware
tools remains stable.

Signed-off-by: Maciej Birzecki <maciej.borzecki@rndity.com>
Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com>
---
 scripts/oe-selftest | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/scripts/oe-selftest b/scripts/oe-selftest
index c3215ea6592e128d17da550d778272985f5bd1a6..deaa4324cc888ea261687f90f83e8759c4436a15 100755
--- a/scripts/oe-selftest
+++ b/scripts/oe-selftest
@@ -468,6 +468,9 @@ def main():
     sys.path.extend(layer_libdirs)
     imp.reload(oeqa.selftest)
 
+    # act like bitbake and enforce en_US.UTF-8 locale
+    os.environ["LC_ALL"] = "en_US.UTF-8"
+
     if args.run_tests_by and len(args.run_tests_by) >= 2:
         valid_options = ['name', 'class', 'module', 'id', 'tag']
         if args.run_tests_by[0] not in valid_options:
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 2/6] oeqa/utils/commands.py: allow use of binaries from native sysroot
       [not found] ` <cover.1479971185.git.maciej.borzecki@rndity.com>
  2016-11-24  7:08   ` [PATCH v5 1/6] oe-selftest: enforce en_US.UTF-8 locale Maciej Borzecki
@ 2016-11-24  7:08   ` Maciej Borzecki
  2016-11-24  7:08   ` [PATCH v5 3/6] wic: add --fixed-size wks option Maciej Borzecki
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 20+ messages in thread
From: Maciej Borzecki @ 2016-11-24  7:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Eggleton, Maciej Borzecki

Tests may need to run a native tool that is not available on the host
filesystem, but can be built using one of the *-native recipes. In such case,
the tool will be available in native sysroot, and running in from that location
will require adjustments to PATH.

runCmd() can now take a path to native sysroot as one of its arguments and
setup PATH accordingly.

Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com>
---
 meta/lib/oeqa/utils/commands.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 5cd0f7477baa5bb45f2b2b5b93fb1ff0efd02923..657c9dba34ea9d42aa416f3b889f4b04129e8da9 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -97,9 +97,16 @@ class Result(object):
     pass
 
 
-def runCmd(command, ignore_status=False, timeout=None, assert_error=True, **options):
+def runCmd(command, ignore_status=False, timeout=None, assert_error=True, native_sysroot=None, **options):
     result = Result()
 
+    if native_sysroot:
+        extra_paths = "%s/sbin:%s/usr/sbin:%s/usr/bin" % \
+                      (native_sysroot, native_sysroot, native_sysroot)
+        nenv = dict(options.get('env', os.environ))
+        nenv['PATH'] = extra_paths + ':' + nenv.get('PATH', '')
+        options['env'] = nenv
+
     cmd = Command(command, timeout=timeout, **options)
     cmd.run()
 
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 3/6] wic: add --fixed-size wks option
       [not found] ` <cover.1479971185.git.maciej.borzecki@rndity.com>
  2016-11-24  7:08   ` [PATCH v5 1/6] oe-selftest: enforce en_US.UTF-8 locale Maciej Borzecki
  2016-11-24  7:08   ` [PATCH v5 2/6] oeqa/utils/commands.py: allow use of binaries from native sysroot Maciej Borzecki
@ 2016-11-24  7:08   ` Maciej Borzecki
  2016-11-24  7:08   ` [PATCH v5 4/6] wic: selftest: avoid COMPATIBLE_HOST issues Maciej Borzecki
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 20+ messages in thread
From: Maciej Borzecki @ 2016-11-24  7:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Eggleton, Maciej Borzecki

Added new option --fixed-size to wks. The option can be used to indicate
the exact size of a partition. The option cannot be added together with
--size, in which case an error will be raised. Other options that
influence automatic partition size (--extra-space, --overhead-factor),
if specifiec along with --fixed-size, will raise an error.

If it partition data is larger than the amount of space specified with
--fixed-size option wic will raise an error.

Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com>
---
 scripts/lib/wic/help.py                | 14 ++++--
 scripts/lib/wic/imager/direct.py       |  2 +-
 scripts/lib/wic/ksparser.py            | 41 ++++++++++++++--
 scripts/lib/wic/partition.py           | 88 +++++++++++++++++++++-------------
 scripts/lib/wic/utils/partitionedfs.py |  2 +-
 5 files changed, 105 insertions(+), 42 deletions(-)

diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
index e5347ec4b7c900c68fc64351a5293e75de0672b3..daa11bf489c135627ddfe4cef968e48f8e3ad1d8 100644
--- a/scripts/lib/wic/help.py
+++ b/scripts/lib/wic/help.py
@@ -646,6 +646,12 @@ DESCRIPTION
                  not specified, the size is in MB.
                  You do not need this option if you use --source.
 
+         --fixed-size: Exact partition size. Value format is the same
+                       as for --size option. This option cannot be
+                       specified along with --size. If partition data
+                       is larger than --fixed-size and error will be
+                       raised when assembling disk image.
+
          --source: This option is a wic-specific option that names the
                    source of the data that will populate the
                    partition.  The most common value for this option
@@ -719,13 +725,15 @@ DESCRIPTION
                         space after the space filled by the content
                         of the partition. The final size can go
                         beyond the size specified by --size.
-                        By default, 10MB.
+                        By default, 10MB. This option cannot be used
+                        with --fixed-size option.
 
          --overhead-factor: This option is specific to wic. The
                             size of the partition is multiplied by
                             this factor. It has to be greater than or
-                            equal to 1.
-                            The default value is 1.3.
+                            equal to 1. The default value is 1.3.
+                            This option cannot be used with --fixed-size
+                            option.
 
          --part-type: This option is specific to wic. It specifies partition
                       type GUID for GPT partitions.
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py
index 2bedef08d6450096c786def6f75a9ee53fcd4b3b..11ec15e33f65885618c7adc83e55c6a39fedbe99 100644
--- a/scripts/lib/wic/imager/direct.py
+++ b/scripts/lib/wic/imager/direct.py
@@ -290,7 +290,7 @@ class DirectImageCreator(BaseImageCreator):
                          self.bootimg_dir, self.kernel_dir, self.native_sysroot)
 
 
-            self.__image.add_partition(int(part.size),
+            self.__image.add_partition(part.disk_size,
                                        part.disk,
                                        part.mountpoint,
                                        part.source_file,
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 0894e2b199a299fbbed272f2e1c95e9d692e3ab1..62c490274aa92bf82aac304d9323250e3b728d0c 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -113,6 +113,9 @@ def systemidtype(arg):
 class KickStart():
     """"Kickstart parser implementation."""
 
+    DEFAULT_EXTRA_SPACE = 10*1024
+    DEFAULT_OVERHEAD_FACTOR = 1.3
+
     def __init__(self, confpath):
 
         self.partitions = []
@@ -127,16 +130,24 @@ class KickStart():
         part.add_argument('mountpoint', nargs='?')
         part.add_argument('--active', action='store_true')
         part.add_argument('--align', type=int)
-        part.add_argument("--extra-space", type=sizetype, default=10*1024)
+        part.add_argument("--extra-space", type=sizetype)
         part.add_argument('--fsoptions', dest='fsopts')
         part.add_argument('--fstype')
         part.add_argument('--label')
         part.add_argument('--no-table', action='store_true')
         part.add_argument('--ondisk', '--ondrive', dest='disk')
-        part.add_argument("--overhead-factor", type=overheadtype, default=1.3)
+        part.add_argument("--overhead-factor", type=overheadtype)
         part.add_argument('--part-type')
         part.add_argument('--rootfs-dir')
-        part.add_argument('--size', type=sizetype, default=0)
+
+        # --size and --fixed-size cannot be specified together; options
+        # ----extra-space and --overhead-factor should also raise a parser
+        # --error, but since nesting mutually exclusive groups does not work,
+        # ----extra-space/--overhead-factor are handled later
+        sizeexcl = part.add_mutually_exclusive_group()
+        sizeexcl.add_argument('--size', type=sizetype, default=0)
+        sizeexcl.add_argument('--fixed-size', type=sizetype, default=0)
+
         part.add_argument('--source')
         part.add_argument('--sourceparams')
         part.add_argument('--system-id', type=systemidtype)
@@ -170,11 +181,33 @@ class KickStart():
                 lineno += 1
                 if line and line[0] != '#':
                     try:
-                        parsed = parser.parse_args(shlex.split(line))
+                        line_args = shlex.split(line)
+                        parsed = parser.parse_args(line_args)
                     except ArgumentError as err:
                         raise KickStartError('%s:%d: %s' % \
                                              (confpath, lineno, err))
                     if line.startswith('part'):
+                        # using ArgumentParser one cannot easily tell if option
+                        # was passed as argument, if said option has a default
+                        # value; --overhead-factor/--extra-space cannot be used
+                        # with --fixed-size, so at least detect when these were
+                        # passed with non-0 values ...
+                        if parsed.fixed_size:
+                            if parsed.overhead_factor or parsed.extra_space:
+                                err = "%s:%d: arguments --overhead-factor and --extra-space not "\
+                                      "allowed with argument --fixed-size" \
+                                      % (confpath, lineno)
+                                raise KickStartError(err)
+                        else:
+                            # ... and provide defaults if not using
+                            # --fixed-size iff given option was not used
+                            # (again, one cannot tell if option was passed but
+                            # with value equal to 0)
+                            if '--overhead-factor' not in line_args:
+                                parsed.overhead_factor = self.DEFAULT_OVERHEAD_FACTOR
+                            if '--extra-space' not in line_args:
+                                parsed.extra_space = self.DEFAULT_EXTRA_SPACE
+
                         self.partnum += 1
                         self.partitions.append(Partition(parsed, self.partnum))
                     elif line.startswith('include'):
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index ac4c836bdb53300d3a4e4c09926b7b1514b8faf2..8cf966ebc6d07490c44cefc93acbe5868be30ac7 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -54,6 +54,7 @@ class Partition():
         self.part_type = args.part_type
         self.rootfs_dir = args.rootfs_dir
         self.size = args.size
+        self.fixed_size = args.fixed_size
         self.source = args.source
         self.sourceparams = args.sourceparams
         self.system_id = args.system_id
@@ -87,6 +88,41 @@ class Partition():
         else:
             return 0
 
+    def get_rootfs_size(self, actual_rootfs_size=0):
+        """
+        Calculate the required size of rootfs taking into consideration
+        --size/--fixed-size flags as well as overhead and extra space, as
+        specified in kickstart file. Raises an error if the
+        `actual_rootfs_size` is larger than fixed-size rootfs.
+
+        """
+        if self.fixed_size:
+            rootfs_size = self.fixed_size
+            if actual_rootfs_size > rootfs_size:
+                msger.error("Actual rootfs size (%d kB) is larger than allowed size %d kB" \
+                            %(actual_rootfs_size, rootfs_size))
+        else:
+            extra_blocks = self.get_extra_block_count(actual_rootfs_size)
+            if extra_blocks < self.extra_space:
+                extra_blocks = self.extra_space
+
+            rootfs_size = actual_rootfs_size + extra_blocks
+            rootfs_size *= self.overhead_factor
+
+            msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
+                        (extra_blocks, self.mountpoint, rootfs_size))
+
+        return rootfs_size
+
+    @property
+    def disk_size(self):
+        """
+        Obtain on-disk size of partition taking into consideration
+        --size/--fixed-size options.
+
+        """
+        return self.fixed_size if self.fixed_size else self.size
+
     def prepare(self, creator, cr_workdir, oe_builddir, rootfs_dir,
                 bootimg_dir, kernel_dir, native_sysroot):
         """
@@ -97,9 +133,9 @@ class Partition():
             self.sourceparams_dict = parse_sourceparams(self.sourceparams)
 
         if not self.source:
-            if not self.size:
-                msger.error("The %s partition has a size of zero.  Please "
-                            "specify a non-zero --size for that partition." % \
+            if not self.size and not self.fixed_size:
+                msger.error("The %s partition has a size of zero. Please "
+                            "specify a non-zero --size/--fixed-size for that partition." % \
                             self.mountpoint)
             if self.fstype and self.fstype == "swap":
                 self.prepare_swap_partition(cr_workdir, oe_builddir,
@@ -146,6 +182,7 @@ class Partition():
                                                      oe_builddir,
                                                      bootimg_dir, kernel_dir, rootfs_dir,
                                                      native_sysroot)
+
         # further processing required Partition.size to be an integer, make
         # sure that it is one
         if type(self.size) is not int:
@@ -153,6 +190,12 @@ class Partition():
                           "This a bug in source plugin %s and needs to be fixed." \
                           % (self.mountpoint, self.source))
 
+        if self.fixed_size and self.size > self.fixed_size:
+            msger.error("File system image of partition %s is larger (%d kB) than its"\
+                        "allowed size %d kB" % (self.mountpoint,
+                                                self.size, self.fixed_size))
+
+
     def prepare_rootfs_from_fs_image(self, cr_workdir, oe_builddir,
                                      rootfs_dir):
         """
@@ -217,15 +260,7 @@ class Partition():
         out = exec_cmd(du_cmd)
         actual_rootfs_size = int(out.split()[0])
 
-        extra_blocks = self.get_extra_block_count(actual_rootfs_size)
-        if extra_blocks < self.extra_space:
-            extra_blocks = self.extra_space
-
-        rootfs_size = actual_rootfs_size + extra_blocks
-        rootfs_size *= self.overhead_factor
-
-        msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
-                    (extra_blocks, self.mountpoint, rootfs_size))
+        rootfs_size = self.get_rootfs_size(actual_rootfs_size)
 
         with open(rootfs, 'w') as sparse:
             os.ftruncate(sparse.fileno(), rootfs_size * 1024)
@@ -251,15 +286,7 @@ class Partition():
         out = exec_cmd(du_cmd)
         actual_rootfs_size = int(out.split()[0])
 
-        extra_blocks = self.get_extra_block_count(actual_rootfs_size)
-        if extra_blocks < self.extra_space:
-            extra_blocks = self.extra_space
-
-        rootfs_size = actual_rootfs_size + extra_blocks
-        rootfs_size *= self.overhead_factor
-
-        msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
-                    (extra_blocks, self.mountpoint, rootfs_size))
+        rootfs_size = self.get_rootfs_size(actual_rootfs_size)
 
         with open(rootfs, 'w') as sparse:
             os.ftruncate(sparse.fileno(), rootfs_size * 1024)
@@ -281,20 +308,13 @@ class Partition():
         out = exec_cmd(du_cmd)
         blocks = int(out.split()[0])
 
-        extra_blocks = self.get_extra_block_count(blocks)
-        if extra_blocks < self.extra_space:
-            extra_blocks = self.extra_space
-
-        blocks += extra_blocks
-
-        msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
-                    (extra_blocks, self.mountpoint, blocks))
+        rootfs_size = self.get_rootfs_size(blocks)
 
         label_str = "-n boot"
         if self.label:
             label_str = "-n %s" % self.label
 
-        dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, rootfs, blocks)
+        dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, rootfs, rootfs_size)
         exec_native_cmd(dosfs_cmd, native_sysroot)
 
         mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, rootfs_dir)
@@ -317,8 +337,9 @@ class Partition():
         """
         Prepare an empty ext2/3/4 partition.
         """
+        size = self.disk_size
         with open(rootfs, 'w') as sparse:
-            os.ftruncate(sparse.fileno(), self.size * 1024)
+            os.ftruncate(sparse.fileno(), size * 1024)
 
         extra_imagecmd = "-i 8192"
 
@@ -335,8 +356,9 @@ class Partition():
         """
         Prepare an empty btrfs partition.
         """
+        size = self.disk_size
         with open(rootfs, 'w') as sparse:
-            os.ftruncate(sparse.fileno(), self.size * 1024)
+            os.ftruncate(sparse.fileno(), size * 1024)
 
         label_str = ""
         if self.label:
@@ -351,7 +373,7 @@ class Partition():
         """
         Prepare an empty vfat partition.
         """
-        blocks = self.size
+        blocks = self.disk_size
 
         label_str = "-n boot"
         if self.label:
diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py
index 9e76487844eebfffc7227d053a65dc9fdab3678b..cfa5f5ce09b764c1c2a9b7a3f7bf7d677a6811c4 100644
--- a/scripts/lib/wic/utils/partitionedfs.py
+++ b/scripts/lib/wic/utils/partitionedfs.py
@@ -209,7 +209,7 @@ class Image():
             msger.debug("Assigned %s to %s%d, sectors range %d-%d size %d "
                         "sectors (%d bytes)." \
                             % (part['mountpoint'], part['disk_name'], part['num'],
-                               part['start'], part['start'] + part['size'] - 1,
+                               part['start'], disk['offset'] - 1,
                                part['size'], part['size'] * self.sector_size))
 
         # Once all the partitions have been layed out, we can calculate the
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 4/6] wic: selftest: avoid COMPATIBLE_HOST issues
       [not found] ` <cover.1479971185.git.maciej.borzecki@rndity.com>
                     ` (2 preceding siblings ...)
  2016-11-24  7:08   ` [PATCH v5 3/6] wic: add --fixed-size wks option Maciej Borzecki
@ 2016-11-24  7:08   ` Maciej Borzecki
  2016-11-24  7:08   ` [PATCH v5 5/6] wic: selftest: do not assume bzImage kernel image Maciej Borzecki
  2016-11-24  7:08   ` [PATCH v5 6/6] wic: selftest: add tests for --fixed-size partition flags Maciej Borzecki
  5 siblings, 0 replies; 20+ messages in thread
From: Maciej Borzecki @ 2016-11-24  7:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Eggleton, Maciej Borzecki

wic tests will unconditionally attempt to build syslinux and add
configuration options that may not be compatible with current machine.

Resolve this by consulting HOST_ARCH (which defaults to TARGET_ARCH) and build
recipes, add configuration options or skip tests conditionally.

A convenience decorator onlyForArch() can be used to skip test cases for
specific architectures.

Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com>
---
 meta/lib/oeqa/selftest/wic.py | 51 +++++++++++++++++++++++++++++++++++++++----
 1 file changed, 47 insertions(+), 4 deletions(-)

diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index faac11e21643e4c32a83b649b6ae986fead498f1..2db14445956bc5adcf1e755844bbdb69edcb468f 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -24,15 +24,33 @@
 """Test cases for wic."""
 
 import os
+import unittest
 
 from glob import glob
 from shutil import rmtree
+from functools import wraps
 
 from oeqa.selftest.base import oeSelfTest
 from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu
 from oeqa.utils.decorators import testcase
 
 
+class onlyForArch(object):
+
+    def __init__(self, *args):
+        self.archs = args
+
+    def __call__(self,f):
+        @wraps(f)
+        def wrapped_f(*args, **kwargs):
+            arch = get_bb_var('HOST_ARCH', 'core-image-minimal')
+            if self.archs and arch not in self.archs :
+                raise unittest.SkipTest("Testcase arch dependency not met: %s" % arch)
+            return f(*args, **kwargs)
+        wrapped_f.__name__ = f.__name__
+        return wrapped_f
+
+
 class Wic(oeSelfTest):
     """Wic test class."""
 
@@ -41,15 +59,22 @@ class Wic(oeSelfTest):
 
     def setUpLocal(self):
         """This code is executed before each test method."""
-        self.write_config('IMAGE_FSTYPES += " hddimg"\n'
-                          'MACHINE_FEATURES_append = " efi"\n')
+        arch = get_bb_var('HOST_ARCH', 'core-image-minimal')
+        is_x86 = arch in ['i586', 'i686', 'x86_64']
+        if is_x86:
+            self.write_config('IMAGE_FSTYPES += " hddimg"\n' \
+                              'MACHINE_FEATURES_append = " efi"\n')
 
         # Do this here instead of in setUpClass as the base setUp does some
         # clean up which can result in the native tools built earlier in
         # setUpClass being unavailable.
         if not Wic.image_is_ready:
-            bitbake('syslinux syslinux-native parted-native gptfdisk-native '
-                    'dosfstools-native mtools-native bmap-tools-native')
+            tools = 'parted-native gptfdisk-native ' \
+                    'dosfstools-native mtools-native bmap-tools-native'
+            if is_x86:
+                tools += ' syslinux syslinux-native'
+            bitbake(tools)
+
             bitbake('core-image-minimal')
             Wic.image_is_ready = True
 
@@ -71,6 +96,7 @@ class Wic(oeSelfTest):
         self.assertEqual(0, runCmd('wic list --help').status)
 
     @testcase(1211)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_build_image_name(self):
         """Test wic create directdisk --image-name core-image-minimal"""
         self.assertEqual(0, runCmd("wic create directdisk "
@@ -78,6 +104,7 @@ class Wic(oeSelfTest):
         self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
 
     @testcase(1212)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_build_artifacts(self):
         """Test wic create directdisk providing all artifacts."""
         bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) \
@@ -92,6 +119,7 @@ class Wic(oeSelfTest):
         self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
 
     @testcase(1157)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_gpt_image(self):
         """Test creation of core-image-minimal with gpt table and UUID boot"""
         self.assertEqual(0, runCmd("wic create directdisk-gpt "
@@ -125,6 +153,7 @@ class Wic(oeSelfTest):
         self.assertEqual(0, runCmd('wic help kickstart').status)
 
     @testcase(1264)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_compress_gzip(self):
         """Test compressing an image with gzip"""
         self.assertEqual(0, runCmd("wic create directdisk "
@@ -134,6 +163,7 @@ class Wic(oeSelfTest):
                                          "directdisk-*.direct.gz")))
 
     @testcase(1265)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_compress_bzip2(self):
         """Test compressing an image with bzip2"""
         self.assertEqual(0, runCmd("wic create directdisk "
@@ -143,6 +173,7 @@ class Wic(oeSelfTest):
                                          "directdisk-*.direct.bz2")))
 
     @testcase(1266)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_compress_xz(self):
         """Test compressing an image with xz"""
         self.assertEqual(0, runCmd("wic create directdisk "
@@ -152,6 +183,7 @@ class Wic(oeSelfTest):
                                          "directdisk-*.direct.xz")))
 
     @testcase(1267)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_wrong_compressor(self):
         """Test how wic breaks if wrong compressor is provided"""
         self.assertEqual(2, runCmd("wic create directdisk "
@@ -159,6 +191,7 @@ class Wic(oeSelfTest):
                                    "-c wrong", ignore_status=True).status)
 
     @testcase(1268)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_rootfs_indirect_recipes(self):
         """Test usage of rootfs plugin with rootfs recipes"""
         wks = "directdisk-multi-rootfs"
@@ -170,6 +203,7 @@ class Wic(oeSelfTest):
         self.assertEqual(1, len(glob(self.resultdir + "%s*.direct" % wks)))
 
     @testcase(1269)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_rootfs_artifacts(self):
         """Test usage of rootfs plugin with rootfs paths"""
         bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) \
@@ -188,6 +222,7 @@ class Wic(oeSelfTest):
                                      "%(wks)s-*.direct" % bbvars)))
 
     @testcase(1346)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_iso_image(self):
         """Test creation of hybrid iso image with legacy and EFI boot"""
         self.assertEqual(0, runCmd("wic create mkhybridiso "
@@ -220,6 +255,7 @@ class Wic(oeSelfTest):
                 self.assertTrue(content[var])
 
     @testcase(1351)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_wic_image_type(self):
         """Test building wic images by bitbake"""
         self.assertEqual(0, bitbake('wic-image-minimal').status)
@@ -235,6 +271,7 @@ class Wic(oeSelfTest):
             self.assertTrue(os.path.isfile(os.path.realpath(path)))
 
     @testcase(1348)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_qemux86_directdisk(self):
         """Test creation of qemux-86-directdisk image"""
         image = "qemux86-directdisk"
@@ -243,6 +280,7 @@ class Wic(oeSelfTest):
         self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image)))
 
     @testcase(1349)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_mkgummidisk(self):
         """Test creation of mkgummidisk image"""
         image = "mkgummidisk"
@@ -251,6 +289,7 @@ class Wic(oeSelfTest):
         self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image)))
 
     @testcase(1350)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_mkefidisk(self):
         """Test creation of mkefidisk image"""
         image = "mkefidisk"
@@ -259,6 +298,7 @@ class Wic(oeSelfTest):
         self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image)))
 
     @testcase(1385)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_directdisk_bootloader_config(self):
         """Test creation of directdisk-bootloader-config image"""
         image = "directdisk-bootloader-config"
@@ -267,6 +307,7 @@ class Wic(oeSelfTest):
         self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image)))
 
     @testcase(1422)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_qemu(self):
         """Test wic-image-minimal under qemu"""
         self.assertEqual(0, bitbake('wic-image-minimal').status)
@@ -277,6 +318,7 @@ class Wic(oeSelfTest):
             self.assertEqual(1, status, 'Failed to run command "%s": %s' % (command, output))
             self.assertEqual(output, '/dev/root /\r\n/dev/vda3 /mnt')
 
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_bmap(self):
         """Test generation of .bmap file"""
         image = "directdisk"
@@ -285,6 +327,7 @@ class Wic(oeSelfTest):
         self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image)))
         self.assertEqual(1, len(glob(self.resultdir + "%s-*direct.bmap" % image)))
 
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_systemd_bootdisk(self):
         """Test creation of systemd-bootdisk image"""
         image = "systemd-bootdisk"
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 5/6] wic: selftest: do not assume bzImage kernel image
       [not found] ` <cover.1479971185.git.maciej.borzecki@rndity.com>
                     ` (3 preceding siblings ...)
  2016-11-24  7:08   ` [PATCH v5 4/6] wic: selftest: avoid COMPATIBLE_HOST issues Maciej Borzecki
@ 2016-11-24  7:08   ` Maciej Borzecki
  2016-11-24  7:08   ` [PATCH v5 6/6] wic: selftest: add tests for --fixed-size partition flags Maciej Borzecki
  5 siblings, 0 replies; 20+ messages in thread
From: Maciej Borzecki @ 2016-11-24  7:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Eggleton, Maciej Borzecki

Instead of assuming that bzImage is available, query bitbake enviroment
for KERNEL_IMAGETYPE.

Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com>
---
 meta/lib/oeqa/selftest/wic.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index 2db14445956bc5adcf1e755844bbdb69edcb468f..84ba08675b2995812a858e78b3678b2ab325b15b 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -338,7 +338,8 @@ class Wic(oeSelfTest):
     def test_sdimage_bootpart(self):
         """Test creation of sdimage-bootpart image"""
         image = "sdimage-bootpart"
-        self.write_config('IMAGE_BOOT_FILES = "bzImage"\n')
+        kimgtype = get_bb_var('KERNEL_IMAGETYPE', 'core-image-minimal')
+        self.write_config('IMAGE_BOOT_FILES = "%s"\n' % kimgtype)
         self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \
                                    % image).status)
         self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image)))
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v5 6/6] wic: selftest: add tests for --fixed-size partition flags
       [not found] ` <cover.1479971185.git.maciej.borzecki@rndity.com>
                     ` (4 preceding siblings ...)
  2016-11-24  7:08   ` [PATCH v5 5/6] wic: selftest: do not assume bzImage kernel image Maciej Borzecki
@ 2016-11-24  7:08   ` Maciej Borzecki
  5 siblings, 0 replies; 20+ messages in thread
From: Maciej Borzecki @ 2016-11-24  7:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Eggleton, Maciej Borzecki

wic has a new flag for setting a fixed parition size --fixed-size. Add
tests that verify if partition is indeed sized properly and that errors
are signaled when there is not enough space to fit partition data.

Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com>
---
 meta/lib/oeqa/selftest/wic.py | 61 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index 84ba08675b2995812a858e78b3678b2ab325b15b..4cba61060cbd081b2288c970877d863ef42d9b7f 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -29,6 +29,7 @@ import unittest
 from glob import glob
 from shutil import rmtree
 from functools import wraps
+from tempfile import NamedTemporaryFile
 
 from oeqa.selftest.base import oeSelfTest
 from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu
@@ -59,6 +60,8 @@ class Wic(oeSelfTest):
 
     def setUpLocal(self):
         """This code is executed before each test method."""
+        self.native_sysroot = get_bb_var('STAGING_DIR_NATIVE', 'core-image-minimal')
+
         arch = get_bb_var('HOST_ARCH', 'core-image-minimal')
         is_x86 = arch in ['i586', 'i686', 'x86_64']
         if is_x86:
@@ -343,3 +346,61 @@ class Wic(oeSelfTest):
         self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \
                                    % image).status)
         self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image)))
+
+    def _make_fixed_size_wks(self, size):
+        """
+        Create a wks of an image with a single partition. Size of the partition is set
+        using --fixed-size flag. Returns a tuple: (path to wks file, wks image name)
+        """
+        with NamedTemporaryFile("w", suffix=".wks", delete=False) as tf:
+            wkspath = tf.name
+            tf.write("part " \
+                     "--source rootfs --ondisk hda --align 4 --fixed-size %d "
+                     "--fstype=ext4\n" % size)
+        wksname = os.path.splitext(os.path.basename(wkspath))[0]
+
+        return wkspath, wksname
+
+    def test_fixed_size(self):
+        """
+        Test creation of a simple image with partition size controlled through
+        --fixed-size flag
+        """
+        wkspath, wksname = self._make_fixed_size_wks(200)
+
+        self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \
+                                   % wkspath).status)
+        os.remove(wkspath)
+        wicout = glob(self.resultdir + "%s-*direct" % wksname)
+        self.assertEqual(1, len(wicout))
+
+        wicimg = wicout[0]
+
+        # verify partition size with wic
+        res = runCmd("parted -m %s unit mib p 2>/dev/null" % wicimg,
+                     ignore_status=True,
+                     native_sysroot=self.native_sysroot)
+        self.assertEqual(0, res.status)
+
+        # parse parted output which looks like this:
+        # BYT;\n
+        # /var/tmp/wic/build/tmpfwvjjkf_-201611101222-hda.direct:200MiB:file:512:512:msdos::;\n
+        # 1:0.00MiB:200MiB:200MiB:ext4::;\n
+        partlns = res.output.splitlines()[2:]
+
+        self.assertEqual(1, len(partlns))
+        self.assertEqual("1:0.00MiB:200MiB:200MiB:ext4::;", partlns[0])
+
+    def test_fixed_size_error(self):
+        """
+        Test creation of a simple image with partition size controlled through
+        --fixed-size flag. The size of partition is intentionally set to 1MiB
+        in order to trigger an error in wic.
+        """
+        wkspath, wksname = self._make_fixed_size_wks(1)
+
+        self.assertEqual(1, runCmd("wic create %s -e core-image-minimal" \
+                                   % wkspath, ignore_status=True).status)
+        os.remove(wkspath)
+        wicout = glob(self.resultdir + "%s-*direct" % wksname)
+        self.assertEqual(0, len(wicout))
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH v5 0/6] wic: bugfixes & --fixed-size support, tests, oe-selftest: minor fixes
  2016-11-24  7:08 [PATCH v5 0/6] wic: bugfixes & --fixed-size support, tests, oe-selftest: minor fixes Maciej Borzecki
       [not found] ` <cover.1479971185.git.maciej.borzecki@rndity.com>
@ 2016-12-13  8:07 ` Maciej Borzęcki
  2016-12-13 18:53   ` Ed Bartosh
  1 sibling, 1 reply; 20+ messages in thread
From: Maciej Borzęcki @ 2016-12-13  8:07 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer
  Cc: Paul Eggleton, Maciej Borzecki

On Thu, Nov 24, 2016 at 8:08 AM, Maciej Borzecki
<maciej.borzecki@rndity.com> wrote:
> v5 of a patch series previously posted here [1].
>
> Changes since v4:
>
> * dropped `wic: selftest: do not repeat core-image-minimal` & rebased
>   dependant patches
>
> * minor formatting fix in `wic: selftest: add tests for --fixed-size
>   partition flags`
>
> [1]. http://lists.openembedded.org/pipermail/openembedded-core/2016-November/129103.html
>
> Maciej Borzecki (6):
>   oe-selftest: enforce en_US.UTF-8 locale
>   oeqa/utils/commands.py: allow use of binaries from native sysroot
>   wic: add --fixed-size wks option
>   wic: selftest: avoid COMPATIBLE_HOST issues
>   wic: selftest: do not assume bzImage kernel image
>   wic: selftest: add tests for --fixed-size partition flags
>
>  meta/lib/oeqa/selftest/wic.py          | 123 +++++++++++++++++++++++++++++++--
>  meta/lib/oeqa/utils/commands.py        |   9 ++-
>  scripts/lib/wic/help.py                |  14 +++-
>  scripts/lib/wic/imager/direct.py       |   2 +-
>  scripts/lib/wic/ksparser.py            |  41 +++++++++--
>  scripts/lib/wic/partition.py           |  88 ++++++++++++++---------
>  scripts/lib/wic/utils/partitionedfs.py |   2 +-
>  scripts/oe-selftest                    |   3 +
>  8 files changed, 234 insertions(+), 48 deletions(-)

Is there any additional action needed from me at this point? A rebase
or a resend perhaps?

Cheers,
-- 
Maciej Borzecki
RnDity


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v5 0/6] wic: bugfixes & --fixed-size support, tests, oe-selftest: minor fixes
  2016-12-13  8:07 ` [PATCH v5 0/6] wic: bugfixes & --fixed-size support, tests, oe-selftest: minor fixes Maciej Borzęcki
@ 2016-12-13 18:53   ` Ed Bartosh
  2016-12-14 10:39     ` Maciej Borzęcki
  2016-12-19 11:20     ` [PATCH v6 0/5] wic: bugfixes & --fixed-size support, tests, oeqa: enhancements Maciej Borzecki
  0 siblings, 2 replies; 20+ messages in thread
From: Ed Bartosh @ 2016-12-13 18:53 UTC (permalink / raw)
  To: Maciej Borzęcki
  Cc: Paul Eggleton, Maciej Borzecki,
	Patches and discussions about the oe-core layer

On Tue, Dec 13, 2016 at 09:07:30AM +0100, Maciej Borzęcki wrote:
> On Thu, Nov 24, 2016 at 8:08 AM, Maciej Borzecki
> <maciej.borzecki@rndity.com> wrote:
> > v5 of a patch series previously posted here [1].
> >
> > Changes since v4:
> >
> > * dropped `wic: selftest: do not repeat core-image-minimal` & rebased
> >   dependant patches
> >
> > * minor formatting fix in `wic: selftest: add tests for --fixed-size
> >   partition flags`
> >
> > [1]. http://lists.openembedded.org/pipermail/openembedded-core/2016-November/129103.html
> >
> > Maciej Borzecki (6):
> >   oe-selftest: enforce en_US.UTF-8 locale
> >   oeqa/utils/commands.py: allow use of binaries from native sysroot
> >   wic: add --fixed-size wks option
> >   wic: selftest: avoid COMPATIBLE_HOST issues
> >   wic: selftest: do not assume bzImage kernel image
> >   wic: selftest: add tests for --fixed-size partition flags
> >
> >  meta/lib/oeqa/selftest/wic.py          | 123 +++++++++++++++++++++++++++++++--
> >  meta/lib/oeqa/utils/commands.py        |   9 ++-
> >  scripts/lib/wic/help.py                |  14 +++-
> >  scripts/lib/wic/imager/direct.py       |   2 +-
> >  scripts/lib/wic/ksparser.py            |  41 +++++++++--
> >  scripts/lib/wic/partition.py           |  88 ++++++++++++++---------
> >  scripts/lib/wic/utils/partitionedfs.py |   2 +-
> >  scripts/oe-selftest                    |   3 +
> >  8 files changed, 234 insertions(+), 48 deletions(-)
> 
> Is there any additional action needed from me at this point? A rebase
> or a resend perhaps?
> 

Rebase&resend would be nice as at lest one patch from this patchset is already accepted.

--
Regards,
Ed


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v5 0/6] wic: bugfixes & --fixed-size support, tests, oe-selftest: minor fixes
  2016-12-13 18:53   ` Ed Bartosh
@ 2016-12-14 10:39     ` Maciej Borzęcki
  2016-12-19 11:20     ` [PATCH v6 0/5] wic: bugfixes & --fixed-size support, tests, oeqa: enhancements Maciej Borzecki
  1 sibling, 0 replies; 20+ messages in thread
From: Maciej Borzęcki @ 2016-12-14 10:39 UTC (permalink / raw)
  To: Ed Bartosh
  Cc: Paul Eggleton, Maciej Borzecki,
	Patches and discussions about the oe-core layer

On Tue, Dec 13, 2016 at 7:53 PM, Ed Bartosh <ed.bartosh@linux.intel.com> wrote:
> On Tue, Dec 13, 2016 at 09:07:30AM +0100, Maciej Borzęcki wrote:
>> On Thu, Nov 24, 2016 at 8:08 AM, Maciej Borzecki
>> <maciej.borzecki@rndity.com> wrote:
>> > v5 of a patch series previously posted here [1].
>> >
>> > Changes since v4:
>> >
>> > * dropped `wic: selftest: do not repeat core-image-minimal` & rebased
>> >   dependant patches
>> >
>> > * minor formatting fix in `wic: selftest: add tests for --fixed-size
>> >   partition flags`
>> >
>> > [1]. http://lists.openembedded.org/pipermail/openembedded-core/2016-November/129103.html
>> >
>> > Maciej Borzecki (6):
>> >   oe-selftest: enforce en_US.UTF-8 locale
>> >   oeqa/utils/commands.py: allow use of binaries from native sysroot
>> >   wic: add --fixed-size wks option
>> >   wic: selftest: avoid COMPATIBLE_HOST issues
>> >   wic: selftest: do not assume bzImage kernel image
>> >   wic: selftest: add tests for --fixed-size partition flags
>> >
>> >  meta/lib/oeqa/selftest/wic.py          | 123 +++++++++++++++++++++++++++++++--
>> >  meta/lib/oeqa/utils/commands.py        |   9 ++-
>> >  scripts/lib/wic/help.py                |  14 +++-
>> >  scripts/lib/wic/imager/direct.py       |   2 +-
>> >  scripts/lib/wic/ksparser.py            |  41 +++++++++--
>> >  scripts/lib/wic/partition.py           |  88 ++++++++++++++---------
>> >  scripts/lib/wic/utils/partitionedfs.py |   2 +-
>> >  scripts/oe-selftest                    |   3 +
>> >  8 files changed, 234 insertions(+), 48 deletions(-)
>>
>> Is there any additional action needed from me at this point? A rebase
>> or a resend perhaps?
>>
>
> Rebase&resend would be nice as at lest one patch from this patchset is already accepted.
>

I will be posting a v6 later today or tomorrow.

-- 
Maciej Borzecki
RnDity


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v6 0/5] wic: bugfixes & --fixed-size support, tests, oeqa: enhancements
  2016-12-13 18:53   ` Ed Bartosh
  2016-12-14 10:39     ` Maciej Borzęcki
@ 2016-12-19 11:20     ` Maciej Borzecki
  2016-12-19 11:20       ` [PATCH v6 1/5] oeqa/utils/commands.py: allow use of binaries from native sysroot Maciej Borzecki
                         ` (5 more replies)
  1 sibling, 6 replies; 20+ messages in thread
From: Maciej Borzecki @ 2016-12-19 11:20 UTC (permalink / raw)
  To: openembedded-core; +Cc: Maciej Borzecki

v6 of a patch series previously posted here [1].

Changes since v5:

* `oe-selftest: enforce en_US.UTF-8 locale` was merged to master, hence it's no
  longer part of this series

* rebased on top of master (d0d260b0b85790ceb136dd6b0445e8e33d038f5e)

[1]. http://lists.openembedded.org/pipermail/openembedded-core/2016-November/129187.html

Maciej Borzecki (5):
  oeqa/utils/commands.py: allow use of binaries from native sysroot
  wic: add --fixed-size wks option
  wic: selftest: avoid COMPATIBLE_HOST issues
  wic: selftest: do not assume bzImage kernel image
  wic: selftest: add tests for --fixed-size partition flags

 meta/lib/oeqa/selftest/wic.py          | 117 +++++++++++++++++++++++++++++++--
 meta/lib/oeqa/utils/commands.py        |   9 ++-
 scripts/lib/wic/help.py                |  14 +++-
 scripts/lib/wic/imager/direct.py       |   2 +-
 scripts/lib/wic/ksparser.py            |  41 ++++++++++--
 scripts/lib/wic/partition.py           |  88 +++++++++++++++----------
 scripts/lib/wic/utils/partitionedfs.py |   2 +-
 7 files changed, 224 insertions(+), 49 deletions(-)

-- 
2.5.5



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v6 1/5] oeqa/utils/commands.py: allow use of binaries from native sysroot
  2016-12-19 11:20     ` [PATCH v6 0/5] wic: bugfixes & --fixed-size support, tests, oeqa: enhancements Maciej Borzecki
@ 2016-12-19 11:20       ` Maciej Borzecki
  2016-12-19 11:20       ` [PATCH v6 2/5] wic: add --fixed-size wks option Maciej Borzecki
                         ` (4 subsequent siblings)
  5 siblings, 0 replies; 20+ messages in thread
From: Maciej Borzecki @ 2016-12-19 11:20 UTC (permalink / raw)
  To: openembedded-core; +Cc: Maciej Borzecki

Tests may need to run a native tool that is not available on the host
filesystem, but can be built using one of the *-native recipes. In such case,
the tool will be available in native sysroot, and running in from that location
will require adjustments to PATH.

runCmd() can now take a path to native sysroot as one of its arguments and
setup PATH accordingly.

Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com>
---
 meta/lib/oeqa/utils/commands.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 3a68b001b76ca89df17545912e2f75ca2cca6a38..0425c9fd98c7e8074ced6222156f5a1c2a393f50 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -97,9 +97,16 @@ class Result(object):
     pass
 
 
-def runCmd(command, ignore_status=False, timeout=None, assert_error=True, **options):
+def runCmd(command, ignore_status=False, timeout=None, assert_error=True, native_sysroot=None, **options):
     result = Result()
 
+    if native_sysroot:
+        extra_paths = "%s/sbin:%s/usr/sbin:%s/usr/bin" % \
+                      (native_sysroot, native_sysroot, native_sysroot)
+        nenv = dict(options.get('env', os.environ))
+        nenv['PATH'] = extra_paths + ':' + nenv.get('PATH', '')
+        options['env'] = nenv
+
     cmd = Command(command, timeout=timeout, **options)
     cmd.run()
 
-- 
2.5.5



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v6 2/5] wic: add --fixed-size wks option
  2016-12-19 11:20     ` [PATCH v6 0/5] wic: bugfixes & --fixed-size support, tests, oeqa: enhancements Maciej Borzecki
  2016-12-19 11:20       ` [PATCH v6 1/5] oeqa/utils/commands.py: allow use of binaries from native sysroot Maciej Borzecki
@ 2016-12-19 11:20       ` Maciej Borzecki
  2016-12-19 11:20       ` [PATCH v6 3/5] wic: selftest: avoid COMPATIBLE_HOST issues Maciej Borzecki
                         ` (3 subsequent siblings)
  5 siblings, 0 replies; 20+ messages in thread
From: Maciej Borzecki @ 2016-12-19 11:20 UTC (permalink / raw)
  To: openembedded-core; +Cc: Maciej Borzecki

Added new option --fixed-size to wks. The option can be used to indicate
the exact size of a partition. The option cannot be added together with
--size, in which case an error will be raised. Other options that
influence automatic partition size (--extra-space, --overhead-factor),
if specifiec along with --fixed-size, will raise an error.

If it partition data is larger than the amount of space specified with
--fixed-size option wic will raise an error.

Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com>
---
 scripts/lib/wic/help.py                | 14 ++++--
 scripts/lib/wic/imager/direct.py       |  2 +-
 scripts/lib/wic/ksparser.py            | 41 ++++++++++++++--
 scripts/lib/wic/partition.py           | 88 +++++++++++++++++++++-------------
 scripts/lib/wic/utils/partitionedfs.py |  2 +-
 5 files changed, 105 insertions(+), 42 deletions(-)

diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
index e5347ec4b7c900c68fc64351a5293e75de0672b3..daa11bf489c135627ddfe4cef968e48f8e3ad1d8 100644
--- a/scripts/lib/wic/help.py
+++ b/scripts/lib/wic/help.py
@@ -646,6 +646,12 @@ DESCRIPTION
                  not specified, the size is in MB.
                  You do not need this option if you use --source.
 
+         --fixed-size: Exact partition size. Value format is the same
+                       as for --size option. This option cannot be
+                       specified along with --size. If partition data
+                       is larger than --fixed-size and error will be
+                       raised when assembling disk image.
+
          --source: This option is a wic-specific option that names the
                    source of the data that will populate the
                    partition.  The most common value for this option
@@ -719,13 +725,15 @@ DESCRIPTION
                         space after the space filled by the content
                         of the partition. The final size can go
                         beyond the size specified by --size.
-                        By default, 10MB.
+                        By default, 10MB. This option cannot be used
+                        with --fixed-size option.
 
          --overhead-factor: This option is specific to wic. The
                             size of the partition is multiplied by
                             this factor. It has to be greater than or
-                            equal to 1.
-                            The default value is 1.3.
+                            equal to 1. The default value is 1.3.
+                            This option cannot be used with --fixed-size
+                            option.
 
          --part-type: This option is specific to wic. It specifies partition
                       type GUID for GPT partitions.
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py
index 2bedef08d6450096c786def6f75a9ee53fcd4b3b..11ec15e33f65885618c7adc83e55c6a39fedbe99 100644
--- a/scripts/lib/wic/imager/direct.py
+++ b/scripts/lib/wic/imager/direct.py
@@ -290,7 +290,7 @@ class DirectImageCreator(BaseImageCreator):
                          self.bootimg_dir, self.kernel_dir, self.native_sysroot)
 
 
-            self.__image.add_partition(int(part.size),
+            self.__image.add_partition(part.disk_size,
                                        part.disk,
                                        part.mountpoint,
                                        part.source_file,
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 0894e2b199a299fbbed272f2e1c95e9d692e3ab1..62c490274aa92bf82aac304d9323250e3b728d0c 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -113,6 +113,9 @@ def systemidtype(arg):
 class KickStart():
     """"Kickstart parser implementation."""
 
+    DEFAULT_EXTRA_SPACE = 10*1024
+    DEFAULT_OVERHEAD_FACTOR = 1.3
+
     def __init__(self, confpath):
 
         self.partitions = []
@@ -127,16 +130,24 @@ class KickStart():
         part.add_argument('mountpoint', nargs='?')
         part.add_argument('--active', action='store_true')
         part.add_argument('--align', type=int)
-        part.add_argument("--extra-space", type=sizetype, default=10*1024)
+        part.add_argument("--extra-space", type=sizetype)
         part.add_argument('--fsoptions', dest='fsopts')
         part.add_argument('--fstype')
         part.add_argument('--label')
         part.add_argument('--no-table', action='store_true')
         part.add_argument('--ondisk', '--ondrive', dest='disk')
-        part.add_argument("--overhead-factor", type=overheadtype, default=1.3)
+        part.add_argument("--overhead-factor", type=overheadtype)
         part.add_argument('--part-type')
         part.add_argument('--rootfs-dir')
-        part.add_argument('--size', type=sizetype, default=0)
+
+        # --size and --fixed-size cannot be specified together; options
+        # ----extra-space and --overhead-factor should also raise a parser
+        # --error, but since nesting mutually exclusive groups does not work,
+        # ----extra-space/--overhead-factor are handled later
+        sizeexcl = part.add_mutually_exclusive_group()
+        sizeexcl.add_argument('--size', type=sizetype, default=0)
+        sizeexcl.add_argument('--fixed-size', type=sizetype, default=0)
+
         part.add_argument('--source')
         part.add_argument('--sourceparams')
         part.add_argument('--system-id', type=systemidtype)
@@ -170,11 +181,33 @@ class KickStart():
                 lineno += 1
                 if line and line[0] != '#':
                     try:
-                        parsed = parser.parse_args(shlex.split(line))
+                        line_args = shlex.split(line)
+                        parsed = parser.parse_args(line_args)
                     except ArgumentError as err:
                         raise KickStartError('%s:%d: %s' % \
                                              (confpath, lineno, err))
                     if line.startswith('part'):
+                        # using ArgumentParser one cannot easily tell if option
+                        # was passed as argument, if said option has a default
+                        # value; --overhead-factor/--extra-space cannot be used
+                        # with --fixed-size, so at least detect when these were
+                        # passed with non-0 values ...
+                        if parsed.fixed_size:
+                            if parsed.overhead_factor or parsed.extra_space:
+                                err = "%s:%d: arguments --overhead-factor and --extra-space not "\
+                                      "allowed with argument --fixed-size" \
+                                      % (confpath, lineno)
+                                raise KickStartError(err)
+                        else:
+                            # ... and provide defaults if not using
+                            # --fixed-size iff given option was not used
+                            # (again, one cannot tell if option was passed but
+                            # with value equal to 0)
+                            if '--overhead-factor' not in line_args:
+                                parsed.overhead_factor = self.DEFAULT_OVERHEAD_FACTOR
+                            if '--extra-space' not in line_args:
+                                parsed.extra_space = self.DEFAULT_EXTRA_SPACE
+
                         self.partnum += 1
                         self.partitions.append(Partition(parsed, self.partnum))
                     elif line.startswith('include'):
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index b191cdee542054956262d6c49f3ccc7cf812ee8a..aa8f8a79486b00b99fc43153fda93e654adfd1d9 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -54,6 +54,7 @@ class Partition():
         self.part_type = args.part_type
         self.rootfs_dir = args.rootfs_dir
         self.size = args.size
+        self.fixed_size = args.fixed_size
         self.source = args.source
         self.sourceparams = args.sourceparams
         self.system_id = args.system_id
@@ -87,6 +88,41 @@ class Partition():
         else:
             return 0
 
+    def get_rootfs_size(self, actual_rootfs_size=0):
+        """
+        Calculate the required size of rootfs taking into consideration
+        --size/--fixed-size flags as well as overhead and extra space, as
+        specified in kickstart file. Raises an error if the
+        `actual_rootfs_size` is larger than fixed-size rootfs.
+
+        """
+        if self.fixed_size:
+            rootfs_size = self.fixed_size
+            if actual_rootfs_size > rootfs_size:
+                msger.error("Actual rootfs size (%d kB) is larger than allowed size %d kB" \
+                            %(actual_rootfs_size, rootfs_size))
+        else:
+            extra_blocks = self.get_extra_block_count(actual_rootfs_size)
+            if extra_blocks < self.extra_space:
+                extra_blocks = self.extra_space
+
+            rootfs_size = actual_rootfs_size + extra_blocks
+            rootfs_size *= self.overhead_factor
+
+            msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
+                        (extra_blocks, self.mountpoint, rootfs_size))
+
+        return rootfs_size
+
+    @property
+    def disk_size(self):
+        """
+        Obtain on-disk size of partition taking into consideration
+        --size/--fixed-size options.
+
+        """
+        return self.fixed_size if self.fixed_size else self.size
+
     def prepare(self, creator, cr_workdir, oe_builddir, rootfs_dir,
                 bootimg_dir, kernel_dir, native_sysroot):
         """
@@ -97,9 +133,9 @@ class Partition():
             self.sourceparams_dict = parse_sourceparams(self.sourceparams)
 
         if not self.source:
-            if not self.size:
-                msger.error("The %s partition has a size of zero.  Please "
-                            "specify a non-zero --size for that partition." % \
+            if not self.size and not self.fixed_size:
+                msger.error("The %s partition has a size of zero. Please "
+                            "specify a non-zero --size/--fixed-size for that partition." % \
                             self.mountpoint)
             if self.fstype and self.fstype == "swap":
                 self.prepare_swap_partition(cr_workdir, oe_builddir,
@@ -146,6 +182,7 @@ class Partition():
                                                      oe_builddir,
                                                      bootimg_dir, kernel_dir, rootfs_dir,
                                                      native_sysroot)
+
         # further processing required Partition.size to be an integer, make
         # sure that it is one
         if type(self.size) is not int:
@@ -153,6 +190,12 @@ class Partition():
                           "This a bug in source plugin %s and needs to be fixed." \
                           % (self.mountpoint, self.source))
 
+        if self.fixed_size and self.size > self.fixed_size:
+            msger.error("File system image of partition %s is larger (%d kB) than its"\
+                        "allowed size %d kB" % (self.mountpoint,
+                                                self.size, self.fixed_size))
+
+
     def prepare_rootfs_from_fs_image(self, cr_workdir, oe_builddir,
                                      rootfs_dir):
         """
@@ -228,15 +271,7 @@ class Partition():
         out = exec_cmd(du_cmd)
         actual_rootfs_size = int(out.split()[0])
 
-        extra_blocks = self.get_extra_block_count(actual_rootfs_size)
-        if extra_blocks < self.extra_space:
-            extra_blocks = self.extra_space
-
-        rootfs_size = actual_rootfs_size + extra_blocks
-        rootfs_size *= self.overhead_factor
-
-        msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
-                    (extra_blocks, self.mountpoint, rootfs_size))
+        rootfs_size = self.get_rootfs_size(actual_rootfs_size)
 
         with open(rootfs, 'w') as sparse:
             os.ftruncate(sparse.fileno(), rootfs_size * 1024)
@@ -262,15 +297,7 @@ class Partition():
         out = exec_cmd(du_cmd)
         actual_rootfs_size = int(out.split()[0])
 
-        extra_blocks = self.get_extra_block_count(actual_rootfs_size)
-        if extra_blocks < self.extra_space:
-            extra_blocks = self.extra_space
-
-        rootfs_size = actual_rootfs_size + extra_blocks
-        rootfs_size *= self.overhead_factor
-
-        msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
-                    (extra_blocks, self.mountpoint, rootfs_size))
+        rootfs_size = self.get_rootfs_size(actual_rootfs_size)
 
         with open(rootfs, 'w') as sparse:
             os.ftruncate(sparse.fileno(), rootfs_size * 1024)
@@ -292,20 +319,13 @@ class Partition():
         out = exec_cmd(du_cmd)
         blocks = int(out.split()[0])
 
-        extra_blocks = self.get_extra_block_count(blocks)
-        if extra_blocks < self.extra_space:
-            extra_blocks = self.extra_space
-
-        blocks += extra_blocks
-
-        msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
-                    (extra_blocks, self.mountpoint, blocks))
+        rootfs_size = self.get_rootfs_size(blocks)
 
         label_str = "-n boot"
         if self.label:
             label_str = "-n %s" % self.label
 
-        dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, rootfs, blocks)
+        dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, rootfs, rootfs_size)
         exec_native_cmd(dosfs_cmd, native_sysroot)
 
         mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, rootfs_dir)
@@ -328,8 +348,9 @@ class Partition():
         """
         Prepare an empty ext2/3/4 partition.
         """
+        size = self.disk_size
         with open(rootfs, 'w') as sparse:
-            os.ftruncate(sparse.fileno(), self.size * 1024)
+            os.ftruncate(sparse.fileno(), size * 1024)
 
         extra_imagecmd = "-i 8192"
 
@@ -346,8 +367,9 @@ class Partition():
         """
         Prepare an empty btrfs partition.
         """
+        size = self.disk_size
         with open(rootfs, 'w') as sparse:
-            os.ftruncate(sparse.fileno(), self.size * 1024)
+            os.ftruncate(sparse.fileno(), size * 1024)
 
         label_str = ""
         if self.label:
@@ -362,7 +384,7 @@ class Partition():
         """
         Prepare an empty vfat partition.
         """
-        blocks = self.size
+        blocks = self.disk_size
 
         label_str = "-n boot"
         if self.label:
diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py
index 9ea4a30cbb1cc66be66651653814c60b17bad2f9..68301f0b476ed48edfcb4dcad0df903474d13b50 100644
--- a/scripts/lib/wic/utils/partitionedfs.py
+++ b/scripts/lib/wic/utils/partitionedfs.py
@@ -210,7 +210,7 @@ class Image():
             msger.debug("Assigned %s to %s%d, sectors range %d-%d size %d "
                         "sectors (%d bytes)." \
                             % (part['mountpoint'], part['disk_name'], part['num'],
-                               part['start'], part['start'] + part['size'] - 1,
+                               part['start'], disk['offset'] - 1,
                                part['size'], part['size'] * self.sector_size))
 
         # Once all the partitions have been layed out, we can calculate the
-- 
2.5.5



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v6 3/5] wic: selftest: avoid COMPATIBLE_HOST issues
  2016-12-19 11:20     ` [PATCH v6 0/5] wic: bugfixes & --fixed-size support, tests, oeqa: enhancements Maciej Borzecki
  2016-12-19 11:20       ` [PATCH v6 1/5] oeqa/utils/commands.py: allow use of binaries from native sysroot Maciej Borzecki
  2016-12-19 11:20       ` [PATCH v6 2/5] wic: add --fixed-size wks option Maciej Borzecki
@ 2016-12-19 11:20       ` Maciej Borzecki
  2016-12-19 11:21       ` [PATCH v6 4/5] wic: selftest: do not assume bzImage kernel image Maciej Borzecki
                         ` (2 subsequent siblings)
  5 siblings, 0 replies; 20+ messages in thread
From: Maciej Borzecki @ 2016-12-19 11:20 UTC (permalink / raw)
  To: openembedded-core; +Cc: Maciej Borzecki

wic tests will unconditionally attempt to build syslinux and add
configuration options that may not be compatible with current machine.

Resolve this by consulting HOST_ARCH (which defaults to TARGET_ARCH) and build
recipes, add configuration options or skip tests conditionally.

A convenience decorator onlyForArch() can be used to skip test cases for
specific architectures.

Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com>
---
 meta/lib/oeqa/selftest/wic.py | 53 +++++++++++++++++++++++++++++++++++++++----
 1 file changed, 48 insertions(+), 5 deletions(-)

diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index e652fad24ab6dd7ab1b998b60a98a4052a2f1dd7..35cd14fb0c4a9b863a7a6324885f80da8e86d3eb 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -24,15 +24,33 @@
 """Test cases for wic."""
 
 import os
+import unittest
 
 from glob import glob
 from shutil import rmtree
+from functools import wraps
 
 from oeqa.selftest.base import oeSelfTest
 from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu
 from oeqa.utils.decorators import testcase
 
 
+class onlyForArch(object):
+
+    def __init__(self, *args):
+        self.archs = args
+
+    def __call__(self,f):
+        @wraps(f)
+        def wrapped_f(*args, **kwargs):
+            arch = get_bb_var('HOST_ARCH', 'core-image-minimal')
+            if self.archs and arch not in self.archs :
+                raise unittest.SkipTest("Testcase arch dependency not met: %s" % arch)
+            return f(*args, **kwargs)
+        wrapped_f.__name__ = f.__name__
+        return wrapped_f
+
+
 class Wic(oeSelfTest):
     """Wic test class."""
 
@@ -41,16 +59,23 @@ class Wic(oeSelfTest):
 
     def setUpLocal(self):
         """This code is executed before each test method."""
-        self.write_config('IMAGE_FSTYPES += " hddimg"\n'
-                          'MACHINE_FEATURES_append = " efi"\n'
-                          'WKS_FILE = "wic-image-minimal"\n')
+        arch = get_bb_var('HOST_ARCH', 'core-image-minimal')
+        is_x86 = arch in ['i586', 'i686', 'x86_64']
+        if is_x86:
+            self.write_config('IMAGE_FSTYPES += " hddimg"\n' \
+                              'MACHINE_FEATURES_append = " efi"\n'
+                              'WKS_FILE = "wic-image-minimal"\n')
 
         # Do this here instead of in setUpClass as the base setUp does some
         # clean up which can result in the native tools built earlier in
         # setUpClass being unavailable.
         if not Wic.image_is_ready:
-            bitbake('syslinux syslinux-native parted-native gptfdisk-native '
-                    'dosfstools-native mtools-native bmap-tools-native')
+            tools = 'parted-native gptfdisk-native ' \
+                    'dosfstools-native mtools-native bmap-tools-native'
+            if is_x86:
+                tools += ' syslinux syslinux-native'
+            bitbake(tools)
+
             bitbake('core-image-minimal')
             Wic.image_is_ready = True
 
@@ -72,6 +97,7 @@ class Wic(oeSelfTest):
         self.assertEqual(0, runCmd('wic list --help').status)
 
     @testcase(1211)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_build_image_name(self):
         """Test wic create directdisk --image-name core-image-minimal"""
         self.assertEqual(0, runCmd("wic create directdisk "
@@ -79,6 +105,7 @@ class Wic(oeSelfTest):
         self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
 
     @testcase(1212)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_build_artifacts(self):
         """Test wic create directdisk providing all artifacts."""
         bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) \
@@ -93,6 +120,7 @@ class Wic(oeSelfTest):
         self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
 
     @testcase(1157)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_gpt_image(self):
         """Test creation of core-image-minimal with gpt table and UUID boot"""
         self.assertEqual(0, runCmd("wic create directdisk-gpt "
@@ -126,6 +154,7 @@ class Wic(oeSelfTest):
         self.assertEqual(0, runCmd('wic help kickstart').status)
 
     @testcase(1264)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_compress_gzip(self):
         """Test compressing an image with gzip"""
         self.assertEqual(0, runCmd("wic create directdisk "
@@ -135,6 +164,7 @@ class Wic(oeSelfTest):
                                          "directdisk-*.direct.gz")))
 
     @testcase(1265)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_compress_bzip2(self):
         """Test compressing an image with bzip2"""
         self.assertEqual(0, runCmd("wic create directdisk "
@@ -144,6 +174,7 @@ class Wic(oeSelfTest):
                                          "directdisk-*.direct.bz2")))
 
     @testcase(1266)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_compress_xz(self):
         """Test compressing an image with xz"""
         self.assertEqual(0, runCmd("wic create directdisk "
@@ -153,6 +184,7 @@ class Wic(oeSelfTest):
                                          "directdisk-*.direct.xz")))
 
     @testcase(1267)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_wrong_compressor(self):
         """Test how wic breaks if wrong compressor is provided"""
         self.assertEqual(2, runCmd("wic create directdisk "
@@ -160,6 +192,7 @@ class Wic(oeSelfTest):
                                    "-c wrong", ignore_status=True).status)
 
     @testcase(1268)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_rootfs_indirect_recipes(self):
         """Test usage of rootfs plugin with rootfs recipes"""
         wks = "directdisk-multi-rootfs"
@@ -171,6 +204,7 @@ class Wic(oeSelfTest):
         self.assertEqual(1, len(glob(self.resultdir + "%s*.direct" % wks)))
 
     @testcase(1269)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_rootfs_artifacts(self):
         """Test usage of rootfs plugin with rootfs paths"""
         bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) \
@@ -189,6 +223,7 @@ class Wic(oeSelfTest):
                                      "%(wks)s-*.direct" % bbvars)))
 
     @testcase(1346)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_iso_image(self):
         """Test creation of hybrid iso image with legacy and EFI boot"""
         self.assertEqual(0, runCmd("wic create mkhybridiso "
@@ -221,6 +256,7 @@ class Wic(oeSelfTest):
                 self.assertTrue(content[var])
 
     @testcase(1351)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_wic_image_type(self):
         """Test building wic images by bitbake"""
         self.assertEqual(0, bitbake('wic-image-minimal').status)
@@ -236,6 +272,7 @@ class Wic(oeSelfTest):
             self.assertTrue(os.path.isfile(os.path.realpath(path)))
 
     @testcase(1348)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_qemux86_directdisk(self):
         """Test creation of qemux-86-directdisk image"""
         image = "qemux86-directdisk"
@@ -244,6 +281,7 @@ class Wic(oeSelfTest):
         self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image)))
 
     @testcase(1349)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_mkgummidisk(self):
         """Test creation of mkgummidisk image"""
         image = "mkgummidisk"
@@ -252,6 +290,7 @@ class Wic(oeSelfTest):
         self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image)))
 
     @testcase(1350)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_mkefidisk(self):
         """Test creation of mkefidisk image"""
         image = "mkefidisk"
@@ -260,6 +299,7 @@ class Wic(oeSelfTest):
         self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image)))
 
     @testcase(1385)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_directdisk_bootloader_config(self):
         """Test creation of directdisk-bootloader-config image"""
         image = "directdisk-bootloader-config"
@@ -268,6 +308,7 @@ class Wic(oeSelfTest):
         self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image)))
 
     @testcase(1422)
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_qemu(self):
         """Test wic-image-minimal under qemu"""
         self.assertEqual(0, bitbake('wic-image-minimal').status)
@@ -278,6 +319,7 @@ class Wic(oeSelfTest):
             self.assertEqual(1, status, 'Failed to run command "%s": %s' % (command, output))
             self.assertEqual(output, '/dev/root /\r\n/dev/vda3 /mnt')
 
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_bmap(self):
         """Test generation of .bmap file"""
         image = "directdisk"
@@ -286,6 +328,7 @@ class Wic(oeSelfTest):
         self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image)))
         self.assertEqual(1, len(glob(self.resultdir + "%s-*direct.bmap" % image)))
 
+    @onlyForArch('i586', 'i686', 'x86_64')
     def test_systemd_bootdisk(self):
         """Test creation of systemd-bootdisk image"""
         image = "systemd-bootdisk"
-- 
2.5.5



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v6 4/5] wic: selftest: do not assume bzImage kernel image
  2016-12-19 11:20     ` [PATCH v6 0/5] wic: bugfixes & --fixed-size support, tests, oeqa: enhancements Maciej Borzecki
                         ` (2 preceding siblings ...)
  2016-12-19 11:20       ` [PATCH v6 3/5] wic: selftest: avoid COMPATIBLE_HOST issues Maciej Borzecki
@ 2016-12-19 11:21       ` Maciej Borzecki
  2016-12-19 11:21       ` [PATCH v6 5/5] wic: selftest: add tests for --fixed-size partition flags Maciej Borzecki
  2016-12-20 14:04       ` [PATCH v6 0/5] wic: bugfixes & --fixed-size support, tests, oeqa: enhancements Ed Bartosh
  5 siblings, 0 replies; 20+ messages in thread
From: Maciej Borzecki @ 2016-12-19 11:21 UTC (permalink / raw)
  To: openembedded-core; +Cc: Maciej Borzecki

Instead of assuming that bzImage is available, query bitbake enviroment
for KERNEL_IMAGETYPE.

Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com>
---
 meta/lib/oeqa/selftest/wic.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index 35cd14fb0c4a9b863a7a6324885f80da8e86d3eb..8efece3171db47ee622f2c0f712fff2c2fcf645b 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -339,7 +339,8 @@ class Wic(oeSelfTest):
     def test_sdimage_bootpart(self):
         """Test creation of sdimage-bootpart image"""
         image = "sdimage-bootpart"
-        self.write_config('IMAGE_BOOT_FILES = "bzImage"\n')
+        kimgtype = get_bb_var('KERNEL_IMAGETYPE', 'core-image-minimal')
+        self.write_config('IMAGE_BOOT_FILES = "%s"\n' % kimgtype)
         self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \
                                    % image).status)
         self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image)))
-- 
2.5.5



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v6 5/5] wic: selftest: add tests for --fixed-size partition flags
  2016-12-19 11:20     ` [PATCH v6 0/5] wic: bugfixes & --fixed-size support, tests, oeqa: enhancements Maciej Borzecki
                         ` (3 preceding siblings ...)
  2016-12-19 11:21       ` [PATCH v6 4/5] wic: selftest: do not assume bzImage kernel image Maciej Borzecki
@ 2016-12-19 11:21       ` Maciej Borzecki
  2016-12-20 14:04       ` [PATCH v6 0/5] wic: bugfixes & --fixed-size support, tests, oeqa: enhancements Ed Bartosh
  5 siblings, 0 replies; 20+ messages in thread
From: Maciej Borzecki @ 2016-12-19 11:21 UTC (permalink / raw)
  To: openembedded-core; +Cc: Maciej Borzecki

wic has a new flag for setting a fixed parition size --fixed-size. Add
tests that verify if partition is indeed sized properly and that errors
are signaled when there is not enough space to fit partition data.

Signed-off-by: Maciej Borzecki <maciej.borzecki@rndity.com>
---
 meta/lib/oeqa/selftest/wic.py | 61 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index 8efece3171db47ee622f2c0f712fff2c2fcf645b..9caf3b0b1e3d4b538fffd409b26f68f0101e78dc 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -29,6 +29,7 @@ import unittest
 from glob import glob
 from shutil import rmtree
 from functools import wraps
+from tempfile import NamedTemporaryFile
 
 from oeqa.selftest.base import oeSelfTest
 from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu
@@ -59,6 +60,8 @@ class Wic(oeSelfTest):
 
     def setUpLocal(self):
         """This code is executed before each test method."""
+        self.native_sysroot = get_bb_var('STAGING_DIR_NATIVE', 'core-image-minimal')
+
         arch = get_bb_var('HOST_ARCH', 'core-image-minimal')
         is_x86 = arch in ['i586', 'i686', 'x86_64']
         if is_x86:
@@ -344,3 +347,61 @@ class Wic(oeSelfTest):
         self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \
                                    % image).status)
         self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image)))
+
+    def _make_fixed_size_wks(self, size):
+        """
+        Create a wks of an image with a single partition. Size of the partition is set
+        using --fixed-size flag. Returns a tuple: (path to wks file, wks image name)
+        """
+        with NamedTemporaryFile("w", suffix=".wks", delete=False) as tf:
+            wkspath = tf.name
+            tf.write("part " \
+                     "--source rootfs --ondisk hda --align 4 --fixed-size %d "
+                     "--fstype=ext4\n" % size)
+        wksname = os.path.splitext(os.path.basename(wkspath))[0]
+
+        return wkspath, wksname
+
+    def test_fixed_size(self):
+        """
+        Test creation of a simple image with partition size controlled through
+        --fixed-size flag
+        """
+        wkspath, wksname = self._make_fixed_size_wks(200)
+
+        self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \
+                                   % wkspath).status)
+        os.remove(wkspath)
+        wicout = glob(self.resultdir + "%s-*direct" % wksname)
+        self.assertEqual(1, len(wicout))
+
+        wicimg = wicout[0]
+
+        # verify partition size with wic
+        res = runCmd("parted -m %s unit mib p 2>/dev/null" % wicimg,
+                     ignore_status=True,
+                     native_sysroot=self.native_sysroot)
+        self.assertEqual(0, res.status)
+
+        # parse parted output which looks like this:
+        # BYT;\n
+        # /var/tmp/wic/build/tmpfwvjjkf_-201611101222-hda.direct:200MiB:file:512:512:msdos::;\n
+        # 1:0.00MiB:200MiB:200MiB:ext4::;\n
+        partlns = res.output.splitlines()[2:]
+
+        self.assertEqual(1, len(partlns))
+        self.assertEqual("1:0.00MiB:200MiB:200MiB:ext4::;", partlns[0])
+
+    def test_fixed_size_error(self):
+        """
+        Test creation of a simple image with partition size controlled through
+        --fixed-size flag. The size of partition is intentionally set to 1MiB
+        in order to trigger an error in wic.
+        """
+        wkspath, wksname = self._make_fixed_size_wks(1)
+
+        self.assertEqual(1, runCmd("wic create %s -e core-image-minimal" \
+                                   % wkspath, ignore_status=True).status)
+        os.remove(wkspath)
+        wicout = glob(self.resultdir + "%s-*direct" % wksname)
+        self.assertEqual(0, len(wicout))
-- 
2.5.5



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH v6 0/5] wic: bugfixes & --fixed-size support, tests, oeqa: enhancements
  2016-12-19 11:20     ` [PATCH v6 0/5] wic: bugfixes & --fixed-size support, tests, oeqa: enhancements Maciej Borzecki
                         ` (4 preceding siblings ...)
  2016-12-19 11:21       ` [PATCH v6 5/5] wic: selftest: add tests for --fixed-size partition flags Maciej Borzecki
@ 2016-12-20 14:04       ` Ed Bartosh
  2016-12-20 18:27         ` Maciej Borzęcki
  5 siblings, 1 reply; 20+ messages in thread
From: Ed Bartosh @ 2016-12-20 14:04 UTC (permalink / raw)
  To: Maciej Borzecki; +Cc: Maciej Borzecki, openembedded-core

On Mon, Dec 19, 2016 at 12:20:56PM +0100, Maciej Borzecki wrote:
> v6 of a patch series previously posted here [1].
> 
> Changes since v5:
> 
> * `oe-selftest: enforce en_US.UTF-8 locale` was merged to master, hence it's no
>   longer part of this series
> 
> * rebased on top of master (d0d260b0b85790ceb136dd6b0445e8e33d038f5e)
> 

The patchset looks good to me. Thank you.

Couple of questions:
- did you test if Lars' change
  https://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=db08ffee0ad1451f3bf710f4d1b623938ba9aefb
  works with your patchset?

- Regarding oe-selftest fixes, wich machine did you run oe-selftest on?
  It looks to me that a lot of test cases can be run on your machine
  if we use another wks.

> [1]. http://lists.openembedded.org/pipermail/openembedded-core/2016-November/129187.html
> 
> Maciej Borzecki (5):
>   oeqa/utils/commands.py: allow use of binaries from native sysroot
>   wic: add --fixed-size wks option
>   wic: selftest: avoid COMPATIBLE_HOST issues
>   wic: selftest: do not assume bzImage kernel image
>   wic: selftest: add tests for --fixed-size partition flags
> 
>  meta/lib/oeqa/selftest/wic.py          | 117 +++++++++++++++++++++++++++++++--
>  meta/lib/oeqa/utils/commands.py        |   9 ++-
>  scripts/lib/wic/help.py                |  14 +++-
>  scripts/lib/wic/imager/direct.py       |   2 +-
>  scripts/lib/wic/ksparser.py            |  41 ++++++++++--
>  scripts/lib/wic/partition.py           |  88 +++++++++++++++----------
>  scripts/lib/wic/utils/partitionedfs.py |   2 +-
>  7 files changed, 224 insertions(+), 49 deletions(-)

--
Regards,
Ed


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v6 0/5] wic: bugfixes & --fixed-size support, tests, oeqa: enhancements
  2016-12-20 14:04       ` [PATCH v6 0/5] wic: bugfixes & --fixed-size support, tests, oeqa: enhancements Ed Bartosh
@ 2016-12-20 18:27         ` Maciej Borzęcki
  2016-12-21 13:00           ` Ed Bartosh
  0 siblings, 1 reply; 20+ messages in thread
From: Maciej Borzęcki @ 2016-12-20 18:27 UTC (permalink / raw)
  To: Ed Bartosh
  Cc: Maciej Borzecki, Patches and discussions about the oe-core layer

On Tue, Dec 20, 2016 at 3:04 PM, Ed Bartosh <ed.bartosh@linux.intel.com> wrote:
> On Mon, Dec 19, 2016 at 12:20:56PM +0100, Maciej Borzecki wrote:
>> v6 of a patch series previously posted here [1].
>>
>> Changes since v5:
>>
>> * `oe-selftest: enforce en_US.UTF-8 locale` was merged to master, hence it's no
>>   longer part of this series
>>
>> * rebased on top of master (d0d260b0b85790ceb136dd6b0445e8e33d038f5e)
>>
>
> The patchset looks good to me. Thank you.
>
> Couple of questions:
> - did you test if Lars' change
>   https://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=db08ffee0ad1451f3bf710f4d1b623938ba9aefb
>   works with your patchset?

Yes. The series was rebased on top of
d0d260b0b85790ceb136dd6b0445e8e33d038f5e, which includes Lars' patch.
The tests passed on all MACHINES I've used (though I'm not sure if
scenario addressed in that patch is covered by relevant test cases).

I believe I have also hit a weird bug in BitbakeVars._parse_line() while
testing with this patch and meta-mender. I Hope you can confirm it.

From a quick investigation I have determined that _parse_line() may
interpret arbitrary lines that are of 'key=value' format as legitimate
bitbake variables. In my case, IMAGE_CMD_sdimg defined in
mender-sdimg.bbclass includes the following piece:

    IMAGE_CMD_sdimg() {
        ...
        REMAINING_SIZE=$(expr ${MENDER_STORAGE_TOTAL_SIZE_MB} - \
        ${MENDER_BOOT_PART_SIZE_MB} - \
        ${MENDER_DATA_PART_SIZE_MB} - \
        ${MENDER_PARTITIONING_OVERHEAD_MB} - \
        $boot_env_size_mb)
        ROOTFS_SIZE=$(expr $REMAINING_SIZE / 2)
        ...
    }

This will obviously be seen in `bitbake -e output`. Looking at code
here:
https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/scripts/lib/wic/utils/oe/misc.py?id=db08ffee0ad1451f3bf710f4d1b623938ba9aefb#n151
the line will be split at '=', then whitespace will be stripped from
both key and value. So a line (taken from bitbake -e):

    ROOTFS_SIZE=\$(expr \$REMAINING_SIZE / 2)

Will define a variable ROOTFS_SIZE with value '\\$(expr \\$REMAINING_SIZE / 2)'.

It's a pure coincidence that Lars' patch queries ROOTFS_SIZE which also
appears in bitbake -e output under exactly the same name.

IMO, when parsing env output, we should expect variable name to start
right at the beginning of a line, IOW skip the line if key[0].isspace() == True

>
> - Regarding oe-selftest fixes, wich machine did you run oe-selftest on?
>   It looks to me that a lot of test cases can be run on your machine
>   if we use another wks.

I've run it on beaglebone, vexpress-qemu, qemux86 and qemuarm. Agree
with your observation though. I think that at least these TCs could be
made machine agnostic:

- test_build_artifacts
- test_build_image_name
- test_compress_*
- test_gpt_image
- test_wic_image_type
- test_wrong_compressor
- test_rootfs_*



>
>> [1]. http://lists.openembedded.org/pipermail/openembedded-core/2016-November/129187.html
>>
>> Maciej Borzecki (5):
>>   oeqa/utils/commands.py: allow use of binaries from native sysroot
>>   wic: add --fixed-size wks option
>>   wic: selftest: avoid COMPATIBLE_HOST issues
>>   wic: selftest: do not assume bzImage kernel image
>>   wic: selftest: add tests for --fixed-size partition flags
>>
>>  meta/lib/oeqa/selftest/wic.py          | 117 +++++++++++++++++++++++++++++++--
>>  meta/lib/oeqa/utils/commands.py        |   9 ++-
>>  scripts/lib/wic/help.py                |  14 +++-
>>  scripts/lib/wic/imager/direct.py       |   2 +-
>>  scripts/lib/wic/ksparser.py            |  41 ++++++++++--
>>  scripts/lib/wic/partition.py           |  88 +++++++++++++++----------
>>  scripts/lib/wic/utils/partitionedfs.py |   2 +-
>>  7 files changed, 224 insertions(+), 49 deletions(-)
>

Regards,
-- 
Maciej Borzecki
RnDity


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v6 0/5] wic: bugfixes & --fixed-size support, tests, oeqa: enhancements
  2016-12-20 18:27         ` Maciej Borzęcki
@ 2016-12-21 13:00           ` Ed Bartosh
  2016-12-21 14:19             ` Maciej Borzęcki
  0 siblings, 1 reply; 20+ messages in thread
From: Ed Bartosh @ 2016-12-21 13:00 UTC (permalink / raw)
  To: Maciej Borzęcki
  Cc: Maciej Borzecki, Patches and discussions about the oe-core layer

On Tue, Dec 20, 2016 at 07:27:04PM +0100, Maciej Borzęcki wrote:
> On Tue, Dec 20, 2016 at 3:04 PM, Ed Bartosh <ed.bartosh@linux.intel.com> wrote:
> > On Mon, Dec 19, 2016 at 12:20:56PM +0100, Maciej Borzecki wrote:
> >> v6 of a patch series previously posted here [1].
> >>
> >> Changes since v5:
> >>
> >> * `oe-selftest: enforce en_US.UTF-8 locale` was merged to master, hence it's no
> >>   longer part of this series
> >>
> >> * rebased on top of master (d0d260b0b85790ceb136dd6b0445e8e33d038f5e)
> >>
> >
> > The patchset looks good to me. Thank you.
> >
> > Couple of questions:
> > - did you test if Lars' change
> >   https://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=db08ffee0ad1451f3bf710f4d1b623938ba9aefb
> >   works with your patchset?
> 
> Yes. The series was rebased on top of
> d0d260b0b85790ceb136dd6b0445e8e33d038f5e, which includes Lars' patch.

The series causes conflicts on the latest master. Can you check if it's
really the case or it's just something wrong with my setup?

git-pw apply 3904
Applying series: wic: bugfixes & --fixed-size support, tests,
oe-selftest: minor fixes (rev 3)
Applying: oe-selftest: enforce en_US.UTF-8 locale
Using index info to reconstruct a base tree...
M	scripts/oe-selftest
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: oeqa/utils/commands.py: allow use of binaries from native
sysroot
Applying: wic: add --fixed-size wks option
Applying: wic: selftest: avoid COMPATIBLE_HOST issues
Using index info to reconstruct a base tree...
M	meta/lib/oeqa/selftest/wic.py
Falling back to patching base and 3-way merge...
Auto-merging meta/lib/oeqa/selftest/wic.py
CONFLICT (content): Merge conflict in meta/lib/oeqa/selftest/wic.py
Failed to merge in the changes.
Patch failed at 0004 wic: selftest: avoid COMPATIBLE_HOST issues
The copy of the patch that failed is found in:
   /home/ed/git/yocto/patchtest/openembedded-core/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


> The tests passed on all MACHINES I've used (though I'm not sure if
> scenario addressed in that patch is covered by relevant test cases).
>

I've asked Lars to add test case for that functionality.

> I believe I have also hit a weird bug in BitbakeVars._parse_line() while
> testing with this patch and meta-mender. I Hope you can confirm it.
>

Yes, I confirm this. Thanks for poining out to it. I'll fix it today.

> From a quick investigation I have determined that _parse_line() may
> interpret arbitrary lines that are of 'key=value' format as legitimate
> bitbake variables. In my case, IMAGE_CMD_sdimg defined in
> mender-sdimg.bbclass includes the following piece:
> 
>     IMAGE_CMD_sdimg() {
>         ...
>         REMAINING_SIZE=$(expr ${MENDER_STORAGE_TOTAL_SIZE_MB} - \
>         ${MENDER_BOOT_PART_SIZE_MB} - \
>         ${MENDER_DATA_PART_SIZE_MB} - \
>         ${MENDER_PARTITIONING_OVERHEAD_MB} - \
>         $boot_env_size_mb)
>         ROOTFS_SIZE=$(expr $REMAINING_SIZE / 2)
>         ...
>     }
> 
> This will obviously be seen in `bitbake -e output`. Looking at code
> here:
> https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/scripts/lib/wic/utils/oe/misc.py?id=db08ffee0ad1451f3bf710f4d1b623938ba9aefb#n151
> the line will be split at '=', then whitespace will be stripped from
> both key and value. So a line (taken from bitbake -e):
> 
>     ROOTFS_SIZE=\$(expr \$REMAINING_SIZE / 2)
> 
> Will define a variable ROOTFS_SIZE with value '\\$(expr \\$REMAINING_SIZE / 2)'.
> 
> It's a pure coincidence that Lars' patch queries ROOTFS_SIZE which also
> appears in bitbake -e output under exactly the same name.
> 
> IMO, when parsing env output, we should expect variable name to start
> right at the beginning of a line, IOW skip the line if key[0].isspace() == True
> 
> >
> > - Regarding oe-selftest fixes, wich machine did you run oe-selftest on?
> >   It looks to me that a lot of test cases can be run on your machine
> >   if we use another wks.
> 
> I've run it on beaglebone, vexpress-qemu, qemux86 and qemuarm. Agree
> with your observation though. I think that at least these TCs could be
> made machine agnostic:
> 
> - test_build_artifacts
> - test_build_image_name
> - test_compress_*
> - test_gpt_image
> - test_wic_image_type
> - test_wrong_compressor
> - test_rootfs_*
> 
> 

Yes, that's exactly my point. We should make generic tests work on any
machine.

Would you be willing to do this in a separate patchset together with
your oe-selftest core fixes?

I'd suggest to only include new testcase that works on qemu-x86* into
this patchset. It will make it faster to get merged.

> 
> >
> >> [1]. http://lists.openembedded.org/pipermail/openembedded-core/2016-November/129187.html
> >>
> >> Maciej Borzecki (5):
> >>   oeqa/utils/commands.py: allow use of binaries from native sysroot
> >>   wic: add --fixed-size wks option
> >>   wic: selftest: avoid COMPATIBLE_HOST issues
> >>   wic: selftest: do not assume bzImage kernel image
> >>   wic: selftest: add tests for --fixed-size partition flags
> >>
> >>  meta/lib/oeqa/selftest/wic.py          | 117 +++++++++++++++++++++++++++++++--
> >>  meta/lib/oeqa/utils/commands.py        |   9 ++-
> >>  scripts/lib/wic/help.py                |  14 +++-
> >>  scripts/lib/wic/imager/direct.py       |   2 +-
> >>  scripts/lib/wic/ksparser.py            |  41 ++++++++++--
> >>  scripts/lib/wic/partition.py           |  88 +++++++++++++++----------
> >>  scripts/lib/wic/utils/partitionedfs.py |   2 +-
> >>  7 files changed, 224 insertions(+), 49 deletions(-)

--
Regards,
Ed


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v6 0/5] wic: bugfixes & --fixed-size support, tests, oeqa: enhancements
  2016-12-21 13:00           ` Ed Bartosh
@ 2016-12-21 14:19             ` Maciej Borzęcki
  0 siblings, 0 replies; 20+ messages in thread
From: Maciej Borzęcki @ 2016-12-21 14:19 UTC (permalink / raw)
  To: Ed Bartosh
  Cc: Maciej Borzecki, Patches and discussions about the oe-core layer

On Wed, Dec 21, 2016 at 2:00 PM, Ed Bartosh <ed.bartosh@linux.intel.com> wrote:
> On Tue, Dec 20, 2016 at 07:27:04PM +0100, Maciej Borzęcki wrote:
>> On Tue, Dec 20, 2016 at 3:04 PM, Ed Bartosh <ed.bartosh@linux.intel.com> wrote:
>> > On Mon, Dec 19, 2016 at 12:20:56PM +0100, Maciej Borzecki wrote:
>> >> v6 of a patch series previously posted here [1].
>> >>
>> >> Changes since v5:
>> >>
>> >> * `oe-selftest: enforce en_US.UTF-8 locale` was merged to master, hence it's no
>> >>   longer part of this series
>> >>
>> >> * rebased on top of master (d0d260b0b85790ceb136dd6b0445e8e33d038f5e)
>> >>
>> >
>> > The patchset looks good to me. Thank you.
>> >
>> > Couple of questions:
>> > - did you test if Lars' change
>> >   https://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=db08ffee0ad1451f3bf710f4d1b623938ba9aefb
>> >   works with your patchset?
>>
>> Yes. The series was rebased on top of
>> d0d260b0b85790ceb136dd6b0445e8e33d038f5e, which includes Lars' patch.
>
> The series causes conflicts on the latest master. Can you check if it's
> really the case or it's just something wrong with my setup?

Just rebased on top current master d41d2fd and pushed to
https://github.com/bboozzoo/poky branch bboozzoo/wic-fixed-size-v7 in
case you want to test locally. I guess the conflict was with patch
aa1c50a `selftest/wic: extending test coverage for WIC script
options`, which has been reverted yesterday by RP.

Jair has posted a v2 yesterday and I expect it to be merged soon. So,
I think I'll just wait a couple of days (actually more like until the
beginning of January) before publishing a rebased version of my
series.

<snip>
>
>>
>> I've run it on beaglebone, vexpress-qemu, qemux86 and qemuarm. Agree
>> with your observation though. I think that at least these TCs could be
>> made machine agnostic:
>>
>> - test_build_artifacts
>> - test_build_image_name
>> - test_compress_*
>> - test_gpt_image
>> - test_wic_image_type
>> - test_wrong_compressor
>> - test_rootfs_*
>>
>>
>
> Yes, that's exactly my point. We should make generic tests work on any
> machine.
>
> Would you be willing to do this in a separate patchset together with
> your oe-selftest core fixes?
>
> I'd suggest to only include new testcase that works on qemu-x86* into
> this patchset. It will make it faster to get merged.
>

I would prefer to post these changes as a separate patchset. It looks
like there's already a couple of potentially conflicting patches
floating on the mailing list, so I would prefer to get --fixed-size
merged before starting another one.

Regards,
-- 
Maciej Borzecki
RnDity


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2016-12-21 14:20 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-24  7:08 [PATCH v5 0/6] wic: bugfixes & --fixed-size support, tests, oe-selftest: minor fixes Maciej Borzecki
     [not found] ` <cover.1479971185.git.maciej.borzecki@rndity.com>
2016-11-24  7:08   ` [PATCH v5 1/6] oe-selftest: enforce en_US.UTF-8 locale Maciej Borzecki
2016-11-24  7:08   ` [PATCH v5 2/6] oeqa/utils/commands.py: allow use of binaries from native sysroot Maciej Borzecki
2016-11-24  7:08   ` [PATCH v5 3/6] wic: add --fixed-size wks option Maciej Borzecki
2016-11-24  7:08   ` [PATCH v5 4/6] wic: selftest: avoid COMPATIBLE_HOST issues Maciej Borzecki
2016-11-24  7:08   ` [PATCH v5 5/6] wic: selftest: do not assume bzImage kernel image Maciej Borzecki
2016-11-24  7:08   ` [PATCH v5 6/6] wic: selftest: add tests for --fixed-size partition flags Maciej Borzecki
2016-12-13  8:07 ` [PATCH v5 0/6] wic: bugfixes & --fixed-size support, tests, oe-selftest: minor fixes Maciej Borzęcki
2016-12-13 18:53   ` Ed Bartosh
2016-12-14 10:39     ` Maciej Borzęcki
2016-12-19 11:20     ` [PATCH v6 0/5] wic: bugfixes & --fixed-size support, tests, oeqa: enhancements Maciej Borzecki
2016-12-19 11:20       ` [PATCH v6 1/5] oeqa/utils/commands.py: allow use of binaries from native sysroot Maciej Borzecki
2016-12-19 11:20       ` [PATCH v6 2/5] wic: add --fixed-size wks option Maciej Borzecki
2016-12-19 11:20       ` [PATCH v6 3/5] wic: selftest: avoid COMPATIBLE_HOST issues Maciej Borzecki
2016-12-19 11:21       ` [PATCH v6 4/5] wic: selftest: do not assume bzImage kernel image Maciej Borzecki
2016-12-19 11:21       ` [PATCH v6 5/5] wic: selftest: add tests for --fixed-size partition flags Maciej Borzecki
2016-12-20 14:04       ` [PATCH v6 0/5] wic: bugfixes & --fixed-size support, tests, oeqa: enhancements Ed Bartosh
2016-12-20 18:27         ` Maciej Borzęcki
2016-12-21 13:00           ` Ed Bartosh
2016-12-21 14:19             ` Maciej Borzęcki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.