All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] #10618: Increase oe-selftest coverage of wic codebase (first part)
@ 2017-03-22 13:42 Ed Bartosh
  2017-03-22 13:42 ` [PATCH 01/10] wic: remove rootfs_pcbios_ext plugin Ed Bartosh
                   ` (10 more replies)
  0 siblings, 11 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-03-22 13:42 UTC (permalink / raw)
  To: openembedded-core

Hi,

The main goal of these changes was to increase test coverage by testing rawcopy plugin,
which was not covered by the wic test suite. While working on it I found and fixed
quite nasty bug in sparse_copy API and made set of other important changes to make
the test case working.

I've also removed rootfs_pcbios_ext plugin, which was broken for a long time and
cleaned up wic test suite to keep it in a good shape.

The goal set in bugzilla issue #10618 is to increase test coverage to at least 80%.
Now it's only 74%, so more changes will have to be made. This patchset is just a
first part of the work in this area.

Note for project maintainers:
This patchset is based on Maciej's "enhancements for non-x86 MACHINE support & fixed-size tests"
patchset: http://lists.openembedded.org/pipermail/openembedded-core/2017-March/134410.html so,
please merge it in the right order.

The following changes since commit e07ca8bd2bd4a8fa1fb9a0f3a8d9ff9a8f9c46c8:

  wic: selftest: add tests for --fixed-size partition flags (2017-03-21 15:17:24 +0200)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib ed/wic/wip
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/wic/wip

Ed Bartosh (10):
  wic: remove rootfs_pcbios_ext plugin
  wic: don't set creator.bootimg_dir in plugins
  wic: use kernel_dir instead of bootimg_dir
  wic: fix bug in sparse_copy
  wic: use STAGING_DATADIR as a default for bootimg_dir
  wic: remove empty plugin methods
  wic: improve getting syslinux path
  oe-selftest: test wic rawcopy plugin
  selftest: pylinted wic test suite.
  oe-selftest: add test_rawcopy_plugin test case

 meta-selftest/wic/test_rawcopy_plugin.wks.in       |   6 +
 meta/lib/oeqa/selftest/wic.py                      |  84 +++++---
 scripts/lib/wic/filemap.py                         |   1 +
 scripts/lib/wic/plugins/source/bootimg-efi.py      |  16 +-
 .../lib/wic/plugins/source/bootimg-partition.py    |  32 +---
 scripts/lib/wic/plugins/source/bootimg-pcbios.py   |  53 ++---
 scripts/lib/wic/plugins/source/fsimage.py          |  19 --
 scripts/lib/wic/plugins/source/rawcopy.py          |  29 +--
 .../lib/wic/plugins/source/rootfs_pcbios_ext.py    | 213 ---------------------
 scripts/wic                                        |   3 +-
 10 files changed, 113 insertions(+), 343 deletions(-)
 create mode 100644 meta-selftest/wic/test_rawcopy_plugin.wks.in
 delete mode 100644 scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py

-- 
2.1.4



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

* [PATCH 01/10] wic: remove rootfs_pcbios_ext plugin
  2017-03-22 13:42 [PATCH 00/10] #10618: Increase oe-selftest coverage of wic codebase (first part) Ed Bartosh
@ 2017-03-22 13:42 ` Ed Bartosh
  2017-03-22 13:42 ` [PATCH 02/10] wic: don't set creator.bootimg_dir in plugins Ed Bartosh
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-03-22 13:42 UTC (permalink / raw)
  To: openembedded-core

Removed broken unused plugin.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 .../lib/wic/plugins/source/rootfs_pcbios_ext.py    | 213 ---------------------
 1 file changed, 213 deletions(-)
 delete mode 100644 scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py

diff --git a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
deleted file mode 100644
index 94f80d0..0000000
--- a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py
+++ /dev/null
@@ -1,213 +0,0 @@
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
-#
-# This program is free software; you can distribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for mo details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# AUTHOR
-# Adrian Freihofer <adrian.freihofer (at] neratec.com>
-#
-
-import logging
-import os
-import re
-
-from wic import WicError
-from wic.utils import runner
-from wic.utils.misc import get_bitbake_var, exec_cmd, exec_native_cmd
-from wic.pluginbase import SourcePlugin
-
-logger = logging.getLogger('wic')
-
-def serial_console_form_kargs(kernel_args):
-    """
-    Create SERIAL... line from kernel parameters
-
-    syslinux needs a line SERIAL port [baudrate [flowcontrol]]
-    in the syslinux.cfg file. The config line is generated based
-    on kernel boot parameters. The the parameters of the first
-    ttyS console are considered for syslinux config.
-    @param kernel_args kernel command line
-    @return line for syslinux config file e.g. "SERIAL 0 115200"
-    """
-    syslinux_conf = ""
-    for param in kernel_args.split():
-        param_match = re.match("console=ttyS([0-9]+),?([0-9]*)([noe]?)([0-9]?)(r?)", param)
-        if param_match:
-            syslinux_conf += "SERIAL " + param_match.group(1)
-            # baudrate
-            if param_match.group(2):
-                syslinux_conf += " " + param_match.group(2)
-            # parity
-            if param_match.group(3) and param_match.group(3) != 'n':
-                logger.warning("syslinux does not support parity for console. "
-                               "%s is ignored.", param_match.group(3))
-            # number of bits
-            if param_match.group(4) and param_match.group(4) != '8':
-                logger.warning("syslinux supports 8 bit console configuration "
-                               "only. %s is ignored.", param_match.group(4))
-            # flow control
-            if param_match.group(5) and param_match.group(5) != '':
-                logger.warning("syslinux console flowcontrol configuration. "
-                               "%s is ignored.", param_match.group(5))
-            break
-
-    return syslinux_conf
-
-
-# pylint: disable=no-init
-class RootfsPlugin(SourcePlugin):
-    """
-    Create root partition and install syslinux bootloader
-
-    This plugin creates a disk image containing a bootable root partition with
-    syslinux installed. The filesystem is ext2/3/4, no extra boot partition is
-    required.
-
-    Example kickstart file:
-    part / --source rootfs-pcbios-ext --ondisk sda --fstype=ext4 --label rootfs --align 1024
-    bootloader --source rootfs-pcbios-ext --timeout=0 --append="rootwait rootfstype=ext4"
-
-    The first line generates a root file system including a syslinux.cfg file
-    The "--source rootfs-pcbios-ext" in the second line triggers the installation
-    of ldlinux.sys into the image.
-    """
-
-    name = 'rootfs-pcbios-ext'
-
-    @staticmethod
-    def _get_rootfs_dir(rootfs_dir):
-        """
-        Find rootfs pseudo dir
-
-        If rootfs_dir is a directory consider it as rootfs directory.
-        Otherwise ask bitbake about the IMAGE_ROOTFS directory.
-        """
-        if os.path.isdir(rootfs_dir):
-            return rootfs_dir
-
-        image_rootfs_dir = get_bitbake_var("IMAGE_ROOTFS", rootfs_dir)
-        if not os.path.isdir(image_rootfs_dir):
-            raise WicError("No valid artifact IMAGE_ROOTFS from image named %s "
-                           "has been found at %s, exiting." %
-                           (rootfs_dir, image_rootfs_dir))
-
-        return image_rootfs_dir
-
-    # pylint: disable=unused-argument
-    @classmethod
-    def do_configure_partition(cls, part, source_params, image_creator,
-                               image_creator_workdir, oe_builddir, bootimg_dir,
-                               kernel_dir, native_sysroot):
-        """
-        Creates syslinux config in rootfs directory
-
-        Called before do_prepare_partition()
-        """
-        bootloader = image_creator.ks.bootloader
-
-        syslinux_conf = ""
-        syslinux_conf += "PROMPT 0\n"
-
-        syslinux_conf += "TIMEOUT " + str(bootloader.timeout) + "\n"
-        syslinux_conf += "ALLOWOPTIONS 1\n"
-
-        # Derive SERIAL... line from from kernel boot parameters
-        syslinux_conf += serial_console_form_kargs(options) + "\n"
-
-        syslinux_conf += "DEFAULT linux\n"
-        syslinux_conf += "LABEL linux\n"
-        syslinux_conf += "  KERNEL /boot/bzImage\n"
-
-        syslinux_conf += "  APPEND label=boot root=%s %s\n" % \
-                             (image_creator.rootdev, bootloader.append)
-
-        syslinux_cfg = os.path.join(image_creator.rootfs_dir['ROOTFS_DIR'], "boot", "syslinux.cfg")
-        logger.debug("Writing syslinux config %s", syslinux_cfg)
-        with open(syslinux_cfg, "w") as cfg:
-            cfg.write(syslinux_conf)
-
-    @classmethod
-    def do_prepare_partition(cls, part, source_params, image_creator,
-                             image_creator_workdir, oe_builddir, bootimg_dir,
-                             kernel_dir, krootfs_dir, native_sysroot):
-        """
-        Creates partition out of rootfs directory
-
-        Prepare content for a rootfs partition i.e. create a partition
-        and fill it from a /rootfs dir.
-        Install syslinux bootloader into root partition image file
-        """
-        def is_exe(exepath):
-            """Verify exepath is an executable file"""
-            return os.path.isfile(exepath) and os.access(exepath, os.X_OK)
-
-        # Make sure syslinux-nomtools is available in native sysroot or fail
-        native_syslinux_nomtools = os.path.join(native_sysroot, "usr/bin/syslinux-nomtools")
-        if not is_exe(native_syslinux_nomtools):
-            logger.info("building syslinux-native...")
-            exec_cmd("bitbake syslinux-native")
-        if not is_exe(native_syslinux_nomtools):
-            raise WicError("Couldn't find syslinux-nomtools (%s), exiting" %
-                           native_syslinux_nomtools)
-
-        if part.rootfs is None:
-            if 'ROOTFS_DIR' not in krootfs_dir:
-                raise WicError("Couldn't find --rootfs-dir, exiting")
-            rootfs_dir = krootfs_dir['ROOTFS_DIR']
-        else:
-            if part.rootfs in krootfs_dir:
-                rootfs_dir = krootfs_dir[part.rootfs]
-            elif part.rootfs:
-                rootfs_dir = part.rootfs
-            else:
-                raise WicError("Couldn't find --rootfs-dir=%s connection or "
-                               "it is not a valid path, exiting" % part.rootfs)
-
-        real_rootfs_dir = cls._get_rootfs_dir(rootfs_dir)
-
-        part.rootfs_dir = real_rootfs_dir
-        part.prepare_rootfs(image_creator_workdir, oe_builddir, real_rootfs_dir, native_sysroot)
-
-        # install syslinux into rootfs partition
-        syslinux_cmd = "syslinux-nomtools -d /boot -i %s" % part.source_file
-        exec_native_cmd(syslinux_cmd, native_sysroot)
-
-    @classmethod
-    def do_install_disk(cls, disk, disk_name, image_creator, workdir, oe_builddir,
-                        bootimg_dir, kernel_dir, native_sysroot):
-        """
-        Assemble partitions to disk image
-
-        Called after all partitions have been prepared and assembled into a
-        disk image. In this case, we install the MBR.
-        """
-        mbrfile = os.path.join(native_sysroot, "usr/share/syslinux/")
-        if image_creator.ptable_format == 'msdos':
-            mbrfile += "mbr.bin"
-        elif image_creator.ptable_format == 'gpt':
-            mbrfile += "gptmbr.bin"
-        else:
-            raise WicError("Unsupported partition table: %s" %
-                           image_creator.ptable_format)
-
-        if not os.path.exists(mbrfile):
-            raise WicError("Couldn't find %s. Has syslinux-native been baked?",
-                           mbrfile)
-        full_path = disk.path
-        logger.debug("Installing MBR on disk %s as %s with size %s bytes",
-                     disk_name, full_path, disk.min_size)
-
-        ret_code = runner.show(['dd', 'if=%s' % mbrfile, 'of=%s' % full_path, 'conv=notrunc'])
-        if ret_code != 0:
-            raise WicError("Unable to set MBR to %s" % full_path)
-- 
2.1.4



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

* [PATCH 02/10] wic: don't set creator.bootimg_dir in plugins
  2017-03-22 13:42 [PATCH 00/10] #10618: Increase oe-selftest coverage of wic codebase (first part) Ed Bartosh
  2017-03-22 13:42 ` [PATCH 01/10] wic: remove rootfs_pcbios_ext plugin Ed Bartosh
@ 2017-03-22 13:42 ` Ed Bartosh
  2017-03-22 13:42 ` [PATCH 03/10] wic: use kernel_dir instead of bootimg_dir Ed Bartosh
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-03-22 13:42 UTC (permalink / raw)
  To: openembedded-core

Changing bootimg_dir in plugins is a dangerous hack as this
value comes from wic command line and can be used by multiple
plugins.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 scripts/lib/wic/plugins/source/bootimg-efi.py    | 2 --
 scripts/lib/wic/plugins/source/bootimg-pcbios.py | 2 --
 2 files changed, 4 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 2d793a5..2d1c4d4 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -189,8 +189,6 @@ class BootimgEFIPlugin(SourcePlugin):
             bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
             if not bootimg_dir:
                 raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
-            # just so the result notes display it
-            creator.bootimg_dir = bootimg_dir
 
         staging_kernel_dir = kernel_dir
 
diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
index bd03eaa..1779520 100644
--- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
@@ -153,8 +153,6 @@ class BootimgPcbiosPlugin(SourcePlugin):
                 raise WicError("Couldn't find STAGING_DATADIR, exiting")
             if not _has_syslinux(bootimg_dir):
                 raise WicError("Please build syslinux first")
-            # just so the result notes display it
-            creator.bootimg_dir = bootimg_dir
 
         staging_kernel_dir = kernel_dir
 
-- 
2.1.4



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

* [PATCH 03/10] wic: use kernel_dir instead of bootimg_dir
  2017-03-22 13:42 [PATCH 00/10] #10618: Increase oe-selftest coverage of wic codebase (first part) Ed Bartosh
  2017-03-22 13:42 ` [PATCH 01/10] wic: remove rootfs_pcbios_ext plugin Ed Bartosh
  2017-03-22 13:42 ` [PATCH 02/10] wic: don't set creator.bootimg_dir in plugins Ed Bartosh
@ 2017-03-22 13:42 ` Ed Bartosh
  2017-03-22 13:42 ` [PATCH 04/10] wic: fix bug in sparse_copy Ed Bartosh
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-03-22 13:42 UTC (permalink / raw)
  To: openembedded-core

bootimg_dir is usually set to the value of STAGING_DATADIR and
kernel_dir - to the value of DEPLOY_DIR_IMAGE, so usage of
kernel_dir is more logical in bootimg-efi, bootimg-partition and
rawcopy plugins.

Replaced usage of bootimg_dir to kernel_dir in 3 above mentioned
plugins that use DEPLOY_DIR_IMAGE as a default artifact location.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 scripts/lib/wic/plugins/source/bootimg-efi.py       | 14 +++++++-------
 scripts/lib/wic/plugins/source/bootimg-partition.py | 12 ++++++------
 scripts/lib/wic/plugins/source/rawcopy.py           | 10 +++++-----
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 2d1c4d4..ff76c2f 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -185,9 +185,9 @@ class BootimgEFIPlugin(SourcePlugin):
         'prepares' the partition to be incorporated into the image.
         In this case, prepare content for an EFI (grub) boot partition.
         """
-        if not bootimg_dir:
-            bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
-            if not bootimg_dir:
+        if not kernel_dir:
+            kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
+            if not kernel_dir:
                 raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
 
         staging_kernel_dir = kernel_dir
@@ -203,14 +203,14 @@ class BootimgEFIPlugin(SourcePlugin):
             if source_params['loader'] == 'grub-efi':
                 shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir,
                                 "%s/grub.cfg" % cr_workdir)
-                for mod in [x for x in os.listdir(bootimg_dir) if x.startswith("grub-efi-")]:
-                    cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (bootimg_dir, mod, hdddir, mod[9:])
+                for mod in [x for x in os.listdir(kernel_dir) if x.startswith("grub-efi-")]:
+                    cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[9:])
                     exec_cmd(cp_cmd, True)
                 shutil.move("%s/grub.cfg" % cr_workdir,
                             "%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir)
             elif source_params['loader'] == 'systemd-boot':
                 for mod in [x for x in os.listdir(bootimg_dir) if x.startswith("systemd-")]:
-                    cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (bootimg_dir, mod, hdddir, mod[8:])
+                    cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[8:])
                     exec_cmd(cp_cmd, True)
             else:
                 raise WicError("unrecognized bootimg-efi loader: %s" %
@@ -218,7 +218,7 @@ class BootimgEFIPlugin(SourcePlugin):
         except KeyError:
             raise WicError("bootimg-efi requires a loader, none specified")
 
-        startup = os.path.join(bootimg_dir, "startup.nsh")
+        startup = os.path.join(kernel_dir, "startup.nsh")
         if os.path.exists(startup):
             cp_cmd = "cp %s %s/" % (startup, hdddir)
             exec_cmd(cp_cmd, True)
diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py
index 373e8d8..4afc8a2 100644
--- a/scripts/lib/wic/plugins/source/bootimg-partition.py
+++ b/scripts/lib/wic/plugins/source/bootimg-partition.py
@@ -78,12 +78,12 @@ class BootimgPartitionPlugin(SourcePlugin):
         install_cmd = "install -d %s" % hdddir
         exec_cmd(install_cmd)
 
-        if not bootimg_dir:
-            bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
-            if not bootimg_dir:
+        if not kernel_dir:
+            kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
+            if not kernel_dir:
                 raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
 
-        logger.debug('Bootimg dir: %s', bootimg_dir)
+        logger.debug('Kernel dir: %s', bootimg_dir)
 
         boot_files = get_bitbake_var("IMAGE_BOOT_FILES")
 
@@ -118,7 +118,7 @@ class BootimgPartitionPlugin(SourcePlugin):
                                     os.path.join(dst,
                                                  os.path.basename(name))
 
-                srcs = glob(os.path.join(bootimg_dir, src))
+                srcs = glob(os.path.join(kernel_dir, src))
 
                 logger.debug('Globbed sources: %s', ', '.join(srcs))
                 for entry in srcs:
@@ -127,7 +127,7 @@ class BootimgPartitionPlugin(SourcePlugin):
                                          os.path.join(hdddir,
                                                       entry_dst_name)))
             else:
-                install_task = [(os.path.join(bootimg_dir, src),
+                install_task = [(os.path.join(kernel_dir, src),
                                  os.path.join(hdddir, dst))]
 
             for task in install_task:
diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py
index bc71cf6f..431afce 100644
--- a/scripts/lib/wic/plugins/source/rawcopy.py
+++ b/scripts/lib/wic/plugins/source/rawcopy.py
@@ -59,17 +59,17 @@ class RawCopyPlugin(SourcePlugin):
         Called to do the actual content population for a partition i.e. it
         'prepares' the partition to be incorporated into the image.
         """
-        if not bootimg_dir:
-            bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
-            if not bootimg_dir:
+        if not kernel_dir:
+            kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
+            if not kernel_dir:
                 raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
 
-        logger.debug('Bootimg dir: %s', bootimg_dir)
+        logger.debug('Kernel dir: %s', kernel_dir)
 
         if 'file' not in source_params:
             raise WicError("No file specified")
 
-        src = os.path.join(bootimg_dir, source_params['file'])
+        src = os.path.join(kernel_dir, source_params['file'])
         dst = os.path.join(cr_workdir, "%s.%s" % (source_params['file'], part.lineno))
 
         if 'skip' in source_params:
-- 
2.1.4



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

* [PATCH 04/10] wic: fix bug in sparse_copy
  2017-03-22 13:42 [PATCH 00/10] #10618: Increase oe-selftest coverage of wic codebase (first part) Ed Bartosh
                   ` (2 preceding siblings ...)
  2017-03-22 13:42 ` [PATCH 03/10] wic: use kernel_dir instead of bootimg_dir Ed Bartosh
@ 2017-03-22 13:42 ` Ed Bartosh
  2017-03-22 13:42 ` [PATCH 05/10] wic: use STAGING_DATADIR as a default for bootimg_dir Ed Bartosh
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-03-22 13:42 UTC (permalink / raw)
  To: openembedded-core

sparse_copy creates output file that is smaller than input
file when input file ends with unmapped blocks.

Used truncate(<input file size>) when output file is created
to ensure the size of output file will always be equal to
the size of input file.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 scripts/lib/wic/filemap.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py
index 162603e..080668e 100644
--- a/scripts/lib/wic/filemap.py
+++ b/scripts/lib/wic/filemap.py
@@ -537,6 +537,7 @@ def sparse_copy(src_fname, dst_fname, offset=0, skip=0):
         dst_file = open(dst_fname, 'r+b')
     except IOError:
         dst_file = open(dst_fname, 'wb')
+        dst_file.truncate(os.path.getsize(src_fname))
 
     for first, last in fmap.get_mapped_ranges(0, fmap.blocks_cnt):
         start = first * fmap.block_size
-- 
2.1.4



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

* [PATCH 05/10] wic: use STAGING_DATADIR as a default for bootimg_dir
  2017-03-22 13:42 [PATCH 00/10] #10618: Increase oe-selftest coverage of wic codebase (first part) Ed Bartosh
                   ` (3 preceding siblings ...)
  2017-03-22 13:42 ` [PATCH 04/10] wic: fix bug in sparse_copy Ed Bartosh
@ 2017-03-22 13:42 ` Ed Bartosh
  2017-03-22 13:42 ` [PATCH 06/10] wic: remove empty plugin methods Ed Bartosh
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-03-22 13:42 UTC (permalink / raw)
  To: openembedded-core

Default value for bootimg_dir was not set in main wic script
unlike the rest of artifacts: kernel_dir, roofts_dir and
native_sysroot. Set it to the value of STAGING_DATADIR for
consistency and to avoid confusion of wic plugin developers.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 scripts/wic | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/scripts/wic b/scripts/wic
index 99721dc..8e9c05c 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -171,8 +171,6 @@ def wic_create_subcommand(args, usage_str):
     if options.build_check and not engine.verify_build_env():
         raise WicError("Couldn't verify build environment, exiting")
 
-    bootimg_dir = ""
-
     if options.debug:
         logger.setLevel(logging.DEBUG)
 
@@ -189,6 +187,7 @@ def wic_create_subcommand(args, usage_str):
 
         rootfs_dir = get_bitbake_var("IMAGE_ROOTFS", options.image_name)
         kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE", options.image_name)
+        bootimg_dir = get_bitbake_var("STAGING_DATADIR", options.image_name)
         native_sysroot = get_bitbake_var("RECIPE_SYSROOT_NATIVE",
                                          options.image_name) #, cache=False)
     else:
-- 
2.1.4



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

* [PATCH 06/10] wic: remove empty plugin methods
  2017-03-22 13:42 [PATCH 00/10] #10618: Increase oe-selftest coverage of wic codebase (first part) Ed Bartosh
                   ` (4 preceding siblings ...)
  2017-03-22 13:42 ` [PATCH 05/10] wic: use STAGING_DATADIR as a default for bootimg_dir Ed Bartosh
@ 2017-03-22 13:42 ` Ed Bartosh
  2017-03-22 13:42 ` [PATCH 07/10] wic: improve getting syslinux path Ed Bartosh
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-03-22 13:42 UTC (permalink / raw)
  To: openembedded-core

Removed do_install_disk and do_configure_partition methods from
bootimage-partition, fsimage and rawcopy plugins as they're empy
and not used.

[YOCTO #10618]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 scripts/lib/wic/plugins/source/bootimg-partition.py | 20 --------------------
 scripts/lib/wic/plugins/source/fsimage.py           | 19 -------------------
 scripts/lib/wic/plugins/source/rawcopy.py           | 19 -------------------
 3 files changed, 58 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py
index 4afc8a2..13fddbd 100644
--- a/scripts/lib/wic/plugins/source/bootimg-partition.py
+++ b/scripts/lib/wic/plugins/source/bootimg-partition.py
@@ -44,26 +44,6 @@ class BootimgPartitionPlugin(SourcePlugin):
     name = 'bootimg-partition'
 
     @classmethod
-    def do_install_disk(cls, disk, disk_name, cr, workdir, oe_builddir,
-                        bootimg_dir, kernel_dir, native_sysroot):
-        """
-        Called after all partitions have been prepared and assembled into a
-        disk image. Do nothing.
-        """
-        pass
-
-    @classmethod
-    def do_configure_partition(cls, part, source_params, cr, cr_workdir,
-                               oe_builddir, bootimg_dir, kernel_dir,
-                               native_sysroot):
-        """
-        Called before do_prepare_partition(). Possibly prepare
-        configuration files of some sort.
-
-        """
-        pass
-
-    @classmethod
     def do_prepare_partition(cls, part, source_params, cr, cr_workdir,
                              oe_builddir, bootimg_dir, kernel_dir,
                              rootfs_dir, native_sysroot):
diff --git a/scripts/lib/wic/plugins/source/fsimage.py b/scripts/lib/wic/plugins/source/fsimage.py
index 8fbe44d..f781499 100644
--- a/scripts/lib/wic/plugins/source/fsimage.py
+++ b/scripts/lib/wic/plugins/source/fsimage.py
@@ -32,25 +32,6 @@ class FSImagePlugin(SourcePlugin):
     name = 'fsimage'
 
     @classmethod
-    def do_install_disk(cls, disk, disk_name, cr, workdir, oe_builddir,
-                        bootimg_dir, kernel_dir, native_sysroot):
-        """
-        Called after all partitions have been prepared and assembled into a
-        disk image. Do nothing.
-        """
-        pass
-
-    @classmethod
-    def do_configure_partition(cls, part, source_params, cr, cr_workdir,
-                               oe_builddir, bootimg_dir, kernel_dir,
-                               native_sysroot):
-        """
-        Called before do_prepare_partition(). Possibly prepare
-        configuration files of some sort.
-        """
-        pass
-
-    @classmethod
     def do_prepare_partition(cls, part, source_params, cr, cr_workdir,
                              oe_builddir, bootimg_dir, kernel_dir,
                              rootfs_dir, native_sysroot):
diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py
index 431afce..e1c4f5e 100644
--- a/scripts/lib/wic/plugins/source/rawcopy.py
+++ b/scripts/lib/wic/plugins/source/rawcopy.py
@@ -33,25 +33,6 @@ class RawCopyPlugin(SourcePlugin):
     name = 'rawcopy'
 
     @classmethod
-    def do_install_disk(cls, disk, disk_name, cr, workdir, oe_builddir,
-                        bootimg_dir, kernel_dir, native_sysroot):
-        """
-        Called after all partitions have been prepared and assembled into a
-        disk image. Do nothing.
-        """
-        pass
-
-    @classmethod
-    def do_configure_partition(cls, part, source_params, cr, cr_workdir,
-                               oe_builddir, bootimg_dir, kernel_dir,
-                               native_sysroot):
-        """
-        Called before do_prepare_partition(). Possibly prepare
-        configuration files of some sort.
-        """
-        pass
-
-    @classmethod
     def do_prepare_partition(cls, part, source_params, cr, cr_workdir,
                              oe_builddir, bootimg_dir, kernel_dir,
                              rootfs_dir, native_sysroot):
-- 
2.1.4



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

* [PATCH 07/10] wic: improve getting syslinux path
  2017-03-22 13:42 [PATCH 00/10] #10618: Increase oe-selftest coverage of wic codebase (first part) Ed Bartosh
                   ` (5 preceding siblings ...)
  2017-03-22 13:42 ` [PATCH 06/10] wic: remove empty plugin methods Ed Bartosh
@ 2017-03-22 13:42 ` Ed Bartosh
  2017-03-22 13:42 ` [PATCH 08/10] oe-selftest: test wic rawcopy plugin Ed Bartosh
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-03-22 13:42 UTC (permalink / raw)
  To: openembedded-core

Used wic-tools STAGING_DATADIR if syslinux can't be found
in default bootimg_dir.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 scripts/lib/wic/plugins/source/bootimg-pcbios.py | 51 +++++++++++++-----------
 1 file changed, 27 insertions(+), 24 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
index 1779520..11db304 100644
--- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
@@ -44,17 +44,32 @@ class BootimgPcbiosPlugin(SourcePlugin):
     name = 'bootimg-pcbios'
 
     @classmethod
+    def _get_syslinux_dir(cls, bootimg_dir):
+        """
+        Get path to syslinux from either default bootimg_dir
+        or wic-tools STAGING_DIR.
+        """
+        for path in (bootimg_dir, get_bitbake_var("STAGING_DATADIR", "wic-tools")):
+            if not path:
+                continue
+            syslinux_dir = os.path.join(path, 'syslinux')
+            if os.path.exists(syslinux_dir):
+                return syslinux_dir
+
+        raise WicError("Couldn't find syslinux directory, exiting")
+
+    @classmethod
     def do_install_disk(cls, disk, disk_name, creator, workdir, oe_builddir,
                         bootimg_dir, kernel_dir, native_sysroot):
         """
         Called after all partitions have been prepared and assembled into a
         disk image.  In this case, we install the MBR.
         """
-        mbrfile = "%s/syslinux/" % bootimg_dir
+        syslinux_dir = cls._get_syslinux_dir(bootimg_dir)
         if creator.ptable_format == 'msdos':
-            mbrfile += "mbr.bin"
+            mbrfile = os.path.join(syslinux_dir, "mbr.bin")
         elif creator.ptable_format == 'gpt':
-            mbrfile += "gptmbr.bin"
+            mbrfile = os.path.join(syslinux_dir, "gptmbr.bin")
         else:
             raise WicError("Unsupported partition table: %s" %
                            creator.ptable_format)
@@ -140,19 +155,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
         'prepares' the partition to be incorporated into the image.
         In this case, prepare content for legacy bios boot partition.
         """
-        def _has_syslinux(dirname):
-            if dirname:
-                syslinux = "%s/syslinux" % dirname
-                if os.path.exists(syslinux):
-                    return True
-            return False
-
-        if not _has_syslinux(bootimg_dir):
-            bootimg_dir = get_bitbake_var("STAGING_DATADIR", "wic-tools")
-            if not bootimg_dir:
-                raise WicError("Couldn't find STAGING_DATADIR, exiting")
-            if not _has_syslinux(bootimg_dir):
-                raise WicError("Please build syslinux first")
+        syslinux_dir = cls._get_syslinux_dir(bootimg_dir)
 
         staging_kernel_dir = kernel_dir
 
@@ -160,14 +163,14 @@ class BootimgPcbiosPlugin(SourcePlugin):
 
         cmds = ("install -m 0644 %s/bzImage %s/vmlinuz" %
                 (staging_kernel_dir, hdddir),
-                "install -m 444 %s/syslinux/ldlinux.sys %s/ldlinux.sys" %
-                (bootimg_dir, hdddir),
-                "install -m 0644 %s/syslinux/vesamenu.c32 %s/vesamenu.c32" %
-                (bootimg_dir, hdddir),
-                "install -m 444 %s/syslinux/libcom32.c32 %s/libcom32.c32" %
-                (bootimg_dir, hdddir),
-                "install -m 444 %s/syslinux/libutil.c32 %s/libutil.c32" %
-                (bootimg_dir, hdddir))
+                "install -m 444 %s/ldlinux.sys %s/ldlinux.sys" %
+                (syslinux_dir, hdddir),
+                "install -m 0644 %s/vesamenu.c32 %s/vesamenu.c32" %
+                (syslinux_dir, hdddir),
+                "install -m 444 %s/libcom32.c32 %s/libcom32.c32" %
+                (syslinux_dir, hdddir),
+                "install -m 444 %s/libutil.c32 %s/libutil.c32" %
+                (syslinux_dir, hdddir))
 
         for install_cmd in cmds:
             exec_cmd(install_cmd)
-- 
2.1.4



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

* [PATCH 08/10] oe-selftest: test wic rawcopy plugin
  2017-03-22 13:42 [PATCH 00/10] #10618: Increase oe-selftest coverage of wic codebase (first part) Ed Bartosh
                   ` (6 preceding siblings ...)
  2017-03-22 13:42 ` [PATCH 07/10] wic: improve getting syslinux path Ed Bartosh
@ 2017-03-22 13:42 ` Ed Bartosh
  2017-03-22 13:42 ` [PATCH 09/10] selftest: pylinted wic test suite Ed Bartosh
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-03-22 13:42 UTC (permalink / raw)
  To: openembedded-core

Added test_rawcopy_plugin_qemu test case and wks template.

This test builds ext4 rootfs image, copies it to the root
partition of the wic image using rawcopy plugin and
boots wic image in qemu.

[YOCTO #10618]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 meta-selftest/wic/test_rawcopy_plugin.wks.in |  6 ++++++
 meta/lib/oeqa/selftest/wic.py                | 16 ++++++++++++++++
 2 files changed, 22 insertions(+)
 create mode 100644 meta-selftest/wic/test_rawcopy_plugin.wks.in

diff --git a/meta-selftest/wic/test_rawcopy_plugin.wks.in b/meta-selftest/wic/test_rawcopy_plugin.wks.in
new file mode 100644
index 0000000..83be4be
--- /dev/null
+++ b/meta-selftest/wic/test_rawcopy_plugin.wks.in
@@ -0,0 +1,6 @@
+# short-description: This file is used in oe-selftest wic module to test rawcopy plugin
+
+part /boot --active --source bootimg-pcbios
+part / --source rawcopy --sourceparams="file=core-image-minimal-${MACHINE}.ext4" --use-uuid
+
+bootloader  --timeout=0 --append="console=ttyS0,115200n8"
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index 4aacd86..2e22362 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -681,3 +681,19 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
         os.remove(wkspath)
         wicout = glob(self.resultdir + "%s-*direct" % wksname)
         self.assertEqual(0, len(wicout))
+
+    @only_for_arch(['i586', 'i686', 'x86_64'])
+    def test_rawcopy_plugin_qemu(self):
+        """Test rawcopy plugin in qemu"""
+        # build ext4 and wic images
+        for fstype in ("ext4", "wic"):
+            config = 'IMAGE_FSTYPES = "%s"\nWKS_FILE = "test_rawcopy_plugin.wks.in"\n' % fstype
+            self.append_config(config)
+            self.assertEqual(0, bitbake('core-image-minimal').status)
+            self.remove_config(config)
+
+        with runqemu('core-image-minimal', ssh=False, image_fstype='wic') as qemu:
+            cmd = "grep vda. /proc/partitions  |wc -l"
+            status, output = qemu.run_serial(cmd)
+            self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
+            self.assertEqual(output, '2')
-- 
2.1.4



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

* [PATCH 09/10] selftest: pylinted wic test suite.
  2017-03-22 13:42 [PATCH 00/10] #10618: Increase oe-selftest coverage of wic codebase (first part) Ed Bartosh
                   ` (7 preceding siblings ...)
  2017-03-22 13:42 ` [PATCH 08/10] oe-selftest: test wic rawcopy plugin Ed Bartosh
@ 2017-03-22 13:42 ` Ed Bartosh
  2017-03-22 13:42 ` [PATCH 10/10] oe-selftest: add test_rawcopy_plugin test case Ed Bartosh
  2017-03-22 20:53 ` ✗ patchtest: failure for #10618: Increase oe-selftest coverage of wic codebase (first part) Patchwork
  10 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-03-22 13:42 UTC (permalink / raw)
  To: openembedded-core

Fixed long lines, indentation and one unused variable.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 meta/lib/oeqa/selftest/wic.py | 52 +++++++++++++++++++++++--------------------
 1 file changed, 28 insertions(+), 24 deletions(-)

diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index 2e22362..327dd07 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -210,7 +210,7 @@ class Wic(oeSelfTest):
 
     @testcase(1385)
     @only_for_arch(['i586', 'i686', 'x86_64'])
-    def test_directdisk_bootloader_config(self):
+    def test_bootloader_config(self):
         """Test creation of directdisk-bootloader-config image"""
         cmd = "wic create directdisk-bootloader-config -e core-image-minimal -o %s" % self.resultdir
         self.assertEqual(0, runCmd(cmd).status)
@@ -252,9 +252,9 @@ class Wic(oeSelfTest):
     def test_build_artifacts(self):
         """Test wic create directdisk providing all artifacts."""
         bb_vars = get_bb_vars(['STAGING_DATADIR', 'RECIPE_SYSROOT_NATIVE'],
-                               'wic-tools')
+                              'wic-tools')
         bb_vars.update(get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'],
-                                 'core-image-minimal'))
+                                   'core-image-minimal'))
         bbvars = {key.lower(): value for key, value in bb_vars.items()}
         bbvars['resultdir'] = self.resultdir
         status = runCmd("wic create directdisk "
@@ -362,9 +362,9 @@ class Wic(oeSelfTest):
     def test_rootfs_artifacts(self):
         """Test usage of rootfs plugin with rootfs paths"""
         bb_vars = get_bb_vars(['STAGING_DATADIR', 'RECIPE_SYSROOT_NATIVE'],
-                               'wic-tools')
+                              'wic-tools')
         bb_vars.update(get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'],
-                                 'core-image-minimal'))
+                                   'core-image-minimal'))
         bbvars = {key.lower(): value for key, value in bb_vars.items()}
         bbvars['wks'] = "directdisk-multi-rootfs"
         bbvars['resultdir'] = self.resultdir
@@ -388,7 +388,8 @@ class Wic(oeSelfTest):
             wks_file = 'temp.wks'
             with open(wks_file, 'w') as wks:
                 rootfs_dir = get_bb_var('IMAGE_ROOTFS', 'core-image-minimal')
-                wks.write("""part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path usr
+                wks.write("""
+part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path usr
 part /usr --source rootfs --ondisk mmcblk0 --fstype=ext4 --rootfs-dir %s/usr
 part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --rootfs-dir %s/usr"""
                           % (rootfs_dir, rootfs_dir))
@@ -423,25 +424,27 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
                                            (wicimg, part_file, start, length)).status)
 
             def extract_files(debugfs_output):
-                # extract file names from the output of debugfs -R 'ls -p',
-                # which looks like this:
-                #
-                # /2/040755/0/0/.//\n
-                # /2/040755/0/0/..//\n
-                # /11/040700/0/0/lost+found^M//\n
-                # /12/040755/1002/1002/run//\n
-                # /13/040755/1002/1002/sys//\n
-                # /14/040755/1002/1002/bin//\n
-                # /80/040755/1002/1002/var//\n
-                # /92/040755/1002/1002/tmp//\n
-                #
+                """
+                extract file names from the output of debugfs -R 'ls -p',
+                which looks like this:
+
+                 /2/040755/0/0/.//\n
+                 /2/040755/0/0/..//\n
+                 /11/040700/0/0/lost+found^M//\n
+                 /12/040755/1002/1002/run//\n
+                 /13/040755/1002/1002/sys//\n
+                 /14/040755/1002/1002/bin//\n
+                 /80/040755/1002/1002/var//\n
+                 /92/040755/1002/1002/tmp//\n
+                """
                 # NOTE the occasional ^M in file names
                 return [line.split('/')[5].strip() for line in \
                         debugfs_output.strip().split('/\n')]
 
             # Test partition 1, should contain the normal root directories, except
             # /usr.
-            res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part1"))
+            res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % \
+                             os.path.join(self.resultdir, "selftest_img.part1"))
             self.assertEqual(0, res.status)
             files = extract_files(res.output)
             self.assertIn("etc", files)
@@ -449,7 +452,8 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
 
             # Partition 2, should contain common directories for /usr, not root
             # directories.
-            res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part2"))
+            res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % \
+                             os.path.join(self.resultdir, "selftest_img.part2"))
             self.assertEqual(0, res.status)
             files = extract_files(res.output)
             self.assertNotIn("etc", files)
@@ -458,14 +462,16 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
 
             # Partition 3, should contain the same as partition 2, including the bin
             # directory, but not the files inside it.
-            res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part3"))
+            res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % \
+                             os.path.join(self.resultdir, "selftest_img.part3"))
             self.assertEqual(0, res.status)
             files = extract_files(res.output)
             self.assertNotIn("etc", files)
             self.assertNotIn("usr", files)
             self.assertIn("share", files)
             self.assertIn("bin", files)
-            res = runCmd("debugfs -R 'ls -p bin' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part3"))
+            res = runCmd("debugfs -R 'ls -p bin' %s 2>/dev/null" % \
+                             os.path.join(self.resultdir, "selftest_img.part3"))
             self.assertEqual(0, res.status)
             files = extract_files(res.output)
             self.assertIn(".", files)
@@ -483,8 +489,6 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
         """Test --exclude-path wks option error handling."""
         wks_file = 'temp.wks'
 
-        rootfs_dir = get_bb_var('IMAGE_ROOTFS', 'core-image-minimal')
-
         # Absolute argument.
         with open(wks_file, 'w') as wks:
             wks.write("part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path /usr")
-- 
2.1.4



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

* [PATCH 10/10] oe-selftest: add test_rawcopy_plugin test case
  2017-03-22 13:42 [PATCH 00/10] #10618: Increase oe-selftest coverage of wic codebase (first part) Ed Bartosh
                   ` (8 preceding siblings ...)
  2017-03-22 13:42 ` [PATCH 09/10] selftest: pylinted wic test suite Ed Bartosh
@ 2017-03-22 13:42 ` Ed Bartosh
  2017-03-22 20:53 ` ✗ patchtest: failure for #10618: Increase oe-selftest coverage of wic codebase (first part) Patchwork
  10 siblings, 0 replies; 15+ messages in thread
From: Ed Bartosh @ 2017-03-22 13:42 UTC (permalink / raw)
  To: openembedded-core

This test case builds wic image using rawcopy plugin
running wic directly.

[YOCTO #10618]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 meta/lib/oeqa/selftest/wic.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index 327dd07..ee633f8 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -701,3 +701,19 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
             status, output = qemu.run_serial(cmd)
             self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
             self.assertEqual(output, '2')
+
+    def test_rawcopy_plugin(self):
+        """Test rawcopy plugin"""
+        img = 'core-image-minimal'
+        machine = get_bb_var('MACHINE', img)
+        with NamedTemporaryFile("w", suffix=".wks") as wks:
+            wks.writelines(['part /boot --active --source bootimg-pcbios\n',
+                            'part / --source rawcopy --sourceparams="file=%s-%s.ext4" --use-uuid\n'\
+                             % (img, machine),
+                            'bootloader --timeout=0 --append="console=ttyS0,115200n8"\n'])
+            wks.flush()
+            cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir)
+            self.assertEqual(0, runCmd(cmd).status)
+            wksname = os.path.splitext(os.path.basename(wks.name))[0]
+            out = glob(self.resultdir + "%s-*direct" % wksname)
+            self.assertEqual(1, len(out))
-- 
2.1.4



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

* ✗ patchtest: failure for #10618: Increase oe-selftest coverage of wic codebase (first part)
  2017-03-22 13:42 [PATCH 00/10] #10618: Increase oe-selftest coverage of wic codebase (first part) Ed Bartosh
                   ` (9 preceding siblings ...)
  2017-03-22 13:42 ` [PATCH 10/10] oe-selftest: add test_rawcopy_plugin test case Ed Bartosh
@ 2017-03-22 20:53 ` Patchwork
  2017-03-23  2:57   ` Paul Eggleton
  10 siblings, 1 reply; 15+ messages in thread
From: Patchwork @ 2017-03-22 20:53 UTC (permalink / raw)
  To: Ed Bartosh; +Cc: openembedded-core

== Series Details ==

Series: #10618: Increase oe-selftest coverage of wic codebase (first part)
Revision: 1
URL   : https://patchwork.openembedded.org/series/5923/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following results:



* Issue             [pretest_src_uri_checksums_not_changed] 

* Issue             No modified recipes, skipping pretest [pretest_src_uri_left_files] 

* Issue             No added or modified recipes, skipping pretest [pretest_lic_files_chksum_modified_not_mentioned] 

* Issue             [pretest_pylint] 

* Issue             [test_max_line_length] 

* Issue             [test_cve_presence_in_commit_message] 

* Issue             [test_cve_tag_format] 

* Issue             [test_shortlog_format] 

* Issue             [test_shortlog_length] 

* Issue             [test_summary_presence] 

* Issue             [test_upstream_status_format] 

* Issue             There are no new software patches, no reason to test Upstream-Status presence [test_upstream_status_presence] 

* Issue             Until general agreement with the community, disabling it [test_commit_message_presence] 

* Issue             [test_mbox_format] 

* Issue             [test_series_merge_on_head] 

* Issue             [test_src_uri_checksums_not_changed] 

* Issue             No modified recipes, skipping pretest [test_src_uri_left_files] 

* Issue             [test_bugzilla_entry_format] 

* Issue             [test_signed_off_by_presence] 

* Issue             There are no new software patches, no reason to test Signed-off-by presence [test_signed_off_by_presence] 

* Issue             Series merged, no reason to check other mailing lists [test_target_mailing_list] 

* Issue             No modified or added recipes, skipping test [test_lic_files_chksum_modified_not_mentioned] 

* Issue             No added recipes, skipping test [test_lic_files_chksum_presence] 

* Issue             [test_pylint] 

* Issue             [test_author_valid] 



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe



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

* Re: ✗ patchtest: failure for #10618: Increase oe-selftest coverage of wic codebase (first part)
  2017-03-22 20:53 ` ✗ patchtest: failure for #10618: Increase oe-selftest coverage of wic codebase (first part) Patchwork
@ 2017-03-23  2:57   ` Paul Eggleton
  2017-03-23 16:35     ` Leonardo Sandoval
  2017-03-23 16:36     ` Leonardo Sandoval
  0 siblings, 2 replies; 15+ messages in thread
From: Paul Eggleton @ 2017-03-23  2:57 UTC (permalink / raw)
  To: Leonardo Sandoval; +Cc: openembedded-core

Hi Leo,

On Thursday, 23 March 2017 9:53:31 AM NZDT Patchwork wrote:
> == Series Details ==
> 
> Series: #10618: Increase oe-selftest coverage of wic codebase (first part)
> Revision: 1
> URL   : https://patchwork.openembedded.org/series/5923/
> State : failure
> 
> == Summary ==
> 
> 
> Thank you for submitting this patch series to OpenEmbedded Core. This is
> an automated response. Several tests have been executed on the proposed
> series by patchtest resulting in the following results:
> 
> 
> 
> * Issue             [pretest_src_uri_checksums_not_changed]
> 
> * Issue             No modified recipes, skipping pretest
> [pretest_src_uri_left_files]
> 
> * Issue             No added or modified recipes, skipping pretest
> [pretest_lic_files_chksum_modified_not_mentioned]
> 
> * Issue             [pretest_pylint]
> 
> * Issue             [test_max_line_length]
> 
> * Issue             [test_cve_presence_in_commit_message]
> 
> * Issue             [test_cve_tag_format]
> 
> * Issue             [test_shortlog_format]
> 
> * Issue             [test_shortlog_length]
> 
> * Issue             [test_summary_presence]
> 
> * Issue             [test_upstream_status_format]
> 
> * Issue             There are no new software patches, no reason to test
> Upstream-Status presence [test_upstream_status_presence]
> 
> * Issue             Until general agreement with the community, disabling it
> [test_commit_message_presence]
> 
> * Issue             [test_mbox_format]
> 
> * Issue             [test_series_merge_on_head]
> 
> * Issue             [test_src_uri_checksums_not_changed]
> 
> * Issue             No modified recipes, skipping pretest
> [test_src_uri_left_files]
> 
> * Issue             [test_bugzilla_entry_format]
> 
> * Issue             [test_signed_off_by_presence]
> 
> * Issue             There are no new software patches, no reason to test
> Signed-off-by presence [test_signed_off_by_presence]
> 
> * Issue             Series merged, no reason to check other mailing lists
> [test_target_mailing_list]
> 
> * Issue             No modified or added recipes, skipping test
> [test_lic_files_chksum_modified_not_mentioned]
> 
> * Issue             No added recipes, skipping test
> [test_lic_files_chksum_presence]
> 
> * Issue             [test_pylint]
> 
> * Issue             [test_author_valid]

These results look a bit broken - some are skipped and really shouldn't be 
showing at all. Was the script invoked in a different way to normal?

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


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

* Re: ✗ patchtest: failure for #10618: Increase oe-selftest coverage of wic codebase (first part)
  2017-03-23  2:57   ` Paul Eggleton
@ 2017-03-23 16:35     ` Leonardo Sandoval
  2017-03-23 16:36     ` Leonardo Sandoval
  1 sibling, 0 replies; 15+ messages in thread
From: Leonardo Sandoval @ 2017-03-23 16:35 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: openembedded-core

On Thu, 2017-03-23 at 15:57 +1300, Paul Eggleton wrote:
> Hi Leo,
> 
> On Thursday, 23 March 2017 9:53:31 AM NZDT Patchwork wrote:
> > == Series Details ==
> > 
> > Series: #10618: Increase oe-selftest coverage of wic codebase (first part)
> > Revision: 1
> > URL   : https://patchwork.openembedded.org/series/5923/
> > State : failure
> > 
> > == Summary ==
> > 
> > 
> > Thank you for submitting this patch series to OpenEmbedded Core. This is
> > an automated response. Several tests have been executed on the proposed
> > series by patchtest resulting in the following results:
> > 
> > 
> > 
> > * Issue             [pretest_src_uri_checksums_not_changed]
> > 
> > * Issue             No modified recipes, skipping pretest
> > [pretest_src_uri_left_files]
> > 
> > * Issue             No added or modified recipes, skipping pretest
> > [pretest_lic_files_chksum_modified_not_mentioned]
> > 
> > * Issue             [pretest_pylint]
> > 
> > * Issue             [test_max_line_length]
> > 
> > * Issue             [test_cve_presence_in_commit_message]
> > 
> > * Issue             [test_cve_tag_format]
> > 
> > * Issue             [test_shortlog_format]
> > 
> > * Issue             [test_shortlog_length]
> > 
> > * Issue             [test_summary_presence]
> > 
> > * Issue             [test_upstream_status_format]
> > 
> > * Issue             There are no new software patches, no reason to test
> > Upstream-Status presence [test_upstream_status_presence]
> > 
> > * Issue             Until general agreement with the community, disabling it
> > [test_commit_message_presence]
> > 
> > * Issue             [test_mbox_format]
> > 
> > * Issue             [test_series_merge_on_head]
> > 
> > * Issue             [test_src_uri_checksums_not_changed]
> > 
> > * Issue             No modified recipes, skipping pretest
> > [test_src_uri_left_files]
> > 
> > * Issue             [test_bugzilla_entry_format]
> > 
> > * Issue             [test_signed_off_by_presence]
> > 
> > * Issue             There are no new software patches, no reason to test
> > Signed-off-by presence [test_signed_off_by_presence]
> > 
> > * Issue             Series merged, no reason to check other mailing lists
> > [test_target_mailing_list]
> > 
> > * Issue             No modified or added recipes, skipping test
> > [test_lic_files_chksum_modified_not_mentioned]
> > 
> > * Issue             No added recipes, skipping test
> > [test_lic_files_chksum_presence]
> > 
> > * Issue             [test_pylint]
> > 
> > * Issue             [test_author_valid]
> 
> These results look a bit broken - some are skipped and really shouldn't be 
> showing at all. Was the script invoked in a different way to normal?
> 

Yes, it was invoked in a different way so there was not filtering on
failures. From now on, we should be getting emails just with test
failures.

Leo
> Cheers,
> Paul
> 
> -- 
> 
> Paul Eggleton
> Intel Open Source Technology Centre




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

* Re: ✗ patchtest: failure for #10618: Increase oe-selftest coverage of wic codebase (first part)
  2017-03-23  2:57   ` Paul Eggleton
  2017-03-23 16:35     ` Leonardo Sandoval
@ 2017-03-23 16:36     ` Leonardo Sandoval
  1 sibling, 0 replies; 15+ messages in thread
From: Leonardo Sandoval @ 2017-03-23 16:36 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: openembedded-core

On Thu, 2017-03-23 at 15:57 +1300, Paul Eggleton wrote:
> Hi Leo,
> 
> On Thursday, 23 March 2017 9:53:31 AM NZDT Patchwork wrote:
> > == Series Details ==
> > 
> > Series: #10618: Increase oe-selftest coverage of wic codebase (first part)
> > Revision: 1
> > URL   : https://patchwork.openembedded.org/series/5923/
> > State : failure
> > 
> > == Summary ==
> > 
> > 
> > Thank you for submitting this patch series to OpenEmbedded Core. This is
> > an automated response. Several tests have been executed on the proposed
> > series by patchtest resulting in the following results:
> > 
> > 
> > 
> > * Issue             [pretest_src_uri_checksums_not_changed]
> > 
> > * Issue             No modified recipes, skipping pretest
> > [pretest_src_uri_left_files]
> > 
> > * Issue             No added or modified recipes, skipping pretest
> > [pretest_lic_files_chksum_modified_not_mentioned]
> > 
> > * Issue             [pretest_pylint]
> > 
> > * Issue             [test_max_line_length]
> > 
> > * Issue             [test_cve_presence_in_commit_message]
> > 
> > * Issue             [test_cve_tag_format]
> > 
> > * Issue             [test_shortlog_format]
> > 
> > * Issue             [test_shortlog_length]
> > 
> > * Issue             [test_summary_presence]
> > 
> > * Issue             [test_upstream_status_format]
> > 
> > * Issue             There are no new software patches, no reason to test
> > Upstream-Status presence [test_upstream_status_presence]
> > 
> > * Issue             Until general agreement with the community, disabling it
> > [test_commit_message_presence]
> > 
> > * Issue             [test_mbox_format]
> > 
> > * Issue             [test_series_merge_on_head]
> > 
> > * Issue             [test_src_uri_checksums_not_changed]
> > 
> > * Issue             No modified recipes, skipping pretest
> > [test_src_uri_left_files]
> > 
> > * Issue             [test_bugzilla_entry_format]
> > 
> > * Issue             [test_signed_off_by_presence]
> > 
> > * Issue             There are no new software patches, no reason to test
> > Signed-off-by presence [test_signed_off_by_presence]
> > 
> > * Issue             Series merged, no reason to check other mailing lists
> > [test_target_mailing_list]
> > 
> > * Issue             No modified or added recipes, skipping test
> > [test_lic_files_chksum_modified_not_mentioned]
> > 
> > * Issue             No added recipes, skipping test
> > [test_lic_files_chksum_presence]
> > 
> > * Issue             [test_pylint]
> > 
> > * Issue             [test_author_valid]
> 
> These results look a bit broken - some are skipped and really shouldn't be 
> showing at all. Was the script invoked in a different way to normal?
> 

Yes, it was invoked in a different way (there was not filtering on
failures). From now on, we should be getting emails just with test
failures. 

Leo

> Cheers,
> Paul
> 
> -- 
> 
> Paul Eggleton
> Intel Open Source Technology Centre




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

end of thread, other threads:[~2017-03-23 16:28 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-22 13:42 [PATCH 00/10] #10618: Increase oe-selftest coverage of wic codebase (first part) Ed Bartosh
2017-03-22 13:42 ` [PATCH 01/10] wic: remove rootfs_pcbios_ext plugin Ed Bartosh
2017-03-22 13:42 ` [PATCH 02/10] wic: don't set creator.bootimg_dir in plugins Ed Bartosh
2017-03-22 13:42 ` [PATCH 03/10] wic: use kernel_dir instead of bootimg_dir Ed Bartosh
2017-03-22 13:42 ` [PATCH 04/10] wic: fix bug in sparse_copy Ed Bartosh
2017-03-22 13:42 ` [PATCH 05/10] wic: use STAGING_DATADIR as a default for bootimg_dir Ed Bartosh
2017-03-22 13:42 ` [PATCH 06/10] wic: remove empty plugin methods Ed Bartosh
2017-03-22 13:42 ` [PATCH 07/10] wic: improve getting syslinux path Ed Bartosh
2017-03-22 13:42 ` [PATCH 08/10] oe-selftest: test wic rawcopy plugin Ed Bartosh
2017-03-22 13:42 ` [PATCH 09/10] selftest: pylinted wic test suite Ed Bartosh
2017-03-22 13:42 ` [PATCH 10/10] oe-selftest: add test_rawcopy_plugin test case Ed Bartosh
2017-03-22 20:53 ` ✗ patchtest: failure for #10618: Increase oe-selftest coverage of wic codebase (first part) Patchwork
2017-03-23  2:57   ` Paul Eggleton
2017-03-23 16:35     ` Leonardo Sandoval
2017-03-23 16:36     ` Leonardo Sandoval

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.