[OE-core] [PATCH] glib-2.0: native package should not depend on DISTRO_FEATURES

2017-01-20 Thread Gary Thomas
xxx-native packages should not depend on ${DISTRO} settings.  Doing
so feels inherently wrong and limits the usefulness of sstate-cache.

This patch changes how this package is installed, in particular
removing the dependency on the ${DISTRO_FEATURES} variable in
glib-2.0-native.  This will further improve the ability to share
native packages between builds with differences in ${DISTRO_FEATURES}

Signed-off-by: Gary Thomas 
---
 meta/recipes-core/glib-2.0/glib.inc | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-core/glib-2.0/glib.inc 
b/meta/recipes-core/glib-2.0/glib.inc
index cb6aca7..a5db455 100644
--- a/meta/recipes-core/glib-2.0/glib.inc
+++ b/meta/recipes-core/glib-2.0/glib.inc
@@ -92,16 +92,20 @@ do_install_append () {
sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' 
${D}${bindir}/glib-mkenums
fi
 
+# Make sure gio-querymodules is unique among multilibs
+if test "x${MLPREFIX}" != "x"; then
+mv ${D}${libexecdir}/gio-querymodules 
${D}${libexecdir}/${MLPREFIX}gio-querymodules
+fi
+}
+
+do_install_append_class-target () {
+   # Tests are only installed on targets, not native builds.  Separating 
this out
+   # keeps glib-2.0-native from depending on ${DISTRO_FEATURES}
if [ -f ${D}${datadir}/installed-tests/glib/gdbus-serialization.test ]; 
then
if ${@bb.utils.contains("DISTRO_FEATURES", "x11", "false", 
"true", d)}; then
rm 
${D}${datadir}/installed-tests/glib/gdbus-serialization.test
fi
fi
-
-# Make sure gio-querymodules is unique among multilibs
-if test "x${MLPREFIX}" != "x"; then
-mv ${D}${libexecdir}/gio-querymodules 
${D}${libexecdir}/${MLPREFIX}gio-querymodules
-fi
 }
 
 do_install_append_libc-musl () {
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH V2] alsa-lib: update 1.1.2 -> 1.1.3

2017-01-20 Thread Tanu Kaskinen
On Sat, 2017-01-21 at 00:16 +, Burton, Ross wrote:
> On 21 January 2017 at 00:12, Burton, Ross  wrote:
> 
> > Computing transaction...warning: Can't install
> > alsa-lib-dev-1.1.3-r0.0@core2_32: Can't install
> > alsa-lib-dev-1.1.3-r0.0@core2_32: no package provides alsa-lib =
> > 1.1.3-r0.0
> > 
> 
> Had a ten second look at 1.1.2, there's an alsa-lib package that contains
> /usr/lib/alsa-lib/smixer/*.so.  If these disappeared (or were
> non-deterministic) in the 1.1.3 build alsa-lib itself would be empty, and
> the dependency would break.

The smixer libraries indeed disappeared in 1.1.3 (when python support
isn't enabled):
http://git.alsa-project.org/?p=alsa-lib.git;a=commit;h=a668a94238dc67b19ae187b52a161e027d79ee5d

-- 
Tanu

https://www.patreon.com/tanuk
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH V2] alsa-lib: update 1.1.2 -> 1.1.3

2017-01-20 Thread Burton, Ross
On 21 January 2017 at 00:12, Burton, Ross  wrote:

> Computing transaction...warning: Can't install
> alsa-lib-dev-1.1.3-r0.0@core2_32: Can't install
> alsa-lib-dev-1.1.3-r0.0@core2_32: no package provides alsa-lib =
> 1.1.3-r0.0
>

Had a ten second look at 1.1.2, there's an alsa-lib package that contains
/usr/lib/alsa-lib/smixer/*.so.  If these disappeared (or were
non-deterministic) in the 1.1.3 build alsa-lib itself would be empty, and
the dependency would break.

Ross
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH V2] alsa-lib: update 1.1.2 -> 1.1.3

2017-01-20 Thread Burton, Ross
For some reason the autobuilder is having a meltdown with this error
message:

Computing transaction...warning: Can't install
alsa-lib-dev-1.1.3-r0.0@core2_32: Can't install
alsa-lib-dev-1.1.3-r0.0@core2_32: no package provides alsa-lib = 1.1.3-r0.0

I'm guessing a new file sneaked into the build which changes library names,
or something?  If you can get a moment to compare buildhistory-diff with
1.1.2 and 1.1.3 then that would be much appreciated.  I'll have a look
later, but right now I'm going to bed.. :)

Ross

On 20 January 2017 at 13:11, Andreas Müller 
wrote:

> Signed-off-by: Andreas Müller 
> ---
>  .../alsa-lib/0001-ucm-parser-needs-limits.h.patch  | 33
> ++
>  .../alsa/{alsa-lib_1.1.2.bb => alsa-lib_1.1.3.bb}  |  5 ++--
>  2 files changed, 36 insertions(+), 2 deletions(-)
>  create mode 100644 meta/recipes-multimedia/alsa/alsa-lib/0001-ucm-parser-
> needs-limits.h.patch
>  rename meta/recipes-multimedia/alsa/{alsa-lib_1.1.2.bb =>
> alsa-lib_1.1.3.bb} (87%)
>
> diff --git 
> a/meta/recipes-multimedia/alsa/alsa-lib/0001-ucm-parser-needs-limits.h.patch
> b/meta/recipes-multimedia/alsa/alsa-lib/0001-ucm-parser-
> needs-limits.h.patch
> new file mode 100644
> index 000..9d464f4
> --- /dev/null
> +++ b/meta/recipes-multimedia/alsa/alsa-lib/0001-ucm-parser-
> needs-limits.h.patch
> @@ -0,0 +1,33 @@
> +From 9ed4075f05a4242f32331f7f2c365767970f5003 Mon Sep 17 00:00:00 2001
> +From: Gustavo Zacarias 
> +Date: Wed, 21 Dec 2016 19:46:34 -0300
> +Subject: [PATCH] ucm: parser needs limits.h
> +
> +It's using PATH_MAX which is defined there, otherwise the build fails on
> +musl libc.
> +
> +Signed-off-by: Gustavo Zacarias 
> +Signed-off-by: Takashi Iwai 
> +
> +Upstream-Status: Backport [1]
> +
> +[1] http://git.alsa-project.org/?p=alsa-lib.git;a=commit;h=
> 9ed4075f05a4242f32331f7f2c365767970f5003
> +---
> + src/ucm/parser.c | 1 +
> + 1 file changed, 1 insertion(+)
> +
> +diff --git a/src/ucm/parser.c b/src/ucm/parser.c
> +index c98373a..f520abc 100644
> +--- a/src/ucm/parser.c
>  b/src/ucm/parser.c
> +@@ -32,6 +32,7 @@
> +
> + #include "ucm_local.h"
> + #include 
> ++#include 
> +
> + /** The name of the environment variable containing the UCM directory */
> + #define ALSA_CONFIG_UCM_VAR "ALSA_CONFIG_UCM"
> +--
> +2.7.4
> +
> diff --git a/meta/recipes-multimedia/alsa/alsa-lib_1.1.2.bb
> b/meta/recipes-multimedia/alsa/alsa-lib_1.1.3.bb
> similarity index 87%
> rename from meta/recipes-multimedia/alsa/alsa-lib_1.1.2.bb
> rename to meta/recipes-multimedia/alsa/alsa-lib_1.1.3.bb
> index e313da7..9a8a167 100644
> --- a/meta/recipes-multimedia/alsa/alsa-lib_1.1.2.bb
> +++ b/meta/recipes-multimedia/alsa/alsa-lib_1.1.3.bb
> @@ -11,9 +11,10 @@ BBCLASSEXTEND = "native nativesdk"
>  SRC_URI = "ftp://ftp.alsa-project.org/pub/lib/${BP}.tar.bz2 \
> file://Check-if-wordexp-function-is-supported.patch \
> file://avoid-including-sys-poll.h-directly.patch \
> +   file://0001-ucm-parser-needs-limits.h.patch \
>  "
> -SRC_URI[md5sum] = "1946e6438b8262a7b8fdadacd0e06ba7"
> -SRC_URI[sha256sum] = "d38dacd9892b06b8bff04923c380b3
> 8fb2e379ee5538935ff37e45b395d861d6"
> +SRC_URI[md5sum] = "eefe5992567ba00d6110a540657aaf5c"
> +SRC_URI[sha256sum] = "71282502184c592c1a008e256c22ed
> 0ba5728ca65e05273ceb480c70f515969c"
>
>  inherit autotools pkgconfig
>
> --
> 2.7.4
>
> --
> ___
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCHv3] qemu: Upgrade to 2.7.1

2017-01-20 Thread Aníbal Limón
Minor upgrade contains fixes from 2.7.0.

Removed patches (already in upstream):

- 0001-pci-assign-sync-MSI-MSI-X-cap-and-table-with-PCIDevi.patch
- 0001-virtio-zero-vq-inuse-in-virtio_reset.patch
- 0002-fix-CVE-2016-7423.patch

Signed-off-by: Aníbal Limón 
---
 meta/recipes-devtools/qemu/qemu.inc|  2 -
 ...sync-MSI-MSI-X-cap-and-table-with-PCIDevi.patch | 71 --
 ...0001-virtio-zero-vq-inuse-in-virtio_reset.patch | 57 -
 .../qemu/qemu/0002-fix-CVE-2016-7423.patch | 45 --
 .../qemu/{qemu_2.7.0.bb => qemu_2.7.1.bb}  | 10 ++-
 5 files changed, 4 insertions(+), 181 deletions(-)
 delete mode 100644 
meta/recipes-devtools/qemu/qemu/0001-pci-assign-sync-MSI-MSI-X-cap-and-table-with-PCIDevi.patch
 delete mode 100644 
meta/recipes-devtools/qemu/qemu/0001-virtio-zero-vq-inuse-in-virtio_reset.patch
 delete mode 100644 meta/recipes-devtools/qemu/qemu/0002-fix-CVE-2016-7423.patch
 rename meta/recipes-devtools/qemu/{qemu_2.7.0.bb => qemu_2.7.1.bb} (66%)

diff --git a/meta/recipes-devtools/qemu/qemu.inc 
b/meta/recipes-devtools/qemu/qemu.inc
index b46e7f7..ac5fcac 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -9,8 +9,6 @@ require qemu-targets.inc
 inherit autotools ptest
 BBCLASSEXTEND = "native nativesdk"
 
-PR = "r1"
-
 # QEMU_TARGETS is overridable variable
 QEMU_TARGETS ?= "arm aarch64 i386 mips mipsel mips64 mips64el ppc sh4 x86_64"
 
diff --git 
a/meta/recipes-devtools/qemu/qemu/0001-pci-assign-sync-MSI-MSI-X-cap-and-table-with-PCIDevi.patch
 
b/meta/recipes-devtools/qemu/qemu/0001-pci-assign-sync-MSI-MSI-X-cap-and-table-with-PCIDevi.patch
deleted file mode 100644
index 03472dd..000
--- 
a/meta/recipes-devtools/qemu/qemu/0001-pci-assign-sync-MSI-MSI-X-cap-and-table-with-PCIDevi.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-From 6baa545df93253fced4fc0d52b14b98447e00473 Mon Sep 17 00:00:00 2001
-From: Peter Xu 
-Date: Mon, 28 Nov 2016 15:02:44 +0800
-Subject: [PATCH] pci-assign: sync MSI/MSI-X cap and table with PCIDevice
-
-Since commit e1d4fb2d ("kvm-irqchip: x86: add msi route notify fn"),
-kvm_irqchip_add_msi_route() starts to use pci_get_msi_message() to fetch
-MSI info. This requires that we setup MSI related fields in PCIDevice.
-For most devices, that won't be a problem, as long as we are using
-general interfaces like msi_init()/msix_init().
-
-However, for pci-assign devices, MSI/MSI-X is treated differently - PCI
-assign devices are maintaining its own MSI table and cap information in
-AssignedDevice struct. however that's not synced up with PCIDevice's
-fields. That will leads to pci_get_msi_message() failed to find correct
-MSI capability, even with an NULL msix_table.
-
-A quick fix is to sync up the two places: both the capability bits and
-table address for MSI/MSI-X.
-
-Upstream-Status: Backport 
[https://lists.gnu.org/archive/html/qemu-devel/2016-11/msg04649.html]
-
-Reported-by: Changlimin 
-Tested-by: Changlimin 
-Cc: address@hidden
-Fixes: e1d4fb2d ("kvm-irqchip: x86: add msi route notify fn")
-Signed-off-by: Peter Xu 
-Signed-off-by: He Zhe 

- hw/i386/kvm/pci-assign.c | 4 
- 1 file changed, 4 insertions(+)
-
-diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
-index 8238fbc..87dcbdd 100644
 a/hw/i386/kvm/pci-assign.c
-+++ b/hw/i386/kvm/pci-assign.c
-@@ -1251,6 +1251,7 @@ static int assigned_device_pci_cap_init(PCIDevice 
*pci_dev, Error **errp)
- error_propagate(errp, local_err);
- return -ENOTSUP;
- }
-+dev->dev.cap_present |= QEMU_PCI_CAP_MSI;
- dev->cap.available |= ASSIGNED_DEVICE_CAP_MSI;
- /* Only 32-bit/no-mask currently supported */
- ret = pci_add_capability2(pci_dev, PCI_CAP_ID_MSI, pos, 10,
-@@ -1285,6 +1286,7 @@ static int assigned_device_pci_cap_init(PCIDevice 
*pci_dev, Error **errp)
- error_propagate(errp, local_err);
- return -ENOTSUP;
- }
-+dev->dev.cap_present |= QEMU_PCI_CAP_MSIX;
- dev->cap.available |= ASSIGNED_DEVICE_CAP_MSIX;
- ret = pci_add_capability2(pci_dev, PCI_CAP_ID_MSIX, pos, 12,
-   _err);
-@@ -1648,6 +1650,7 @@ static void 
assigned_dev_register_msix_mmio(AssignedDevice *dev, Error **errp)
- dev->msix_table = NULL;
- return;
- }
-+dev->dev.msix_table = (uint8_t *)dev->msix_table;
- 
- assigned_dev_msix_reset(dev);
- 
-@@ -1665,6 +1668,7 @@ static void 
assigned_dev_unregister_msix_mmio(AssignedDevice *dev)
- error_report("error unmapping msix_table! %s", strerror(errno));
- }
- dev->msix_table = NULL;
-+dev->dev.msix_table = NULL;
- }
- 
- static const VMStateDescription vmstate_assigned_device = {
--- 
-2.8.3
-
diff --git 

[OE-core] [PATCH 2/2 v2] xserver-xorg: Enable glamor by default

2017-01-20 Thread Saul Wold
To enable glamor, we need to also enable both dri3 and xshmfence as 
dependencies.

Signed-off-by: Saul Wold 
---
 meta/recipes-graphics/xorg-xserver/xserver-xorg.inc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc 
b/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc
index 6a13380..0d3022f 100644
--- a/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc
+++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc
@@ -121,8 +121,9 @@ EXTRA_OECONF += "--with-fop=no \
 "
 EXTRA_OECONF[vardepsexclude] = "MACHINE"
 
+OPENGL_PKGCONFIGS = "dri glx glamor dri3 xshmfence"
 PACKAGECONFIG ??= "dri2 udev ${XORG_CRYPTO} \
-   ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'dri 
glx', '', d)} \
+   ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 
'${OPENGL_PKGCONFIGS}', '', d)} \
${@bb.utils.contains("DISTRO_FEATURES", "wayland", 
"xwayland", "", d)} \
${@bb.utils.contains("DISTRO_FEATURES", "systemd", 
"systemd", "", d)} \
 "
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 1/2 v2] xserver-xf86-config: add glamoregl

2017-01-20 Thread Saul Wold
When using the modesetting with glamor and MUSL, the glamoregl
library needs to be pre-loaded, so add it to the list here.

Signed-off-by: Saul Wold 
---
 .../xorg-xserver/xserver-xf86-config/10-preload-modules.conf | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/meta/recipes-graphics/xorg-xserver/xserver-xf86-config/10-preload-modules.conf
 
b/meta/recipes-graphics/xorg-xserver/xserver-xf86-config/10-preload-modules.conf
index 72e4fbf..23fcdc7 100644
--- 
a/meta/recipes-graphics/xorg-xserver/xserver-xf86-config/10-preload-modules.conf
+++ 
b/meta/recipes-graphics/xorg-xserver/xserver-xf86-config/10-preload-modules.conf
@@ -6,4 +6,5 @@ Section "Module"
 Load "int10"
 Load "vbe"
 Load "vgahw"
+Load "glamoregl"
 EndSection
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] ✗ patchtest: failure for "Switch to Recipe Specific Sysr..." and 2 more

2017-01-20 Thread Andreas Müller
On Fri, Jan 20, 2017 at 7:24 PM, Patchwork
 wrote:
> == Series Details ==
>
> Series: "Switch to Recipe Specific Sysr..." and 2 more
> Revision: 1
> URL   : https://patchwork.openembedded.org/series/4877/
> 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 failures:
>
>
>
> * Patch[1/3] Switch to Recipe Specific Sysroots
>  Issue Shortlog does not follow expected format 
> [test_shortlog_format]
>   Suggested fixCommit shortlog (first line of commit message) should 
> follow the format ": "
>
>
>
> 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
>
LOL
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCHv2] qemu: Upgrade to 2.7.1

2017-01-20 Thread Patrick Ohly
On Fri, 2017-01-20 at 12:12 -0600, Aníbal Limón wrote:
> --- a/meta/recipes-devtools/qemu/qemu.inc
> +++ b/meta/recipes-devtools/qemu/qemu.inc
> @@ -9,12 +9,11 @@ require qemu-targets.inc
>  inherit autotools ptest
>  BBCLASSEXTEND = "native nativesdk"
>  
> -PR = "r1"
> -
>  # QEMU_TARGETS is overridable variable
>  QEMU_TARGETS ?= "arm aarch64 i386 mips mipsel mips64 mips64el ppc sh4
> x86_64"
>  
>  SRC_URI = "\
> +http://wiki.qemu-project.org/download/${BP}.tar.bz2 \
>  file://powerpc_rom.bin \
>  file://disable-grabs.patch \
>  file://exclude-some-arm-EABI-obsolete-syscalls.patch \
> @@ -24,6 +23,9 @@ SRC_URI = "\
>  file://0001-target-mips-add-24KEc-CPU-definition.patch \
>  "
>  
> +SRC_URI[md5sum] = "a315bc51ed443a08d2cf1416d76b9ab4"
> +SRC_URI[sha256sum] =
> "68636788eb69bcb0b44ba220b32b50495d6bd5712a934c282217831c4822958f"

Slight misunderstanding, I suppose. The *URL* is independent of the
version and could be added in qemu.inc, but the hashes are version
dependent and are better suited for qemu_2.7.1.bb. At least that's how I
would do it.

In contrast to Alexander, I would also keep
http://wiki.qemu-project.org/download/${BP}.tar.bz2 in qemu_2.7.1.bb
with SRC_URI =+ because then there can be a qemu_git.bb with a different
URL than the one above.

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.



-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v3 3/3] selftest/containerimage.py: Add container IMAGE_FSTYPES test

2017-01-20 Thread Randy Witt
This test checks to make sure only the files expected exist in a
container image. Currently only ROOTFS_BOOTSTRAP_INSTALL, gets added to
all images without the user specifying it.

But this test should help if a developer in the future ever silently
adds more than just ROOTFS_BOOTSTRAP_INSTALL, and that the developer can
make sure it also gets removed from a container image.

[YOCTO #9502]

Signed-off-by: Randy Witt 
---
 .../container-image/container-image-testpkg.bb |  8 +++
 .../container-image/container-test-image.bb|  8 +++
 meta/lib/oeqa/selftest/containerimage.py   | 82 ++
 3 files changed, 98 insertions(+)
 create mode 100644 
meta-selftest/recipes-test/container-image/container-image-testpkg.bb
 create mode 100644 
meta-selftest/recipes-test/container-image/container-test-image.bb
 create mode 100644 meta/lib/oeqa/selftest/containerimage.py

diff --git 
a/meta-selftest/recipes-test/container-image/container-image-testpkg.bb 
b/meta-selftest/recipes-test/container-image/container-image-testpkg.bb
new file mode 100644
index 000..f8dd229
--- /dev/null
+++ b/meta-selftest/recipes-test/container-image/container-image-testpkg.bb
@@ -0,0 +1,8 @@
+LICENSE = "MIT"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+do_install_append() {
+install -d ${D}${bindir}
+touch ${D}${bindir}/theapp
+}
diff --git a/meta-selftest/recipes-test/container-image/container-test-image.bb 
b/meta-selftest/recipes-test/container-image/container-test-image.bb
new file mode 100644
index 000..d5f939c
--- /dev/null
+++ b/meta-selftest/recipes-test/container-image/container-test-image.bb
@@ -0,0 +1,8 @@
+IMAGE_INSTALL += "container-image-testpkg"
+
+LICENSE = "MIT"
+
+IMAGE_FSTYPES = "container"
+IMAGE_LINGUAS = ""
+
+inherit core-image
diff --git a/meta/lib/oeqa/selftest/containerimage.py 
b/meta/lib/oeqa/selftest/containerimage.py
new file mode 100644
index 000..109f61b
--- /dev/null
+++ b/meta/lib/oeqa/selftest/containerimage.py
@@ -0,0 +1,82 @@
+import os
+
+from oeqa.selftest.base import oeSelfTest
+from oeqa.utils.commands import bitbake, get_bb_vars, runCmd
+
+# This test builds an image with using the "container" IMAGE_FSTYPE, and
+# ensures that then files in the image are only the ones expected.
+#
+# The only package added to the image is container_image_testpkg, which
+# contains one file. However, due to some other things not cleaning up during
+# rootfs creation, there is some cruft. Ideally bugs will be filed and the
+# cruft removed, but for now we whitelist some known set.
+#
+# Also for performance reasons we're only checking the cruft when using ipk.
+# When using deb, and rpm it is a bit different and we could test all
+# of them, but this test is more to catch if other packages get added by
+# default other than what is in ROOTFS_BOOTSTRAP_INSTALL.
+#
+class ContainerImageTests(oeSelfTest):
+
+# Verify that when specifying a IMAGE_TYPEDEP_ of the form "foo.bar" that
+# the conversion type bar gets added as a dep as well
+def test_expected_files(self):
+
+def get_each_path_part(path):
+if path:
+part = [ '.' + path + '/' ]
+result = get_each_path_part(path.rsplit('/', 1)[0])
+if result:
+return part + result
+else:
+return part
+else:
+return None
+
+self.write_config("""PREFERRED_PROVIDER_virtual/kernel = "linux-dummy"
+IMAGE_FSTYPES = "container"
+PACKAGE_CLASSES = "package_ipk"
+IMAGE_FEATURES = ""
+""")
+
+bbvars = get_bb_vars(['bindir', 'sysconfdir', 'localstatedir',
+  'DEPLOY_DIR_IMAGE'])
+expected_files = [
+'./',
+'.{bindir}/theapp',
+'.{sysconfdir}/default/',
+'.{sysconfdir}/default/postinst',
+'.{sysconfdir}/ld.so.cache',
+'.{sysconfdir}/timestamp',
+'.{sysconfdir}/version',
+'./run/',
+'.{localstatedir}/cache/',
+'.{localstatedir}/cache/ldconfig/',
+'.{localstatedir}/cache/ldconfig/aux-cache',
+'.{localstatedir}/cache/opkg/',
+'.{localstatedir}/lib/',
+'.{localstatedir}/lib/opkg/'
+]
+
+expected_files = [ x.format(bindir=bbvars['bindir'],
+sysconfdir=bbvars['sysconfdir'],
+localstatedir=bbvars['localstatedir'])
+for x in expected_files ]
+
+# Since tar lists all directories individually, make sure each element
+# from bindir, sysconfdir, etc is added
+expected_files += get_each_path_part(bbvars['bindir'])
+expected_files += get_each_path_part(bbvars['sysconfdir'])
+

[OE-core] ✗ patchtest: failure for "Switch to Recipe Specific Sysr..." and 2 more

2017-01-20 Thread Patchwork
== Series Details ==

Series: "Switch to Recipe Specific Sysr..." and 2 more
Revision: 1
URL   : https://patchwork.openembedded.org/series/4877/
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 failures:



* Patch[1/3] Switch to Recipe Specific Sysroots
 Issue Shortlog does not follow expected format 
[test_shortlog_format] 
  Suggested fixCommit shortlog (first line of commit message) should follow 
the format ": "



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

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCHv2] qemu: Upgrade to 2.7.1

2017-01-20 Thread Aníbal Limón
Minor upgrade contains fixes from 2.7.0.

Removed patches (already in upstream):

- 0001-pci-assign-sync-MSI-MSI-X-cap-and-table-with-PCIDevi.patch
- 0001-virtio-zero-vq-inuse-in-virtio_reset.patch
- 0002-fix-CVE-2016-7423.patch

Signed-off-by: Aníbal Limón 
---
 meta/recipes-devtools/qemu/qemu.inc|  6 +-
 ...sync-MSI-MSI-X-cap-and-table-with-PCIDevi.patch | 71 --
 ...0001-virtio-zero-vq-inuse-in-virtio_reset.patch | 57 -
 .../qemu/qemu/0002-fix-CVE-2016-7423.patch | 45 --
 .../qemu/{qemu_2.7.0.bb => qemu_2.7.1.bb}  |  7 ---
 5 files changed, 4 insertions(+), 182 deletions(-)
 delete mode 100644 
meta/recipes-devtools/qemu/qemu/0001-pci-assign-sync-MSI-MSI-X-cap-and-table-with-PCIDevi.patch
 delete mode 100644 
meta/recipes-devtools/qemu/qemu/0001-virtio-zero-vq-inuse-in-virtio_reset.patch
 delete mode 100644 meta/recipes-devtools/qemu/qemu/0002-fix-CVE-2016-7423.patch
 rename meta/recipes-devtools/qemu/{qemu_2.7.0.bb => qemu_2.7.1.bb} (66%)

diff --git a/meta/recipes-devtools/qemu/qemu.inc 
b/meta/recipes-devtools/qemu/qemu.inc
index b46e7f7..0d91fde 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -9,12 +9,11 @@ require qemu-targets.inc
 inherit autotools ptest
 BBCLASSEXTEND = "native nativesdk"
 
-PR = "r1"
-
 # QEMU_TARGETS is overridable variable
 QEMU_TARGETS ?= "arm aarch64 i386 mips mipsel mips64 mips64el ppc sh4 x86_64"
 
 SRC_URI = "\
+http://wiki.qemu-project.org/download/${BP}.tar.bz2 \
 file://powerpc_rom.bin \
 file://disable-grabs.patch \
 file://exclude-some-arm-EABI-obsolete-syscalls.patch \
@@ -24,6 +23,9 @@ SRC_URI = "\
 file://0001-target-mips-add-24KEc-CPU-definition.patch \
 "
 
+SRC_URI[md5sum] = "a315bc51ed443a08d2cf1416d76b9ab4"
+SRC_URI[sha256sum] = 
"68636788eb69bcb0b44ba220b32b50495d6bd5712a934c282217831c4822958f"
+
 SRC_URI_append_class-native = "\
 file://fix-libcap-header-issue-on-some-distro.patch \
 file://cpus.c-qemu_cpu_kick_thread_debugging.patch \
diff --git 
a/meta/recipes-devtools/qemu/qemu/0001-pci-assign-sync-MSI-MSI-X-cap-and-table-with-PCIDevi.patch
 
b/meta/recipes-devtools/qemu/qemu/0001-pci-assign-sync-MSI-MSI-X-cap-and-table-with-PCIDevi.patch
deleted file mode 100644
index 03472dd..000
--- 
a/meta/recipes-devtools/qemu/qemu/0001-pci-assign-sync-MSI-MSI-X-cap-and-table-with-PCIDevi.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-From 6baa545df93253fced4fc0d52b14b98447e00473 Mon Sep 17 00:00:00 2001
-From: Peter Xu 
-Date: Mon, 28 Nov 2016 15:02:44 +0800
-Subject: [PATCH] pci-assign: sync MSI/MSI-X cap and table with PCIDevice
-
-Since commit e1d4fb2d ("kvm-irqchip: x86: add msi route notify fn"),
-kvm_irqchip_add_msi_route() starts to use pci_get_msi_message() to fetch
-MSI info. This requires that we setup MSI related fields in PCIDevice.
-For most devices, that won't be a problem, as long as we are using
-general interfaces like msi_init()/msix_init().
-
-However, for pci-assign devices, MSI/MSI-X is treated differently - PCI
-assign devices are maintaining its own MSI table and cap information in
-AssignedDevice struct. however that's not synced up with PCIDevice's
-fields. That will leads to pci_get_msi_message() failed to find correct
-MSI capability, even with an NULL msix_table.
-
-A quick fix is to sync up the two places: both the capability bits and
-table address for MSI/MSI-X.
-
-Upstream-Status: Backport 
[https://lists.gnu.org/archive/html/qemu-devel/2016-11/msg04649.html]
-
-Reported-by: Changlimin 
-Tested-by: Changlimin 
-Cc: address@hidden
-Fixes: e1d4fb2d ("kvm-irqchip: x86: add msi route notify fn")
-Signed-off-by: Peter Xu 
-Signed-off-by: He Zhe 

- hw/i386/kvm/pci-assign.c | 4 
- 1 file changed, 4 insertions(+)
-
-diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
-index 8238fbc..87dcbdd 100644
 a/hw/i386/kvm/pci-assign.c
-+++ b/hw/i386/kvm/pci-assign.c
-@@ -1251,6 +1251,7 @@ static int assigned_device_pci_cap_init(PCIDevice 
*pci_dev, Error **errp)
- error_propagate(errp, local_err);
- return -ENOTSUP;
- }
-+dev->dev.cap_present |= QEMU_PCI_CAP_MSI;
- dev->cap.available |= ASSIGNED_DEVICE_CAP_MSI;
- /* Only 32-bit/no-mask currently supported */
- ret = pci_add_capability2(pci_dev, PCI_CAP_ID_MSI, pos, 10,
-@@ -1285,6 +1286,7 @@ static int assigned_device_pci_cap_init(PCIDevice 
*pci_dev, Error **errp)
- error_propagate(errp, local_err);
- return -ENOTSUP;
- }
-+dev->dev.cap_present |= QEMU_PCI_CAP_MSIX;
- dev->cap.available |= ASSIGNED_DEVICE_CAP_MSIX;
- ret = pci_add_capability2(pci_dev, PCI_CAP_ID_MSIX, pos, 12,
-   _err);
-@@ -1648,6 +1650,7 @@ static void 

[OE-core] [PATCH 09/14] wic: fixed test_iso_image test case

2017-01-20 Thread Richard Purdie
From: Ed Bartosh 

Fixed isoimage-isohybrid plulgin and correspondent wic tet case:
- used wic-tools target when getting varlue of STAGING_LIBDIR variable
- ensured that image is built with efi and hddimg enabled

Signed-off-by: Ed Bartosh 
---
 meta/lib/oeqa/selftest/wic.py| 4 
 scripts/lib/wic/plugins/source/isoimage-isohybrid.py | 5 +
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index 6a61ba6..14109c4 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -149,6 +149,10 @@ class Wic(oeSelfTest):
 @testcase(1346)
 def test_iso_image(self):
 """Test creation of hybrid iso image with legacy and EFI boot"""
+config = 'IMAGE_FSTYPES += " hddimg "\nMACHINE_FEATURES_append = " 
efi"\n'
+self.append_config(config)
+bitbake('core-image-minimal')
+self.remove_config(config)
 cmd = "wic create mkhybridiso --image-name core-image-minimal"
 self.assertEqual(0, runCmd(cmd).status)
 self.assertEqual(1, len(glob(self.resultdir + 
"HYBRID_ISO_IMG-*.direct")))
diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py 
b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
index 15fd858..a8a5dc0 100644
--- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
+++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
@@ -336,15 +336,12 @@ class IsoImagePlugin(SourcePlugin):
 
 if not os.path.isfile("%s/EFI/BOOT/%s" \
 % (bootimg_dir, grub_image)):
-grub_path = get_bitbake_var("STAGING_LIBDIR")
+grub_path = get_bitbake_var("STAGING_LIBDIR", "wic-tools")
 if not grub_path:
 msger.error("Couldn't find STAGING_LIBDIR, exiting.\n")
 
 grub_core = "%s/grub/%s" % (grub_path, grub_target)
 if not os.path.exists(grub_core):
-msger.info("Building grub-efi...\n")
-exec_cmd("bitbake grub-efi")
-if not os.path.exists(grub_core):
 msger.error("Please build grub-efi first\n")
 
 grub_cmd = "grub-mkimage -p '/EFI/BOOT' "
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 01/14] wic: add wic-tools recipe

2017-01-20 Thread Richard Purdie
From: Ed Bartosh 

This meta recipe is for building tools used by wic.
It allows wic to find tools in recipe specific sysroot as
all tools will be present in wic-tools sysroot.

NOTE: task do_build_sysroot is created to ensure that
sysroot is re-populated when package is built. Otherwise it will
be taken from sstate and sysroot will not be populated.

Generated wic-tools.env file for wic to be able to get values of
wic-tools variables when wic run from bitbake.

Also add dependency to grub-efi

Without grub-efi test_iso_image test case fails with this error:

AssertionError: Command 'wic create mkhybridiso --image-name
core-image-minimal' returned non-zero exit status 1:
Error: Please build grub-efi first

Fixed by adding dependency wic-tools -> grub-efi.

[RP: Added syslinux exclusion for non-IA arches]
Signed-off-by: Ed Bartosh 
Signed-off-by: Richard Purdie 
---
 meta/recipes-core/meta/wic-tools.bb | 24 
 1 file changed, 24 insertions(+)
 create mode 100644 meta/recipes-core/meta/wic-tools.bb

diff --git a/meta/recipes-core/meta/wic-tools.bb 
b/meta/recipes-core/meta/wic-tools.bb
new file mode 100644
index 000..0a53b73
--- /dev/null
+++ b/meta/recipes-core/meta/wic-tools.bb
@@ -0,0 +1,24 @@
+SUMMARY = "A meta recipe to build native tools used by wic."
+
+LICENSE = "MIT"
+
+DEPENDS = "parted-native syslinux-native gptfdisk-native dosfstools-native 
mtools-native bmap-tools-native grub-efi-native cdrtools-native"
+DEPENDS_append_x86 = " syslinux grub-efi"
+DEPENDS_append_x86-64 = " syslinux grub-efi"
+
+INHIBIT_DEFAULT_DEPS = "1"
+inherit nopackages
+
+python do_build_sysroot () {
+bb.build.exec_func("extend_recipe_sysroot", d)
+
+# Write environment variables used by wic
+# to tmp/sysroots//imgdata/wictools.env
+outdir = os.path.join(d.getVar('STAGING_DIR'), 'imgdata')
+bb.utils.mkdirhier(outdir)
+with open(os.path.join(outdir, "wic-tools.env"), 'w') as envf:
+for var in ('RECIPE_SYSROOT_NATIVE', 'STAGING_DATADIR', 
'STAGING_LIBDIR'):
+envf.write('%s="%s"\n' % (var, d.getVar(var).strip()))
+
+}
+addtask do_build_sysroot after do_prepare_recipe_sysroot before do_build
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 02/14] image_types.bbclass: build wic-tools

2017-01-20 Thread Richard Purdie
From: Ed Bartosh 

Added dependency do_image_wic -> wic-tools:do_build to ensure
that all required tools are ready to use by wic.

Signed-off-by: Ed Bartosh 
---
 meta/classes/image_types.bbclass | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 7748dee..ff5e727 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -226,6 +226,7 @@ IMAGE_CMD_wic[vardepsexclude] = "WKS_FULL_PATH WKS_FILES"
 USING_WIC = "${@bb.utils.contains_any('IMAGE_FSTYPES', 'wic ' + ' 
'.join('wic.%s' % c for c in '${CONVERSIONTYPES}'.split()), '1', '', d)}"
 WKS_FILE_CHECKSUM = "${@'${WKS_FULL_PATH}:%s' % 
os.path.exists('${WKS_FULL_PATH}') if '${USING_WIC}' else ''}"
 do_image_wic[file-checksums] += "${WKS_FILE_CHECKSUM}"
+do_image_wic[depends] += "wic-tools:do_build"
 
 python () {
 if d.getVar('USING_WIC') and 'do_bootimg' in d:
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 10/14] selftest: wic: don't set WKS_FILE

2017-01-20 Thread Richard Purdie
From: Ed Bartosh 

Setting WKS_FILE variable should be done only when
wic image is expected to be built by bitbake.
If it's set for all images it breaks image building in
some cases.

Signed-off-by: Ed Bartosh 
---
 meta/lib/oeqa/selftest/wic.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index 14109c4..32b7446 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -44,8 +44,7 @@ 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')
+  '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
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 07/14] partition.py: use FAKEROOTCMD variable to get path to pseudo

2017-01-20 Thread Richard Purdie
From: Ed Bartosh 

wic used native sysroot to get path to pseudo utility.
This approach doesn't work with recipe specific sysroots.

Using FAKEROOTCMD should fix the issue.

Signed-off-by: Ed Bartosh 
---
 scripts/lib/wic/partition.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index aa8f8a7..49d1327 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -226,7 +226,7 @@ class Partition():
 pseudo += "export PSEUDO_LOCALSTATEDIR=%s;" % p_localstatedir
 pseudo += "export PSEUDO_PASSWD=%s;" % p_passwd
 pseudo += "export PSEUDO_NOSYMLINKEXP=%s;" % p_nosymlinkexp
-pseudo += "%s/usr/bin/pseudo " % native_sysroot
+pseudo += "%s " % get_bitbake_var("FAKEROOTCMD")
 
 rootfs = "%s/rootfs_%s.%s.%s" % (cr_workdir, self.label,
  self.lineno, self.fstype)
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 06/14] image.bbclass: put .env files to ${STAGING_DIR}/imgdata/

2017-01-20 Thread Richard Purdie
From: Ed Bartosh 

As STAGING_DIR_TARGET started to point to a recipe specific
sysroot wic is not able to add .env files when .wks file refers
to multiple rootfs recipes.

Used STAGING_DIR instead of STAGING_DIR_TARGET to make the
directory with .env files the same for all recipes.

Signed-off-by: Ed Bartosh 
---
 meta/classes/image.bbclass   | 2 +-
 meta/classes/image_types.bbclass | 2 +-
 meta/lib/oeqa/selftest/wic.py| 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 021c432..59a7688 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -342,7 +342,7 @@ python do_rootfs_wicenv () {
 if not wicvars:
 return
 
-stdir = d.getVar('STAGING_DIR_TARGET')
+stdir = d.getVar('STAGING_DIR')
 outdir = os.path.join(stdir, 'imgdata')
 bb.utils.mkdirhier(outdir)
 basename = d.getVar('IMAGE_BASENAME')
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index bac7ff5..5b1746a 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -216,7 +216,7 @@ IMAGE_CMD_wic () {
bbfatal "No kickstart files from WKS_FILES were found: 
${WKS_FILES}. Please set WKS_FILE or WKS_FILES appropriately."
fi
 
-   BUILDDIR="${TOPDIR}" wic create "$wks" --vars 
"${STAGING_DIR_TARGET}/imgdata/" -e "${IMAGE_BASENAME}" -o "$out/" 
${WIC_CREATE_EXTRA_ARGS}
+   BUILDDIR="${TOPDIR}" wic create "$wks" --vars "${STAGING_DIR}/imgdata/" 
-e "${IMAGE_BASENAME}" -o "$out/" ${WIC_CREATE_EXTRA_ARGS}
mv "$out/build/$(basename "${wks%.wks}")"*.direct 
"$out${IMAGE_NAME_SUFFIX}.wic"
rm -rf "$out/"
 }
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index 77f1bdc..6a61ba6 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -332,7 +332,7 @@ class Wic(oeSelfTest):
 """Generate and obtain the path to .env"""
 if image not in self.wicenv_cache:
 self.assertEqual(0, bitbake('%s -c do_rootfs_wicenv' % 
image).status)
-stdir = get_bb_var('STAGING_DIR_TARGET', image)
+stdir = get_bb_var('STAGING_DIR', image)
 self.wicenv_cache[image] = os.path.join(stdir, 'imgdata')
 return self.wicenv_cache[image]
 
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 03/14] selftest: build wic-tools in the Wic.setUp

2017-01-20 Thread Richard Purdie
From: Ed Bartosh 

Built wic-tools recipe instead of set of tools recipes
to ensure that all tools are available from one recipe sysroot.

Signed-off-by: Ed Bartosh 
---
 meta/lib/oeqa/selftest/wic.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index 49bbfe3..e45594f 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -51,8 +51,7 @@ class Wic(oeSelfTest):
 # 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')
+bitbake('wic-tools')
 bitbake('core-image-minimal')
 Wic.image_is_ready = True
 
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 14/14] wic: bootimg-pcbios: use wic-tools target

2017-01-20 Thread Richard Purdie
From: Ed Bartosh 

Used wic-tools target to get location of syslinux.

Signed-off-by: Ed Bartosh 
---
 scripts/lib/wic/plugins/source/bootimg-pcbios.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py 
b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
index f204daa..cff8aec 100644
--- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
@@ -145,7 +145,7 @@ class BootimgPcbiosPlugin(SourcePlugin):
 return False
 
 if not _has_syslinux(bootimg_dir):
-bootimg_dir = get_bitbake_var("STAGING_DATADIR")
+bootimg_dir = get_bitbake_var("STAGING_DATADIR", "wic-tools")
 if not bootimg_dir:
 msger.error("Couldn't find STAGING_DATADIR, exiting\n")
 if not _has_syslinux(bootimg_dir):
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 12/14] wic: misc.py: add parameter 'cache' to get_bitbake_vars

2017-01-20 Thread Richard Purdie
From: Ed Bartosh 

This parameter will be used to allow or prevent variable caching.

For example, we don't want to cache value of RECIPE_SYSROOT_NATIVE
wic-tools variable as we may decide to rebuild wic-tools.

Signed-off-by: Ed Bartosh 
---
 scripts/lib/wic/utils/oe/misc.py | 19 ---
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py
index 445109a..3737c4b 100644
--- a/scripts/lib/wic/utils/oe/misc.py
+++ b/scripts/lib/wic/utils/oe/misc.py
@@ -160,7 +160,7 @@ class BitbakeVars(defaultdict):
 key, val = match.groups()
 self[image][key] = val.strip('"')
 
-def get_var(self, var, image=None):
+def get_var(self, var, image=None, cache=True):
 """
 Get bitbake variable from 'bitbake -e' output or from .env file.
 This is a lazy method, i.e. it runs bitbake or parses file only when
@@ -202,21 +202,26 @@ class BitbakeVars(defaultdict):
 self._parse_line(line, image)
 
 # Make first image a default set of variables
-images = [key for key in self if key]
-if len(images) == 1:
-self[None] = self[image]
+if cache:
+images = [key for key in self if key]
+if len(images) == 1:
+self[None] = self[image]
 
-return self[image].get(var)
+result = self[image].get(var)
+if not cache:
+self.pop(image, None)
+
+return result
 
 # Create BB_VARS singleton
 BB_VARS = BitbakeVars()
 
-def get_bitbake_var(var, image=None):
+def get_bitbake_var(var, image=None, cache=True):
 """
 Provide old get_bitbake_var API by wrapping
 get_var method of BB_VARS singleton.
 """
-return BB_VARS.get_var(var, image)
+return BB_VARS.get_var(var, image, cache)
 
 def parse_sourceparams(sourceparams):
 """
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 05/14] image_types: add RECIPE_SYSROOT_NATIVE to WICVARS

2017-01-20 Thread Richard Purdie
From: Ed Bartosh 

Added RECIPE_SYSROOT_NATIVE to the WICVARS for wic
to be able to access it when run from bitbake.

Signed-off-by: Ed Bartosh 
---
 meta/classes/image_types.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index ff5e727..bac7ff5 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -378,4 +378,4 @@ IMAGE_TYPES_MASKED ?= ""
 
 # The WICVARS variable is used to define list of bitbake variables used in wic 
code
 # variables from this list is written to .env file
-WICVARS ?= "BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE HDDDIR IMAGE_BASENAME 
IMAGE_BOOT_FILES IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD ISODIR 
MACHINE_ARCH ROOTFS_SIZE STAGING_DATADIR STAGING_DIR_NATIVE STAGING_LIBDIR 
TARGET_SYS"
+WICVARS ?= "BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE FAKEROOTCMD HDDDIR 
IMAGE_BASENAME IMAGE_BOOT_FILES IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES 
INITRD ISODIR MACHINE_ARCH RECIPE_SYSROOT_NATIVE ROOTFS_SIZE STAGING_DATADIR 
STAGING_DIR STAGING_LIBDIR TARGET_SYS"
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 08/14] wic: fixed recipe name

2017-01-20 Thread Richard Purdie
From: Ed Bartosh 

Renamed grub-efi-native -> grub-efi in NATIVE_RECIPES
dictionary as '-native' suffix is added to the recipe name in
the code.

Signed-off-by: Ed Bartosh 
---
 scripts/lib/wic/utils/oe/misc.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py
index 727d519..445109a 100644
--- a/scripts/lib/wic/utils/oe/misc.py
+++ b/scripts/lib/wic/utils/oe/misc.py
@@ -36,7 +36,7 @@ from wic.utils import runner
 
 # executable -> recipe pairs for exec_native_cmd
 NATIVE_RECIPES = {"bmaptool": "bmap-tools",
-  "grub-mkimage": "grub-efi-native",
+  "grub-mkimage": "grub-efi",
   "isohybrid": "syslinux",
   "mcopy": "mtools",
   "mkdosfs": "dosfstools",
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 13/14] wic: rebuild wic-tools if its sysroot doesn't exist

2017-01-20 Thread Richard Purdie
From: Ed Bartosh 

Rebuild wic-tools if its native sysroot doesn't exist to ensure
that all required tools are available.

Signed-off-by: Ed Bartosh 
---
 scripts/wic | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/scripts/wic b/scripts/wic
index f09dbc2..8918cb4 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -175,11 +175,23 @@ 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)
-native_sysroot = os.path.join(get_bitbake_var("RECIPE_SYSROOT_NATIVE", 
"wic-tools"))
+native_sysroot = get_bitbake_var("RECIPE_SYSROOT_NATIVE",
+ "wic-tools", cache=False)
 else:
 if options.build_rootfs:
 print("Image name is not specified, exiting. (Use -e/--image-name 
to specify it)\n")
 sys.exit(1)
+native_sysroot = options.native_sysroot
+
+if not native_sysroot or not os.path.isdir(native_sysroot):
+print("Building wic-tools...\n")
+if bitbake_main(BitBakeConfigParameters("bitbake wic-tools".split()),
+cookerdata.CookerConfiguration()):
+sys.exit(1)
+native_sysroot = get_bitbake_var("RECIPE_SYSROOT_NATIVE", "wic-tools")
+if not native_sysroot:
+print("Unable to find the location of the native tools sysroot to 
use\n")
+sys.exit(1)
 
 wks_file = args[0]
 
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 04/14] wic: fix getting path of native sysroot

2017-01-20 Thread Richard Purdie
From: Ed Bartosh 

wic used STAGING_DIR_NATIVE variable as a path to native sysroot.
This doesn't work with recipe specific sysroots as STAGING_DIR_NATIVE
points to the native sysroot of the current recipe.

Used RECIPE_SYSROOT_NATIVE variable of wic-tools recipe
to fix the issue.

Signed-off-by: Ed Bartosh 
---
 meta/lib/oeqa/selftest/wic.py | 12 ++--
 scripts/wic   |  3 +--
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index e45594f..77f1bdc 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -210,12 +210,12 @@ class Wic(oeSelfTest):
 def test_build_artifacts(self):
 """Test wic create directdisk providing all artifacts."""
 bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal'))
-  for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE',
-  'STAGING_DIR_NATIVE', 'IMAGE_ROOTFS'))
+  for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', 
'IMAGE_ROOTFS'))
+bbvars['recipe_sysroot_native'] = get_bb_var('RECIPE_SYSROOT_NATIVE', 
'wic-tools')
 status = runCmd("wic create directdisk "
 "-b %(staging_datadir)s "
 "-k %(deploy_dir_image)s "
-"-n %(staging_dir_native)s "
+"-n %(recipe_sysroot_native)s "
 "-r %(image_rootfs)s" % bbvars).status
 self.assertEqual(0, status)
 self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct")))
@@ -301,13 +301,13 @@ class Wic(oeSelfTest):
 def test_rootfs_artifacts(self):
 """Test usage of rootfs plugin with rootfs paths"""
 bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal'))
-  for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE',
-  'STAGING_DIR_NATIVE', 'IMAGE_ROOTFS'))
+  for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', 
'IMAGE_ROOTFS'))
+bbvars['recipe_sysroot_native'] = get_bb_var('RECIPE_SYSROOT_NATIVE', 
'wic-tools')
 bbvars['wks'] = "directdisk-multi-rootfs"
 status = runCmd("wic create %(wks)s "
 "--bootimg-dir=%(staging_datadir)s "
 "--kernel-dir=%(deploy_dir_image)s "
-"--native-sysroot=%(staging_dir_native)s "
+"--native-sysroot=%(recipe_sysroot_native)s "
 "--rootfs-dir rootfs1=%(image_rootfs)s "
 "--rootfs-dir rootfs2=%(image_rootfs)s"
 % bbvars).status
diff --git a/scripts/wic b/scripts/wic
index 1ad1666..f09dbc2 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -175,8 +175,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)
-native_sysroot = get_bitbake_var("STAGING_DIR_NATIVE",
- options.image_name)
+native_sysroot = os.path.join(get_bitbake_var("RECIPE_SYSROOT_NATIVE", 
"wic-tools"))
 else:
 if options.build_rootfs:
 print("Image name is not specified, exiting. (Use -e/--image-name 
to specify it)\n")
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 11/14] selftest: fixed 3 wic test cases

2017-01-20 Thread Richard Purdie
From: Ed Bartosh 

Fixed test_systemd_bootdisk, test_wic_image_type and test_qemu
test cases by building core-image-minimal with correct configuration.

Signed-off-by: Ed Bartosh 
---
 meta/lib/oeqa/selftest/wic.py | 12 
 1 file changed, 12 insertions(+)

diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index 32b7446..11dc744 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -181,6 +181,10 @@ class Wic(oeSelfTest):
 @testcase(1560)
 def test_systemd_bootdisk(self):
 """Test creation of systemd-bootdisk image"""
+config = 'IMAGE_FSTYPES += " hddimg "\nMACHINE_FEATURES_append = " 
efi"\n'
+self.append_config(config)
+bitbake('core-image-minimal')
+self.remove_config(config)
 cmd = "wic create systemd-bootdisk -e core-image-minimal"
 self.assertEqual(0, runCmd(cmd).status)
 self.assertEqual(1, len(glob(self.resultdir + 
"systemd-bootdisk-*direct")))
@@ -379,7 +383,11 @@ class Wic(oeSelfTest):
 @testcase(1351)
 def test_wic_image_type(self):
 """Test building wic images by bitbake"""
+config = 'IMAGE_FSTYPES += " hddimg wic"\nWKS_FILE = 
"wic-image-minimal"\n'\
+ 'MACHINE_FEATURES_append = " efi"\n'
+self.append_config(config)
 self.assertEqual(0, bitbake('wic-image-minimal').status)
+self.remove_config(config)
 
 deploy_dir = get_bb_var('DEPLOY_DIR_IMAGE')
 machine = get_bb_var('MACHINE')
@@ -394,7 +402,11 @@ class Wic(oeSelfTest):
 @testcase(1422)
 def test_qemu(self):
 """Test wic-image-minimal under qemu"""
+config = 'IMAGE_FSTYPES += " hddimg wic"\nWKS_FILE = 
"wic-image-minimal"\n'\
+ 'MACHINE_FEATURES_append = " efi"\n'
+self.append_config(config)
 self.assertEqual(0, bitbake('wic-image-minimal').status)
+self.remove_config(config)
 
 with runqemu('wic-image-minimal', ssh=False) as qemu:
 cmd = "mount |grep '^/dev/' | cut -f1,3 -d ' '"
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 2/3] selftest/devtool: Update to account for recipe specific sysroot

2017-01-20 Thread Richard Purdie
There is no common sysroot any more so add the libusb dependency using DEPENDS
and check for the output in the sysroot output directory so the tests
work with recipe specific sysroots.

Signed-off-by: Richard Purdie 
---
 meta/lib/oeqa/selftest/devtool.py | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/meta/lib/oeqa/selftest/devtool.py 
b/meta/lib/oeqa/selftest/devtool.py
index dc3435f..79a4b1f 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -247,8 +247,6 @@ class DevtoolTests(DevtoolBase):
 
 @testcase(1162)
 def test_devtool_add_library(self):
-# We don't have the ability to pick up this dependency automatically 
yet...
-bitbake('libusb1')
 # Fetch source
 tempdir = tempfile.mkdtemp(prefix='devtoolqa')
 self.track_for_cleanup(tempdir)
@@ -277,10 +275,13 @@ class DevtoolTests(DevtoolBase):
 result = runCmd('recipetool setvar %s EXTRA_OECMAKE -- 
\'-DPYTHON_BINDINGS=OFF -DLIBFTDI_CMAKE_CONFIG_DIR=${datadir}/cmake/Modules\'' 
% recipefile)
 with open(recipefile, 'a') as f:
 f.write('\nFILES_${PN}-dev += "${datadir}/cmake/Modules"\n')
+# We don't have the ability to pick up this dependency 
automatically yet...
+f.write('\nDEPENDS += "libusb1"\n')
+f.write('\nTESTLIBOUTPUT = 
"${STAGING_DIR}-components/${TUNE_PKGARCH}/${PN}/${libdir}"\n')
 # Test devtool build
 result = runCmd('devtool build libftdi')
-staging_libdir = get_bb_var('STAGING_LIBDIR', 'libftdi')
-self.assertTrue(staging_libdir, 'Could not query STAGING_LIBDIR 
variable')
+staging_libdir = get_bb_var('TESTLIBOUTPUT', 'libftdi')
+self.assertTrue(staging_libdir, 'Could not query TESTLIBOUTPUT 
variable')
 self.assertTrue(os.path.isfile(os.path.join(staging_libdir, 
'libftdi1.so.2.1.0')), "libftdi binary not found in STAGING_LIBDIR. Output of 
devtool build libftdi %s" % result.output)
 # Test devtool reset
 stampprefix = get_bb_var('STAMP', 'libftdi')
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 3/3] bitbake.conf: Exclude extend_recipe_sysroot function from sstate checksums

2017-01-20 Thread Richard Purdie
The extend_recipe_sysroot itself is excluded from the task hashes. This is
because it only ever acts upon the contents of the task dependencies and hence
those checksums accurately relfect what its doing. It does mean sysroots don't
repopulate if this function changes but there are other easy ways to achieve
that if needed.

Signed-off-by: Richard Purdie 
---
 meta/conf/bitbake.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index ee8bd8b..e421650 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -813,7 +813,7 @@ BB_HASHBASE_WHITELIST ?= "TMPDIR FILE PATH PWD BB_TASKHASH 
BBPATH BBSERVER DL_DI
 PRSERV_DUMPDIR PRSERV_DUMPFILE PRSERV_LOCKDOWN PARALLEL_MAKE \
 CCACHE_DIR EXTERNAL_TOOLCHAIN CCACHE CCACHE_DISABLE LICENSE_PATH 
SDKPKGSUFFIX \
 WARN_QA ERROR_QA WORKDIR STAMPCLEAN PKGDATA_DIR BUILD_ARCH SSTATE_PKGARCH \
-BB_WORKERCONTEXT BB_LIMITEDDEPS"
+BB_WORKERCONTEXT BB_LIMITEDDEPS extend_recipe_sysroot"
 BB_HASHCONFIG_WHITELIST ?= "${BB_HASHBASE_WHITELIST} DATE TIME SSH_AGENT_PID \
 SSH_AUTH_SOCK PSEUDO_BUILD BB_ENV_EXTRAWHITE DISABLE_SANITY_CHECKS \
 PARALLEL_MAKE BB_NUMBER_THREADS BB_ORIGENV BB_INVALIDCONF BBINCLUDED \
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 1/3] Switch to Recipe Specific Sysroots

2017-01-20 Thread Richard Purdie
This patch is comparatively large and invasive. It does only do one thing, 
switching the
system to build using recipe specific sysroots and where changes could be 
isolated from it,
that has been done.

With the current single sysroot approach, its possible for software to find 
things which
aren't in their dependencies. This leads to a determinism problem and is a 
growing issue in
several of the market segments where OE makes sense. The way to solve this 
problem for OE is
to have seperate sysroots for each recipe and these will only contain the 
dependencies for
that recipe.

Its worth noting that this is not task specific sysroots and that OE's 
dependencies do vary
enormously by task. This did result in some implementation challenges. There is 
nothing stopping
the implementation of task specific sysroots at some later point based on this 
work but
that as deemed a bridge too far right now.

Implementation details:

* Rather than installing the sysroot artefacts into a combined sysroots, they 
are now placed in
  TMPDIR/sysroot-components/PACKAGE_ARCH/PN.

* WORKDIR/recipe-sysroot and WORKDIR/recipe-sysroot-native are built by 
hardlinking in files
  from the sysroot-component trees. These new directories are known as 
RECIPE_SYSROOT and
  RECIPE_SYSROOT_NATIVE.

* This construction is primarily done by a new do_prepare_recipe_sysroot task 
which runs
  before do_configure and consists of a call to the extend_recipe_sysroot 
function.

* Other tasks need things in the sysroot before/after this, e.g. do_patch needs 
quilt-native
  and do_package_write_deb needs dpkg-native. The code therefore inspects the 
dependencies
  for each task and adds extend_recipe_sysroot as a prefunc if it has 
populate_sysroot
  dependencies.

* We have to do a search/replace 'fixme' operation on the files installed into 
the sysroot to
  change hardcoded paths into the correct ones. We create a fixmepath file in 
the component
  directory which lists the files which need this operation.

* Some files have "postinstall" commands which need to run against them, e.g. 
gdk-pixbuf each
  time a new loader is added. These are handled by adding files in bindir with 
the name
  prefixed by "postinst-" and are run in each sysroot as its created if they're 
present.
  This did mean most sstate postinstalls have to be rewritten but there 
shouldn't be many of them.

* Since a recipe can have multiple tasks and these tasks can run against each 
other at the same
  time we have to have a lock when we perform write operations against the 
sysroot. We also have
  to maintain manifests of what we install against a task checksum of the 
dependency. If the
  checksum changes, we remove its files and then add the new ones.

* The autotools logic for filtering the view of m4 files is no longer needed 
(and was the model
  for the way extend_recipe_sysroot works).

* For autotools, we used to build a combined m4 macros directory which had both 
the native and
  target m4 files. We can no longer do this so we use the target sysroot as the 
default and add
  the native sysroot as an extra backup include path. If we don't do this, we'd 
have to build
  target pkg-config before we could built anything using pkg-config for example 
(ditto gettext).
  Such dependencies would be painful so we haven't required that.

* PKDDATA_DIR was moved out the sysroot and works as before using sstate to 
build a hybrid copy
  for each machine. The paths therefore changed, the behaviour did not.

* The ccache class had to be reworked to function with rss.

* The TCBOOTSTRAP sysroot for compiler bootstrap is no longer needed but the 
-initial data
  does have to be filtered out from the main recipe sysroots. Putting 
"-initial" in a normal
  recipe name therefore remains a bad idea.

* The logic in insane needed tweaks to deal with the new path layout, as did 
the debug source
  file extraction code in package.bbclass.

* The logic in sstate.bbclass had to be rewritten since it previously only 
performed search and
  replace on extracted sstate and we now need this to happen even if the 
compiled path was
  "correct". This in theory could cause a mild performance issue but since the 
sysroot data
  was the main data that needed this and we'd have to do it there regardless 
with rss, I've opted
  just to change the way the class for everything. The built output used to 
build the sstate output
  is now retained and installed rather than deleted.

* The search and replace logic used in sstate objects also seemed 
weak/incorrect and didn't hold
  up against testing. This has been rewritten too. There are some assumptions 
made about paths, we
  save the 'proper' search and replace operations to fixmepath.cmd but then 
ignore this. What is
  here works but is a little hardcoded and an area for future improvement.

* In order to work with eSDK we need a way to build something that looks like 
the old style sysroot.
  "bitbake build-sysroots" will construct such a 

[OE-core] ✗ patchtest: failure for OEQA Framework Refactor & Improvements (rev4)

2017-01-20 Thread Patchwork
== Series Details ==

Series: OEQA Framework Refactor & Improvements (rev4)
Revision: 4
URL   : https://patchwork.openembedded.org/series/4272/
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 failures:



* Patch[33/55] oeqa/core/target Add OESSHTarget to sent commands to 
targets using SSH
 Issue Shortlog does not follow expected format 
[test_shortlog_format] 
  Suggested fixCommit shortlog (first line of commit message) should follow 
the format ": "

* Issue Series does not apply on top of target branch 
[test_series_merge_on_head] 
  Suggested fixRebase your series on top of targeted branch
  Targeted branch  master (currently at ce5c7075d5)



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

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 41/55] oeqa/runtime/context: Add runtime option group and options for target type and server ip.

2017-01-20 Thread Aníbal Limón
Signed-off-by: Aníbal Limón 
---
 meta/lib/oeqa/runtime/context.py | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/runtime/context.py b/meta/lib/oeqa/runtime/context.py
index 10a8872..e692bc0 100644
--- a/meta/lib/oeqa/runtime/context.py
+++ b/meta/lib/oeqa/runtime/context.py
@@ -44,17 +44,34 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
 name = 'runtime'
 help = 'runtime test component'
 description = 'executes runtime tests over targets'
+
 default_cases = os.path.join(os.path.abspath(os.path.dirname(__file__)),
 'cases')
+default_data = None
+
+default_target_type = 'simpleremote'
+default_server_ip = '192.168.7.1'
 default_target_ip = '192.168.7.2'
 
 def register_commands(self, logger, subparsers):
 super(OERuntimeTestContextExecutor, self).register_commands(logger, 
subparsers)
-self.parser.add_argument('--target-ip', action='store',
+
+runtime_group = self.parser.add_argument_group('runtime options')
+
+runtime_group.add_argument('--target-type', action='store',
+default=self.default_target_type, choices=['simpleremote', 
'qemu'],
+help="Target type of device under test, default: %s" \
+% self.default_target_type)
+runtime_group.add_argument('--target-ip', action='store',
 default=self.default_target_ip,
 help="IP address of device under test, default: %s" \
 % self.default_target_ip)
-self.parser.add_argument('--packages-manifest', action='store',
+runtime_group.add_argument('--server-ip', action='store',
+default=self.default_target_ip,
+help="IP address of device under test, default: %s" \
+% self.default_server_ip)
+
+runtime_group.add_argument('--packages-manifest', action='store',
 help="Package manifest of the image under test")
 
 def _process_args(self, logger, args):
@@ -63,6 +80,7 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
 
 super(OERuntimeTestContextExecutor, self)._process_args(logger, args)
 target = OESSHTarget(args.target_ip)
+
 self.tc_kwargs['init']['target'] = target
 
 packages_manifest = os.path.join(os.getcwd(), args.packages_manifest)
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 55/55] selftest/runtime-test.py: Adapt test to use new runtime framework

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

This adapt the current runtime selftest to use the new runtime
framework.

Signed-off-by: Mariano Lopez 
---
 .../lib/oeqa/runtime/{ => cases}/selftest.json |  0
 .../lib/oeqa/runtime/{ => cases}/selftest.py   | 34 +++---
 meta/lib/oeqa/selftest/runtime-test.py | 42 +-
 3 files changed, 31 insertions(+), 45 deletions(-)
 rename meta-selftest/lib/oeqa/runtime/{ => cases}/selftest.json (100%)
 rename meta-selftest/lib/oeqa/runtime/{ => cases}/selftest.py (53%)

diff --git a/meta-selftest/lib/oeqa/runtime/selftest.json 
b/meta-selftest/lib/oeqa/runtime/cases/selftest.json
similarity index 100%
rename from meta-selftest/lib/oeqa/runtime/selftest.json
rename to meta-selftest/lib/oeqa/runtime/cases/selftest.json
diff --git a/meta-selftest/lib/oeqa/runtime/selftest.py 
b/meta-selftest/lib/oeqa/runtime/cases/selftest.py
similarity index 53%
rename from meta-selftest/lib/oeqa/runtime/selftest.py
rename to meta-selftest/lib/oeqa/runtime/cases/selftest.py
index a7e58ab3..329470f 100644
--- a/meta-selftest/lib/oeqa/runtime/selftest.py
+++ b/meta-selftest/lib/oeqa/runtime/cases/selftest.py
@@ -1,13 +1,9 @@
-import os
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
 
-from oeqa.oetest import oeRuntimeTest, skipModule
-from oeqa.utils.commands import runCmd
-from oeqa.utils.decorators import *
+class Selftest(OERuntimeTestCase):
 
-class Selftest(oeRuntimeTest):
-
-@skipUnlessPassed("test_ssh")
-@tag("selftest_package_install")
+@OETestDepends(['ssh.SSHTest.test_ssh'])
 def test_install_package(self):
 """
 Summary: Check basic package installation functionality.
@@ -21,8 +17,7 @@ class Selftest(oeRuntimeTest):
 (status, output) = self.target.run("socat -V")
 self.assertEqual(status, 0, msg="socat is not installed")
 
-@skipUnlessPassed("test_install_package")
-@tag("selftest_package_install")
+@OETestDepends(['selftest.Selftest.test_install_package'])
 def test_verify_unistall(self):
 """
 Summary: Check basic package installation functionality.
@@ -34,22 +29,3 @@ class Selftest(oeRuntimeTest):
 
 (status, output) = self.target.run("socat -V")
 self.assertNotEqual(status, 0, msg="socat is still installed")
-
-@tag("selftest_sdk")
-def test_sdk(self):
-
-result = runCmd("env -0")
-sdk_path = search_sdk_path(result.output)
-self.assertTrue(sdk_path, msg="Can't find SDK path")
-
-tar_cmd = os.path.join(sdk_path, "tar")
-result = runCmd("%s --help" % tar_cmd)
-
-def search_sdk_path(env):
-for line in env.split("\0"):
-(key, _, value) = line.partition("=")
-if key == "PATH":
-for path in value.split(":"):
-if "pokysdk" in path:
-return path
-return ""
diff --git a/meta/lib/oeqa/selftest/runtime-test.py 
b/meta/lib/oeqa/selftest/runtime-test.py
index a105f3f..9e2ecc6 100644
--- a/meta/lib/oeqa/selftest/runtime-test.py
+++ b/meta/lib/oeqa/selftest/runtime-test.py
@@ -6,6 +6,10 @@ import re
 
 class TestExport(oeSelfTest):
 
+@classmethod
+def tearDownClass(cls):
+runCmd("rm -rf /tmp/sdk")
+
 def test_testexport_basic(self):
 """
 Summary: Check basic testexport functionality with only ping test 
enabled.
@@ -34,15 +38,15 @@ class TestExport(oeSelfTest):
 
 with runqemu('core-image-minimal') as qemu:
 # Attempt to run runexported.py to perform ping test
-runexported_path = os.path.join(testexport_dir, "runexported.py")
-testdata_path = os.path.join(testexport_dir, "testdata.json")
-cmd = "%s -t %s -s %s %s" % (runexported_path, qemu.ip, 
qemu.server_ip, testdata_path)
+test_path = os.path.join(testexport_dir, "oe-test")
+data_file = os.path.join(testexport_dir, 'data', 'testdata.json')
+manifest = os.path.join(testexport_dir, 'data', 'manifest')
+cmd = ("%s runtime --test-data-file %s --packages-manifest %s "
+   "--target-ip %s --server-ip %s --quiet"
+  % (test_path, data_file, manifest, qemu.ip, qemu.server_ip))
 result = runCmd(cmd)
-self.assertEqual(0, result.status, 'runexported.py returned a non 
0 status')
-
 # Verify ping test was succesful
-failure = True if 'FAIL' in result.output else False
-self.assertNotEqual(True, failure, 'ping test failed')
+self.assertEqual(0, result.status, 'oe-test runtime returned a non 
0 status')
 
 def test_testexport_sdk(self):
 """
@@ -61,7 +65,6 @@ class TestExport(oeSelfTest):
 features += 'TEST_SERVER_IP = "192.168.7.1"\n'
 features += 'TEST_TARGET_IP = "192.168.7.1"\n'
 features += 'TEST_SUITES = "ping"\n'

[OE-core] [PATCH 53/55] oeqa/runtime/context.py: Add defaults for runtime context

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

This adds default values to OERuntimeTestContextExecutor class in
order to make easier the execution of exported test that were
generated with testexport class.

[YOCTO #10686]

Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/runtime/context.py | 22 +-
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/meta/lib/oeqa/runtime/context.py b/meta/lib/oeqa/runtime/context.py
index 10b8b54..e5e0141 100644
--- a/meta/lib/oeqa/runtime/context.py
+++ b/meta/lib/oeqa/runtime/context.py
@@ -42,12 +42,15 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
 default_cases = os.path.join(os.path.abspath(os.path.dirname(__file__)),
 'cases')
 default_data = None
+default_test_data = 'data/testdata.json'
+default_tests = ''
 
 default_target_type = 'simpleremote'
+default_manifest = 'data/manifest'
 default_server_ip = '192.168.7.1'
 default_target_ip = '192.168.7.2'
 default_host_dumper_dir = '/tmp/oe-saved-tests'
-default_extract_dir = 'extract_dir'
+default_extract_dir = 'packages/extracted'
 
 def register_commands(self, logger, subparsers):
 super(OERuntimeTestContextExecutor, self).register_commands(logger, 
subparsers)
@@ -73,10 +76,14 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
 % self.default_host_dumper_dir)
 
 runtime_group.add_argument('--packages-manifest', action='store',
-help="Package manifest of the image under test")
+default=self.default_manifest,
+help="Package manifest of the image under testi, default: %s" \
+% self.default_manifest)
 
 runtime_group.add_argument('--extract-dir', action='store',
-help='Directory where extracted packages reside')
+default=self.default_extract_dir,
+help='Directory where extracted packages reside, default: %s' \
+% self.default_extract_dir)
 
 runtime_group.add_argument('--qemu-boot', action='store',
 help="Qemu boot configuration, only needed when target_type is 
QEMU.")
@@ -97,7 +104,7 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
 
 @staticmethod
 def readPackagesManifest(manifest):
-if not os.path.exists(manifest):
+if not manifest or not os.path.exists(manifest):
 raise OSError("Manifest file not exists: %s" % manifest)
 
 image_packages = set()
@@ -124,16 +131,13 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
 
 self.tc_kwargs['init']['target'] = \
 OERuntimeTestContextExecutor.getTarget(args.target_type,
-args.target_ip, args.server_ip, **target_kwargs)
+None, args.target_ip, args.server_ip, **target_kwargs)
 self.tc_kwargs['init']['host_dumper'] = \
 OERuntimeTestContextExecutor.getHostDumper(None,
 args.host_dumper_dir)
 self.tc_kwargs['init']['image_packages'] = \
 OERuntimeTestContextExecutor.readPackagesManifest(
 args.packages_manifest)
-
-self.tc_kwargs['init']['extract_dir'] = \
-OERuntimeTestContextExecutor.readPackagesManifest(
-args.extract_dir)
+self.tc_kwargs['init']['extract_dir'] = args.extract_dir
 
 _executor_class = OERuntimeTestContextExecutor
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 51/55] testimage.bbclass: Add support for package extraction

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

testimage support the installation of packages without a package
manager in the target. This adds support for package extraction
required to support the installation feature.

[YOCTO #10234]

Signed-off-by: Mariano Lopez 
---
 meta/classes/testimage.bbclass |  12 +++
 meta/lib/oeqa/utils/package_manager.py | 161 +
 2 files changed, 173 insertions(+)

diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index abcecca..1dfbc49 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -243,6 +243,8 @@ def testimage_main(d):
 test_modules = d.getVar('TEST_SUITES')
 tc.loadTests(test_paths, modules=test_modules)
 
+package_extraction(d, tc.suites)
+
 bootparams = None
 if d.getVar('VIRTUAL-RUNTIME_init_manager', '') == 'systemd':
 bootparams = 'systemd.log_level=debug systemd.log_target=console'
@@ -337,12 +339,22 @@ def create_rpm_index(d):
 if result:
 bb.fatal('%s' % ('\n'.join(result)))
 
+def package_extraction(d, test_suites):
+from oeqa.utils.package_manager import find_packages_to_extract
+from oeqa.utils.package_manager import extract_packages
+
+test_create_extract_dirs(d)
+packages = find_packages_to_extract(test_suites)
+extract_packages(d, packages)
+
 def test_create_extract_dirs(d):
 install_path = d.getVar("TEST_INSTALL_TMP_DIR")
 package_path = d.getVar("TEST_PACKAGED_DIR")
 extracted_path = d.getVar("TEST_EXTRACTED_DIR")
 bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR"))
+bb.utils.remove(install_path, recurse=True)
 bb.utils.remove(package_path, recurse=True)
+bb.utils.remove(extracted_path, recurse=True)
 bb.utils.mkdirhier(install_path)
 bb.utils.mkdirhier(package_path)
 bb.utils.mkdirhier(extracted_path)
diff --git a/meta/lib/oeqa/utils/package_manager.py 
b/meta/lib/oeqa/utils/package_manager.py
index 0f6bdbc..ab0d3e5 100644
--- a/meta/lib/oeqa/utils/package_manager.py
+++ b/meta/lib/oeqa/utils/package_manager.py
@@ -1,3 +1,8 @@
+import bb
+import json
+import shutil
+
+
 def get_package_manager(d, root_path):
 """
 Returns an OE package manager that can install packages in root_path.
@@ -27,3 +32,159 @@ def get_package_manager(d, root_path):
 pm.update()
 
 return pm
+
+def find_packages_to_extract(test_suite):
+"""
+Returns packages to extract required by runtime tests.
+"""
+from oeqa.core.utils.test import getSuiteCasesFiles
+
+needed_packages = {}
+files = getSuiteCasesFiles(test_suite)
+
+for f in set(files):
+json_file = _get_json_file(f)
+if json_file:
+needed_packages.update(_get_needed_packages(json_file))
+
+return needed_packages
+
+def _get_json_file(module_path):
+"""
+Returns the path of the JSON file for a module, empty if doesn't exitst.
+"""
+
+json_file = '%s.json' % module_path.rsplit('.', 1)[0]
+if os.path.isfile(module_path) and os.path.isfile(json_file):
+return json_file
+else:
+return ''
+
+def _get_needed_packages(json_file, test=None):
+"""
+Returns a dict with needed packages based on a JSON file.
+
+If a test is specified it will return the dict just for that test.
+"""
+needed_packages = {}
+
+with open(json_file) as f:
+test_packages = json.load(f)
+for key,value in test_packages.items():
+needed_packages[key] = value
+
+if test:
+if test in needed_packages:
+needed_packages = needed_packages[test]
+else:
+needed_packages = {}
+
+return needed_packages
+
+def extract_packages(d, needed_packages):
+"""
+Extract packages that will be needed during runtime.
+"""
+
+import oe.path
+
+extracted_path = d.getVar('TEST_EXTRACTED_DIR')
+
+for key,value in needed_packages.items():
+packages = ()
+if isinstance(value, dict):
+packages = (value, )
+elif isinstance(value, list):
+packages = value
+else:
+bb.fatal('Failed to process needed packages for %s; '
+ 'Value must be a dict or list' % key)
+
+for package in packages:
+pkg = package['pkg']
+rm = package.get('rm', False)
+extract = package.get('extract', True)
+
+if extract:
+#logger.debug(1, 'Extracting %s' % pkg)
+dst_dir = os.path.join(extracted_path, pkg)
+# Same package used for more than one test,
+# don't need to extract again.
+if os.path.exists(dst_dir):
+continue
+
+# Extract package and copy it to TEST_EXTRACTED_DIR
+pkg_dir = _extract_in_tmpdir(d, pkg)
+oe.path.copytree(pkg_dir, dst_dir)
+

[OE-core] [PATCH 54/55] testexport.bbclass: Migrate testexport to use new framework

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

This migrates current testexport implmentation to use the
new OEQA framework.

[YOCTO #10686]

Signed-off-by: Mariano Lopez 
---
 meta/classes/testexport.bbclass | 215 +---
 scripts/oe-test |  10 +-
 2 files changed, 99 insertions(+), 126 deletions(-)

diff --git a/meta/classes/testexport.bbclass b/meta/classes/testexport.bbclass
index 5398b3c..56edda9 100644
--- a/meta/classes/testexport.bbclass
+++ b/meta/classes/testexport.bbclass
@@ -33,113 +33,111 @@ TEST_EXPORT_DEPENDS += 
"${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'cpio-nativ
 TEST_EXPORT_DEPENDS += "${@bb.utils.contains('TEST_EXPORT_SDK_ENABLED', '1', 
'testexport-tarball:do_populate_sdk', '', d)}"
 TEST_EXPORT_LOCK = "${TMPDIR}/testimage.lock"
 
-python do_testexport() {
-testexport_main(d)
-}
-
 addtask testexport
 do_testexport[nostamp] = "1"
 do_testexport[depends] += "${TEST_EXPORT_DEPENDS} ${TESTIMAGEDEPENDS}"
 do_testexport[lockfiles] += "${TEST_EXPORT_LOCK}"
 
-def exportTests(d,tc):
+python do_testexport() {
+testexport_main(d)
+}
+
+def testexport_main(d):
 import json
+import logging
+
+from oeqa.runtime.context import OERuntimeTestContext
+from oeqa.runtime.context import OERuntimeTestContextExecutor
+
+image_name = ("%s/%s" % (d.getVar('DEPLOY_DIR_IMAGE'),
+ d.getVar('IMAGE_LINK_NAME')))
+
+tdname = "%s.testdata.json" % image_name
+td = json.load(open(tdname, "r"))
+
+logger = logging.getLogger("BitBake")
+
+target = OERuntimeTestContextExecutor.getTarget(
+d.getVar("TEST_TARGET"), None, d.getVar("TEST_TARGET_IP"),
+d.getVar("TEST_SERVER_IP"))
+
+host_dumper = OERuntimeTestContextExecutor.getHostDumper(
+d.getVar("testimage_dump_host"), d.getVar("TESTIMAGE_DUMP_DIR"))
+
+image_manifest = "%s.manifest" % image_name
+image_packages = 
OERuntimeTestContextExecutor.readPackagesManifest(image_manifest)
+
+extract_dir = d.getVar("TEST_EXTRACTED_DIR")
+
+tc = OERuntimeTestContext(td, logger, target, host_dumper,
+  image_packages, extract_dir)
+
+copy_needed_files(d, tc)
+
+def copy_needed_files(d, tc):
 import shutil
-import pkgutil
-import re
 import oe.path
 
-exportpath = d.getVar("TEST_EXPORT_DIR")
-
-savedata = {}
-savedata["d"] = {}
-savedata["target"] = {}
-savedata["target"]["ip"] = tc.target.ip or d.getVar("TEST_TARGET_IP")
-savedata["target"]["server_ip"] = tc.target.server_ip or 
d.getVar("TEST_SERVER_IP")
-
-keys = [ key for key in d.keys() if not key.startswith("_") and not 
key.startswith("BB") \
-and not key.startswith("B_pn") and not key.startswith("do_") and 
not d.getVarFlag(key, "func")]
-for key in keys:
-try:
-savedata["d"][key] = d.getVar(key)
-except bb.data_smart.ExpansionError:
-# we don't care about those anyway
-pass
-
-json_file = os.path.join(exportpath, "testdata.json")
-with open(json_file, "w") as f:
-json.dump(savedata, f, skipkeys=True, indent=4, sort_keys=True)
-
-# Replace absolute path with relative in the file
-exclude_path = os.path.join(d.getVar("COREBASE"),'meta','lib','oeqa')
-f1 = open(json_file,'r').read()
-f2 = open(json_file,'w')
-m = f1.replace(exclude_path,'oeqa')
-f2.write(m)
-f2.close()
-
-# now start copying files
-# we'll basically copy everything under meta/lib/oeqa, with these 
exceptions
-#  - oeqa/targetcontrol.py - not needed
-#  - oeqa/selftest - something else
-# That means:
-#   - all tests from oeqa/runtime defined in TEST_SUITES (including from 
other layers)
-#   - the contents of oeqa/utils and oeqa/runtime/files
-#   - oeqa/oetest.py and oeqa/runexport.py (this will get copied to 
exportpath not exportpath/oeqa)
-#   - __init__.py files
-bb.utils.mkdirhier(os.path.join(exportpath, "oeqa/files"))
-bb.utils.mkdirhier(os.path.join(exportpath, "oeqa/runtime/files"))
-bb.utils.mkdirhier(os.path.join(exportpath, "oeqa/utils"))
-# copy test modules, this should cover tests in other layers too
-bbpath = d.getVar("BBPATH").split(':')
-for t in tc.testslist:
-isfolder = False
-if re.search("\w+\.\w+\.test_\S+", t):
-t = '.'.join(t.split('.')[:3])
-mod = pkgutil.get_loader(t)
-# More depth than usual?
-if (t.count('.') > 2):
-for p in bbpath:
-foldername = os.path.join(p, 'lib',  
os.sep.join(t.split('.')).rsplit(os.sep, 1)[0])
-if os.path.isdir(foldername):
-isfolder = True
-target_folder = os.path.join(exportpath, "oeqa", 
"runtime", os.path.basename(foldername))
-if not os.path.exists(target_folder):
-

[OE-core] [PATCH 52/55] testimage.bbclass: Add package install feature

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

This allows to use the package install feature with
the new OEQA framework.

[YOCTO #10234]

Signed-off-by: Mariano Lopez 
---
 meta/classes/testimage.bbclass | 27 
 meta/lib/oeqa/core/utils/test.py   | 10 +---
 meta/lib/oeqa/runtime/case.py  |  9 +++
 meta/lib/oeqa/runtime/context.py   | 12 -
 meta/lib/oeqa/utils/package_manager.py | 46 --
 5 files changed, 69 insertions(+), 35 deletions(-)

diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index 1dfbc49..96e41c6 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -159,7 +159,6 @@ def testimage_main(d):
 pn = d.getVar("PN")
 
 bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR"))
-#test_create_extract_dirs(d)
 
 image_name = ("%s/%s" % (d.getVar('DEPLOY_DIR_IMAGE'),
  d.getVar('IMAGE_LINK_NAME')))
@@ -170,6 +169,8 @@ def testimage_main(d):
 image_manifest = "%s.manifest" % image_name
 image_packages = 
OERuntimeTestContextExecutor.readPackagesManifest(image_manifest)
 
+extract_dir = d.getVar("TEST_EXTRACTED_DIR")
+
 # Get machine
 machine = d.getVar("MACHINE")
 
@@ -236,7 +237,8 @@ def testimage_main(d):
 d.getVar("TEST_SERVER_IP"), **target_kwargs)
 
 # test context
-tc = OERuntimeTestContext(td, logger, target, host_dumper, image_packages)
+tc = OERuntimeTestContext(td, logger, target, host_dumper,
+  image_packages, extract_dir)
 
 # Load tests before starting the target
 test_paths = get_runtime_paths(d)
@@ -343,22 +345,13 @@ def package_extraction(d, test_suites):
 from oeqa.utils.package_manager import find_packages_to_extract
 from oeqa.utils.package_manager import extract_packages
 
-test_create_extract_dirs(d)
+bb.utils.remove(d.getVar("TEST_NEEDED_PACKAGES_DIR"), recurse=True)
 packages = find_packages_to_extract(test_suites)
-extract_packages(d, packages)
-
-def test_create_extract_dirs(d):
-install_path = d.getVar("TEST_INSTALL_TMP_DIR")
-package_path = d.getVar("TEST_PACKAGED_DIR")
-extracted_path = d.getVar("TEST_EXTRACTED_DIR")
-bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR"))
-bb.utils.remove(install_path, recurse=True)
-bb.utils.remove(package_path, recurse=True)
-bb.utils.remove(extracted_path, recurse=True)
-bb.utils.mkdirhier(install_path)
-bb.utils.mkdirhier(package_path)
-bb.utils.mkdirhier(extracted_path)
-
+if packages:
+bb.utils.mkdirhier(d.getVar("TEST_INSTALL_TMP_DIR"))
+bb.utils.mkdirhier(d.getVar("TEST_PACKAGED_DIR"))
+bb.utils.mkdirhier(d.getVar("TEST_EXTRACTED_DIR"))
+extract_packages(d, packages)
 
 testimage_main[vardepsexclude] += "BB_ORIGENV DATETIME"
 
diff --git a/meta/lib/oeqa/core/utils/test.py b/meta/lib/oeqa/core/utils/test.py
index 88d1765..88d5d13 100644
--- a/meta/lib/oeqa/core/utils/test.py
+++ b/meta/lib/oeqa/core/utils/test.py
@@ -10,11 +10,13 @@ def getSuiteCases(suite):
 Returns individual test from a test suite.
 """
 tests = []
-for item in suite:
-if isinstance(item, unittest.suite.TestSuite):
+
+if isinstance(suite, unittest.TestCase):
+tests.append(suite)
+elif isinstance(suite, unittest.suite.TestSuite):
+for item in suite:
 tests.extend(getSuiteCases(item))
-elif isinstance(item, unittest.TestCase):
-tests.append(item)
+
 return tests
 
 def getSuiteModules(suite):
diff --git a/meta/lib/oeqa/runtime/case.py b/meta/lib/oeqa/runtime/case.py
index 43f1b2f..c1485c9 100644
--- a/meta/lib/oeqa/runtime/case.py
+++ b/meta/lib/oeqa/runtime/case.py
@@ -2,7 +2,16 @@
 # Released under the MIT license (see COPYING.MIT)
 
 from oeqa.core.case import OETestCase
+from oeqa.utils.package_manager import install_package, uninstall_package
 
 class OERuntimeTestCase(OETestCase):
 # target instance set by OERuntimeTestLoader.
 target = None
+
+def _oeSetUp(self):
+super(OERuntimeTestCase, self)._oeSetUp()
+install_package(self)
+
+def _oeTearDown(self):
+super(OERuntimeTestCase, self)._oeTearDown()
+uninstall_package(self)
diff --git a/meta/lib/oeqa/runtime/context.py b/meta/lib/oeqa/runtime/context.py
index bc8abd0..10b8b54 100644
--- a/meta/lib/oeqa/runtime/context.py
+++ b/meta/lib/oeqa/runtime/context.py
@@ -15,12 +15,14 @@ class OERuntimeTestContext(OETestContext):
 runtime_files_dir = os.path.join(
 os.path.dirname(os.path.abspath(__file__)), "files")
 
-def __init__(self, td, logger, target, host_dumper, image_packages):
+def __init__(self, td, logger, target,
+ host_dumper, image_packages, extract_dir):
 super(OERuntimeTestContext, self).__init__(td, logger)
 
 self.target = 

[OE-core] [PATCH 50/55] oeqa/core/utils/test.py: Add functions to get module path

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

This will add functions to get module file path from a test
case or a complete suite.

[YOCTO #10234]

Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/core/utils/test.py | 13 +
 1 file changed, 13 insertions(+)

diff --git a/meta/lib/oeqa/core/utils/test.py b/meta/lib/oeqa/core/utils/test.py
index 820b997..88d1765 100644
--- a/meta/lib/oeqa/core/utils/test.py
+++ b/meta/lib/oeqa/core/utils/test.py
@@ -2,6 +2,7 @@
 # Released under the MIT license (see COPYING.MIT)
 
 import os
+import inspect
 import unittest
 
 def getSuiteCases(suite):
@@ -46,6 +47,12 @@ def getSuiteCasesIDs(suite):
 """
 return getSuiteCasesInfo(suite, getCaseID)
 
+def getSuiteCasesFiles(suite):
+"""
+Returns test case files paths from suite.
+"""
+return getSuiteCasesInfo(suite, getCaseFile)
+
 def getCaseModule(test_case):
 """
 Returns test case module name.
@@ -64,6 +71,12 @@ def getCaseID(test_case):
 """
 return test_case.id()
 
+def getCaseFile(test_case):
+"""
+Returns test case file path.
+"""
+return inspect.getsourcefile(test_case.__class__)
+
 def getCaseMethod(test_case):
 """
 Returns test case method name.
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 47/55] testimage.bbclass: Migrate class to use new runtime framework

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

This migrates testimage class to use the new framework. Most of
the code added here is to get rid off the data store dependency.

[YOCTO #10234]

Signed-off-by: Mariano Lopez 
---
 meta/classes/testimage.bbclass | 186 +++--
 1 file changed, 144 insertions(+), 42 deletions(-)

diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index 62ecaef..016c1c1 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -77,6 +77,7 @@ TESTIMAGEDEPENDS_qemuall += 
"${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 'creat
 TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 
'python-smartpm-native:do_populate_sysroot', '', d)}"
 TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'ipk', 
'opkg-utils-native:do_populate_sysroot', '', d)}"
 TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'deb', 
'apt-native:do_populate_sysroot', '', d)}"
+TESTIMAGEDEPENDS += "${@bb.utils.contains('IMAGE_PKGTYPE', 'rpm', 
'python-smartpm-native:do_populate_sysroot', '', d)}"
 
 
 TESTIMAGELOCK = "${TMPDIR}/testimage.lock"
@@ -112,6 +113,9 @@ testimage_dump_host () {
 }
 
 python do_testimage() {
+
+testimage_sanity(d)
+
 testimage_main(d)
 }
 
@@ -120,67 +124,165 @@ do_testimage[nostamp] = "1"
 do_testimage[depends] += "${TESTIMAGEDEPENDS}"
 do_testimage[lockfiles] += "${TESTIMAGELOCK}"
 
+def testimage_sanity(d):
+if (d.getVar('TEST_TARGET') == 'simpleremote'
+and (not d.getVar('TEST_TARGET_IP')
+ or not d.getVar('TEST_SERVER_IP'))):
+bb.fatal('When TEST_TARGET is set to "simpleremote" '
+ 'TEST_TARGET_IP and TEST_SERVER_IP are needed too.')
+
 def testimage_main(d):
-import unittest
 import os
-import oeqa.runtime
-import time
 import signal
-from oeqa.oetest import ImageTestContext
-from oeqa.targetcontrol import get_target_controller
-from bb.utils import export_proxies
-from oeqa.utils.dump import HostDumper
+import json
+import sys
+import logging
+import time
 
+from bb.utils import export_proxies
+from oeqa.runtime.context import OERuntimeTestContext
+from oeqa.runtime.context import OERuntimeTestContextExecutor
+from oeqa.core.target.qemu import supported_fstypes
+from oeqa.utils import make_logger_bitbake_compatible
+
+def sigterm_exception(signum, stackframe):
+"""
+Catch SIGTERM from worker in order to stop qemu.
+"""
+raise RuntimeError
+
+logger = make_logger_bitbake_compatible(logging.getLogger("BitBake"))
 pn = d.getVar("PN")
+
 bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR"))
-test_create_extract_dirs(d)
+#test_create_extract_dirs(d)
+
+image_name = ("%s/%s" % (d.getVar('DEPLOY_DIR_IMAGE'),
+ d.getVar('IMAGE_LINK_NAME')))
+
+tdname = "%s.testdata.json" % image_name
+td = json.load(open(tdname, "r"))
+
+image_manifest = "%s.manifest" % image_name
+image_packages = 
OERuntimeTestContextExecutor.readPackagesManifest(image_manifest)
+
+# Get machine
+machine = d.getVar("MACHINE")
+
+# Get rootfs
+fstypes = [fs for fs in d.getVar('IMAGE_FSTYPES').split(' ')
+  if fs in supported_fstypes]
+if not fstypes:
+bb.fatal('Unsupported image type built. Add a comptible image to '
+ 'IMAGE_FSTYPES. Supported types: %s' %
+ ', '.join(supported_fstypes))
+rootfs = '%s.%s' % (image_name, fstypes[0])
+
+# Get tmpdir (not really used, just for compatibility)
+tmpdir = d.getVar("TMPDIR")
+
+# Get deploy_dir_image (not really used, just for compatibility)
+dir_image = d.getVar("DEPLOY_DIR_IMAGE")
+
+# Get bootlog
+bootlog = os.path.join(d.getVar("TEST_LOG_DIR"),
+   'qemu_boot_log.%s' % d.getVar('DATETIME'))
+
+# Get display
+display = d.getVar("BB_ORIGENV").getVar("DISPLAY")
+
+# Get kernel
+kernel_name = ('%s-%s.bin' % (d.getVar("KERNEL_IMAGETYPE"), machine))
+kernel = os.path.join(d.getVar("DEPLOY_DIR_IMAGE"), kernel_name)
+
+# Get boottime
+boottime = int(d.getVar("TEST_QEMUBOOT_TIMEOUT"))
+
+# Get use_kvm
+qemu_use_kvm = d.getVar("QEMU_USE_KVM")
+if qemu_use_kvm and qemu_use_kvm == 'True' and 'x86' in machine:
+kvm = True
+else:
+kvm = False
+
+# TODO: We use the current implementatin of qemu runner because of
+# time constrains, qemu runner really needs a refactor too.
+target_kwargs = { 'machine' : machine,
+  'rootfs'  : rootfs,
+  'tmpdir'  : tmpdir,
+  'dir_image'   : dir_image,
+  'display' : display,
+  'kernel'  : kernel,
+  'boottime': boottime,
+  'bootlog' 

[OE-core] [PATCH 48/55] oeqa/runtime/cases: Migrate runtime tests.

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

This migrates current runtime test suite to be used with the new framework.

[YOCTO #10234]

Signed-off-by: Mariano Lopez 
---
 .../{runtime_cases => runtime/cases}/_ptest.py |   0
 .../{runtime_cases => runtime/cases}/_qemutiny.py  |   0
 meta/lib/oeqa/runtime/cases/buildcvs.py|  35 
 meta/lib/oeqa/runtime/cases/buildgalculator.py |  31 
 meta/lib/oeqa/runtime/cases/buildiptables.py   |  39 +
 meta/lib/oeqa/runtime/cases/connman.py |  30 
 meta/lib/oeqa/runtime/cases/date.py|  38 +
 meta/lib/oeqa/runtime/cases/df.py  |  13 ++
 meta/lib/oeqa/runtime/cases/gcc.py |  76 +
 meta/lib/oeqa/runtime/cases/kernelmodule.py|  40 +
 meta/lib/oeqa/runtime/cases/ldd.py |  25 +++
 meta/lib/oeqa/runtime/cases/logrotate.py   |  42 +
 meta/lib/oeqa/runtime/cases/multilib.py|  41 +
 meta/lib/oeqa/runtime/cases/pam.py |  33 
 .../{runtime_cases => runtime/cases}/parselogs.py  | 187 -
 meta/lib/oeqa/runtime/cases/perl.py|  37 
 meta/lib/oeqa/runtime/cases/ping.py|  24 +++
 meta/lib/oeqa/runtime/cases/python.py  |  43 +
 meta/lib/oeqa/runtime/cases/rpm.py | 141 
 meta/lib/oeqa/runtime/cases/scanelf.py |  26 +++
 meta/lib/oeqa/runtime/cases/scp.py |  33 
 meta/lib/oeqa/runtime/cases/skeletoninit.py|  33 
 .../oeqa/{runtime_cases => runtime/cases}/smart.py |   0
 meta/lib/oeqa/runtime/cases/ssh.py |  15 ++
 meta/lib/oeqa/runtime/cases/syslog.py  |  57 +++
 .../{runtime_cases => runtime/cases}/systemd.py| 151 +
 meta/lib/oeqa/runtime/cases/x32lib.py  |  19 +++
 meta/lib/oeqa/runtime/cases/xorg.py|  17 ++
 meta/lib/oeqa/runtime_cases/buildcvs.py|  32 
 meta/lib/oeqa/runtime_cases/buildgalculator.py |  26 ---
 meta/lib/oeqa/runtime_cases/buildiptables.py   |  33 
 meta/lib/oeqa/runtime_cases/connman.py |  31 
 meta/lib/oeqa/runtime_cases/date.py|  31 
 meta/lib/oeqa/runtime_cases/df.py  |  12 --
 meta/lib/oeqa/runtime_cases/gcc.py |  47 --
 meta/lib/oeqa/runtime_cases/kernelmodule.py|  34 
 meta/lib/oeqa/runtime_cases/ldd.py |  21 ---
 meta/lib/oeqa/runtime_cases/logrotate.py   |  30 
 meta/lib/oeqa/runtime_cases/multilib.py|  42 -
 meta/lib/oeqa/runtime_cases/pam.py |  25 ---
 meta/lib/oeqa/runtime_cases/perl.py|  30 
 meta/lib/oeqa/runtime_cases/ping.py|  22 ---
 meta/lib/oeqa/runtime_cases/python.py  |  35 
 meta/lib/oeqa/runtime_cases/rpm.py | 120 -
 meta/lib/oeqa/runtime_cases/scanelf.py |  28 ---
 meta/lib/oeqa/runtime_cases/scp.py |  22 ---
 meta/lib/oeqa/runtime_cases/skeletoninit.py|  29 
 meta/lib/oeqa/runtime_cases/ssh.py |  19 ---
 meta/lib/oeqa/runtime_cases/syslog.py  |  52 --
 meta/lib/oeqa/runtime_cases/x32lib.py  |  18 --
 meta/lib/oeqa/runtime_cases/xorg.py|  16 --
 51 files changed, 1075 insertions(+), 906 deletions(-)
 rename meta/lib/oeqa/{runtime_cases => runtime/cases}/_ptest.py (100%)
 rename meta/lib/oeqa/{runtime_cases => runtime/cases}/_qemutiny.py (100%)
 create mode 100644 meta/lib/oeqa/runtime/cases/buildcvs.py
 create mode 100644 meta/lib/oeqa/runtime/cases/buildgalculator.py
 create mode 100644 meta/lib/oeqa/runtime/cases/buildiptables.py
 create mode 100644 meta/lib/oeqa/runtime/cases/connman.py
 create mode 100644 meta/lib/oeqa/runtime/cases/date.py
 create mode 100644 meta/lib/oeqa/runtime/cases/df.py
 create mode 100644 meta/lib/oeqa/runtime/cases/gcc.py
 create mode 100644 meta/lib/oeqa/runtime/cases/kernelmodule.py
 create mode 100644 meta/lib/oeqa/runtime/cases/ldd.py
 create mode 100644 meta/lib/oeqa/runtime/cases/logrotate.py
 create mode 100644 meta/lib/oeqa/runtime/cases/multilib.py
 create mode 100644 meta/lib/oeqa/runtime/cases/pam.py
 rename meta/lib/oeqa/{runtime_cases => runtime/cases}/parselogs.py (64%)
 create mode 100644 meta/lib/oeqa/runtime/cases/perl.py
 create mode 100644 meta/lib/oeqa/runtime/cases/ping.py
 create mode 100644 meta/lib/oeqa/runtime/cases/python.py
 create mode 100644 meta/lib/oeqa/runtime/cases/rpm.py
 create mode 100644 meta/lib/oeqa/runtime/cases/scanelf.py
 create mode 100644 meta/lib/oeqa/runtime/cases/scp.py
 create mode 100644 meta/lib/oeqa/runtime/cases/skeletoninit.py
 rename meta/lib/oeqa/{runtime_cases => runtime/cases}/smart.py (100%)
 create mode 100644 meta/lib/oeqa/runtime/cases/ssh.py
 create mode 100644 

[OE-core] [PATCH 49/55] runtime/cases/smart.py: Migrate smart tests

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

This migrates the smart test from the old framework to
the new one. This has its own commit because smart
test was using bb and oe libraries that are available
when exporting the test cases to run in a different host.

Because of the removal of bb and oe libraries index and
packages feeds creation will be managed in testimage bbclass.

[YOCTO #10234]

Signed-off-by: Mariano Lopez 
---
 meta/classes/testimage.bbclass   |  53 +++
 meta/lib/oeqa/runtime/cases/smart.py | 172 +++
 2 files changed, 128 insertions(+), 97 deletions(-)

diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index 016c1c1..abcecca 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -116,6 +116,10 @@ python do_testimage() {
 
 testimage_sanity(d)
 
+if (d.getVar('IMAGE_PKGTYPE') == 'rpm'
+   and 'smart' in d.getVar('TEST_SUITES')):
+create_rpm_index(d)
+
 testimage_main(d)
 }
 
@@ -284,6 +288,55 @@ def get_runtime_paths(d):
 paths.append(path)
 return paths
 
+def create_index(arg):
+import subprocess
+
+index_cmd = arg
+try:
+bb.note("Executing '%s' ..." % index_cmd)
+result = subprocess.check_output(index_cmd,
+stderr=subprocess.STDOUT,
+shell=True)
+result = result.decode('utf-8')
+except subprocess.CalledProcessError as e:
+return("Index creation command '%s' failed with return code "
+   '%d:\n%s' % (e.cmd, e.returncode, e.output.decode("utf-8")))
+if result:
+bb.note(result)
+return None
+
+def create_rpm_index(d):
+# Index RPMs
+rpm_createrepo = bb.utils.which(os.getenv('PATH'), "createrepo")
+index_cmds = []
+archs = (d.getVar('ALL_MULTILIB_PACKAGE_ARCHS') or '').replace('-', '_')
+
+for arch in archs.split():
+rpm_dir = os.path.join(d.getVar('DEPLOY_DIR_RPM'), arch)
+idx_path = os.path.join(d.getVar('WORKDIR'), 'rpm', arch)
+db_path = os.path.join(d.getVar('WORKDIR'), 'rpmdb', arch)
+
+if not os.path.isdir(rpm_dir):
+continue
+if os.path.exists(db_path):
+bb.utils.remove(dbpath, True)
+
+lockfilename = os.path.join(d.getVar('DEPLOY_DIR_RPM'), 'rpm.lock')
+lf = bb.utils.lockfile(lockfilename, False)
+oe.path.copyhardlinktree(rpm_dir, idx_path)
+# Full indexes overload a 256MB image so reduce the number of rpms
+# in the feed. Filter to p* since we use the psplash packages and
+# this leaves some allarch and machine arch packages too.
+bb.utils.remove(idx_path + "*/[a-oq-z]*.rpm")
+bb.utils.unlockfile(lf)
+cmd = '%s --dbpath %s --update -q %s' % (rpm_createrepo,
+ db_path, idx_path)
+
+# Create repodata
+result = create_index(cmd)
+if result:
+bb.fatal('%s' % ('\n'.join(result)))
+
 def test_create_extract_dirs(d):
 install_path = d.getVar("TEST_INSTALL_TMP_DIR")
 package_path = d.getVar("TEST_PACKAGED_DIR")
diff --git a/meta/lib/oeqa/runtime/cases/smart.py 
b/meta/lib/oeqa/runtime/cases/smart.py
index dde1c4d..9b4d0d2 100644
--- a/meta/lib/oeqa/runtime/cases/smart.py
+++ b/meta/lib/oeqa/runtime/cases/smart.py
@@ -1,166 +1,142 @@
-import unittest
+import os
 import re
-import oe
 import subprocess
-from oeqa.oetest import oeRuntimeTest, skipModule
-from oeqa.utils.decorators import *
 from oeqa.utils.httpserver import HTTPService
 
-def setUpModule():
-if not oeRuntimeTest.hasFeature("package-management"):
-skipModule("Image doesn't have package management feature")
-if not oeRuntimeTest.hasPackage("smartpm"):
-skipModule("Image doesn't have smart installed")
-if "package_rpm" != 
oeRuntimeTest.tc.d.getVar("PACKAGE_CLASSES").split()[0]:
-skipModule("Rpm is not the primary package manager")
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.core.decorator.oeid import OETestID
+from oeqa.core.decorator.data import skipIfNotDataVar, skipIfNotFeature
+from oeqa.runtime.decorator.package import OEHasPackage
 
-class SmartTest(oeRuntimeTest):
+class SmartTest(OERuntimeTestCase):
 
-@skipUnlessPassed('test_smart_help')
 def smart(self, command, expected = 0):
 command = 'smart %s' % command
 status, output = self.target.run(command, 1500)
 message = os.linesep.join([command, output])
 self.assertEqual(status, expected, message)
-self.assertFalse("Cannot allocate memory" in output, message)
+self.assertFalse('Cannot allocate memory' in output, message)
 return output
 
 class SmartBasicTest(SmartTest):
 
-@testcase(716)
-@skipUnlessPassed('test_ssh')

[OE-core] [PATCH 46/55] core/target/qemu.py Adds qemu target

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

This adds qemu target to be used in testimage.
It uses the current QemuRunner class in order
to boot and control qemu.

[YOCTO #10231]

Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/core/target/qemu.py | 45 +++
 1 file changed, 45 insertions(+)
 create mode 100644 meta/lib/oeqa/core/target/qemu.py

diff --git a/meta/lib/oeqa/core/target/qemu.py 
b/meta/lib/oeqa/core/target/qemu.py
new file mode 100644
index 000..641dd6a
--- /dev/null
+++ b/meta/lib/oeqa/core/target/qemu.py
@@ -0,0 +1,45 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+import os
+import sys
+import signal
+import time
+
+from .ssh import OESSHTarget
+from oeqa.utils.qemurunner import QemuRunner
+
+supported_fstypes = ['ext3', 'ext4', 'cpio.gz', 'wic']
+
+class OEQemuTarget(OESSHTarget):
+def __init__(self, logger, ip, server_ip, timeout=300, user='root',
+port=None, machine='', rootfs='', kernel='', kvm=False,
+dump_dir='', dump_host_cmds='', display='', bootlog='',
+tmpdir='', dir_image='', boottime=60):
+
+super(OEQemuTarget, self).__init__(logger, ip, server_ip, timeout,
+user, port)
+
+self.ip = ip
+self.server_ip = server_ip
+self.machine = machine
+self.rootfs = rootfs
+self.kernel = kernel
+self.kvm = kvm
+
+self.runner = QemuRunner(machine=machine, rootfs=rootfs, tmpdir=tmpdir,
+ deploy_dir_image=dir_image, display=display,
+ logfile=bootlog, boottime=boottime,
+ use_kvm=kvm, dump_dir=dump_dir,
+ dump_host_cmds=dump_host_cmds)
+
+def start(self, params=None, extra_bootparams=None):
+if self.runner.start(params, extra_bootparams=extra_bootparams):
+self.ip = self.runner.ip
+self.server_ip = self.runner.server_ip
+else:
+self.stop()
+raise RuntimeError("FAILED to start qemu - check the task log and 
the boot log")
+
+def stop(self):
+self.runner.stop()
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 45/55] oeqa/runtime/context.py: Add logger to getTarget

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

Current targets (ssh and qemu) require a logger in their
constructors, so in order to get a new target we need
to provide the logger.

[YOCTO #10686]

Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/runtime/context.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/lib/oeqa/runtime/context.py b/meta/lib/oeqa/runtime/context.py
index f0f6e62..bc8abd0 100644
--- a/meta/lib/oeqa/runtime/context.py
+++ b/meta/lib/oeqa/runtime/context.py
@@ -76,13 +76,13 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
 help="Qemu boot configuration, only needed when target_type is 
QEMU.")
 
 @staticmethod
-def getTarget(target_type, target_ip, server_ip, **kwargs):
+def getTarget(target_type, logger, target_ip, server_ip, **kwargs):
 target = None
 
 if target_type == 'simpleremote':
-target = OESSHTarget(target_ip, server_ip, kwargs)
+target = OESSHTarget(logger, target_ip, server_ip, **kwargs)
 elif target_type == 'qemu':
-target = OEQemuTarget(target_ip, server_ip, kwargs)
+target = OEQemuTarget(logger, target_ip, server_ip, **kwargs)
 else:
 # TODO: Implement custom target module loading
 raise TypeError("target_type %s isn't supported" % target_type)
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 44/55] oeqa/runtime/context.py: Prepare for qemu

2017-01-20 Thread Aníbal Limón
This commit will prepare context to use qemu and not just
simpleremote.

Signed-off-by: Aníbal Limón 
---
 meta/lib/oeqa/runtime/context.py | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/meta/lib/oeqa/runtime/context.py b/meta/lib/oeqa/runtime/context.py
index ab7caa6..f0f6e62 100644
--- a/meta/lib/oeqa/runtime/context.py
+++ b/meta/lib/oeqa/runtime/context.py
@@ -5,6 +5,7 @@ import os
 
 from oeqa.core.context import OETestContext, OETestContextExecutor
 from oeqa.core.target.ssh import OESSHTarget
+from oeqa.core.target.qemu import OEQemuTarget
 from oeqa.utils.dump import HostDumper
 
 from oeqa.runtime.loader import OERuntimeTestLoader
@@ -16,6 +17,7 @@ class OERuntimeTestContext(OETestContext):
 
 def __init__(self, td, logger, target, host_dumper, image_packages):
 super(OERuntimeTestContext, self).__init__(td, logger)
+
 self.target = target
 self.image_packages = image_packages
 self.host_dumper = host_dumper
@@ -70,17 +72,19 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
 runtime_group.add_argument('--packages-manifest', action='store',
 help="Package manifest of the image under test")
 
+runtime_group.add_argument('--qemu-boot', action='store',
+help="Qemu boot configuration, only needed when target_type is 
QEMU.")
 
 @staticmethod
-def getTarget(target_type, target_ip, server_ip):
+def getTarget(target_type, target_ip, server_ip, **kwargs):
 target = None
 
 if target_type == 'simpleremote':
-target = OESSHTarget(target_ip)
+target = OESSHTarget(target_ip, server_ip, kwargs)
 elif target_type == 'qemu':
-raise NotImplementedError("target_type %s isn't implemented yet" % 
\
-target_type)
+target = OEQemuTarget(target_ip, server_ip, kwargs)
 else:
+# TODO: Implement custom target module loading
 raise TypeError("target_type %s isn't supported" % target_type)
 
 return target
@@ -109,8 +113,12 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
 
 super(OERuntimeTestContextExecutor, self)._process_args(logger, args)
 
+target_kwargs = {}
+target_kwargs['qemuboot'] = args.qemu_boot
+
 self.tc_kwargs['init']['target'] = \
-OERuntimeTestContextExecutor.getTarget(args.target_type)
+OERuntimeTestContextExecutor.getTarget(args.target_type,
+args.target_ip, args.server_ip, **target_kwargs)
 self.tc_kwargs['init']['host_dumper'] = \
 OERuntimeTestContextExecutor.getHostDumper(None,
 args.host_dumper_dir)
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 42/55] oeqa/runtime/context: Move helper functions for process args to executor

2017-01-20 Thread Aníbal Limón
Signed-off-by: Aníbal Limón 
---
 meta/lib/oeqa/runtime/context.py | 56 ++--
 1 file changed, 36 insertions(+), 20 deletions(-)

diff --git a/meta/lib/oeqa/runtime/context.py b/meta/lib/oeqa/runtime/context.py
index e692bc0..ec378bb 100644
--- a/meta/lib/oeqa/runtime/context.py
+++ b/meta/lib/oeqa/runtime/context.py
@@ -12,10 +12,10 @@ class OERuntimeTestContext(OETestContext):
 runtime_files_dir = os.path.join(
 os.path.dirname(os.path.abspath(__file__)), "files")
 
-def __init__(self, td, logger, target, packages_manifest):
+def __init__(self, td, logger, target, image_packages):
 super(OERuntimeTestContext, self).__init__(td, logger)
 self.target = target
-self.image_packages = self.readPackagesManifest(packages_manifest)
+self.image_packages = image_packages
 self._set_target_cmds()
 
 def _set_target_cmds(self):
@@ -25,19 +25,6 @@ class OERuntimeTestContext(OETestContext):
 if 'procps' in self.image_packages:
 self.target_cmds['ps'] = self.target_cmds['ps'] + ' -ef'
 
-def readPackagesManifest(self, manifest):
-if not os.path.exists(manifest):
-raise OSError("Couldn't find manifest file: %s" % manifest)
-
-image_packages = set()
-with open(manifest, 'r') as f:
-for line in f.readlines():
-line = line.strip()
-if line and not line.startswith("#"):
-image_packages.add(line.split()[0])
-
-return image_packages
-
 class OERuntimeTestContextExecutor(OETestContextExecutor):
 _context_class = OERuntimeTestContext
 
@@ -74,16 +61,45 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
 runtime_group.add_argument('--packages-manifest', action='store',
 help="Package manifest of the image under test")
 
+
+@staticmethod
+def getTarget(target_type, target_ip, server_ip):
+target = None
+
+if target_type == 'simpleremote':
+target = OESSHTarget(target_ip)
+elif target_type == 'qemu':
+raise NotImplementedError("target_type %s isn't implemented yet" % 
\
+target_type)
+else:
+raise TypeError("target_type %s isn't supported" % target_type)
+
+return target
+
+@staticmethod
+def readPackagesManifest(manifest):
+if not os.path.exists(manifest):
+raise OSError("Manifest file not exists: %s" % manifest)
+
+image_packages = set()
+with open(manifest, 'r') as f:
+for line in f.readlines():
+line = line.strip()
+if line and not line.startswith("#"):
+image_packages.add(line.split()[0])
+
+return image_packages
+
 def _process_args(self, logger, args):
 if not args.packages_manifest:
 raise TypeError('Manifest file not provided')
 
 super(OERuntimeTestContextExecutor, self)._process_args(logger, args)
-target = OESSHTarget(args.target_ip)
-
-self.tc_kwargs['init']['target'] = target
 
-packages_manifest = os.path.join(os.getcwd(), args.packages_manifest)
-self.tc_kwargs['init']['packages_manifest'] = packages_manifest
+self.tc_kwargs['init']['target'] = \
+OERuntimeTestContextExecutor.getTarget(args.target_type)
+self.tc_kwargs['init']['image_packages'] = \
+OERuntimeTestContextExecutor.readPackagesManifest(
+args.packages_manifest)
 
 _executor_class = OERuntimeTestContextExecutor
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 43/55] oeqa/utils/dump: Move get_host_dumper to OERuntimeTestContextExecutor class

2017-01-20 Thread Aníbal Limón
To avoid getVar calls inside a utils module, also moves
get_host_dumper import inside testexport isn't needed.

[YOCTO #10231]

Signed-off-by: Aníbal Limón 
---
 meta/classes/testexport.bbclass  |  1 -
 meta/classes/testimage.bbclass   |  5 +++--
 meta/lib/oeqa/runtime/context.py | 18 +-
 meta/lib/oeqa/utils/dump.py  | 11 ++-
 4 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/meta/classes/testexport.bbclass b/meta/classes/testexport.bbclass
index 00cf24e..5398b3c 100644
--- a/meta/classes/testexport.bbclass
+++ b/meta/classes/testexport.bbclass
@@ -163,7 +163,6 @@ def exportTests(d,tc):
 def testexport_main(d):
 from oeqa.oetest import ExportTestContext
 from oeqa.targetcontrol import get_target_controller
-from oeqa.utils.dump import get_host_dumper
 
 test_create_extract_dirs(d)
 export_dir = d.getVar("TEST_EXPORT_DIR")
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index 6fed408..62ecaef 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -128,8 +128,8 @@ def testimage_main(d):
 import signal
 from oeqa.oetest import ImageTestContext
 from oeqa.targetcontrol import get_target_controller
-from oeqa.utils.dump import get_host_dumper
 from bb.utils import export_proxies
+from oeqa.utils.dump import HostDumper
 
 pn = d.getVar("PN")
 bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR"))
@@ -139,7 +139,8 @@ def testimage_main(d):
 export_proxies(d)
 
 # we need the host dumper in test context
-host_dumper = get_host_dumper(d)
+host_dumper = HostDumper(d.getVar("testimage_dump_host", True),
+d.getVar("TESTIMAGE_DUMP_DIR", True))
 
 # the robot dance
 target = get_target_controller(d)
diff --git a/meta/lib/oeqa/runtime/context.py b/meta/lib/oeqa/runtime/context.py
index ec378bb..ab7caa6 100644
--- a/meta/lib/oeqa/runtime/context.py
+++ b/meta/lib/oeqa/runtime/context.py
@@ -5,6 +5,8 @@ import os
 
 from oeqa.core.context import OETestContext, OETestContextExecutor
 from oeqa.core.target.ssh import OESSHTarget
+from oeqa.utils.dump import HostDumper
+
 from oeqa.runtime.loader import OERuntimeTestLoader
 
 class OERuntimeTestContext(OETestContext):
@@ -12,10 +14,11 @@ class OERuntimeTestContext(OETestContext):
 runtime_files_dir = os.path.join(
 os.path.dirname(os.path.abspath(__file__)), "files")
 
-def __init__(self, td, logger, target, image_packages):
+def __init__(self, td, logger, target, host_dumper, image_packages):
 super(OERuntimeTestContext, self).__init__(td, logger)
 self.target = target
 self.image_packages = image_packages
+self.host_dumper = host_dumper
 self._set_target_cmds()
 
 def _set_target_cmds(self):
@@ -39,6 +42,7 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
 default_target_type = 'simpleremote'
 default_server_ip = '192.168.7.1'
 default_target_ip = '192.168.7.2'
+default_host_dumper_dir = '/tmp/oe-saved-tests'
 
 def register_commands(self, logger, subparsers):
 super(OERuntimeTestContextExecutor, self).register_commands(logger, 
subparsers)
@@ -58,6 +62,11 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
 help="IP address of device under test, default: %s" \
 % self.default_server_ip)
 
+runtime_group.add_argument('--host-dumper-dir', action='store',
+default=self.default_host_dumper_dir,
+help="Directory where host status is dumped, if tests fails, 
default: %s" \
+% self.default_host_dumper_dir)
+
 runtime_group.add_argument('--packages-manifest', action='store',
 help="Package manifest of the image under test")
 
@@ -90,6 +99,10 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
 
 return image_packages
 
+@staticmethod
+def getHostDumper(cmds, directory):
+return HostDumper(cmds, directory)
+
 def _process_args(self, logger, args):
 if not args.packages_manifest:
 raise TypeError('Manifest file not provided')
@@ -98,6 +111,9 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
 
 self.tc_kwargs['init']['target'] = \
 OERuntimeTestContextExecutor.getTarget(args.target_type)
+self.tc_kwargs['init']['host_dumper'] = \
+OERuntimeTestContextExecutor.getHostDumper(None,
+args.host_dumper_dir)
 self.tc_kwargs['init']['image_packages'] = \
 OERuntimeTestContextExecutor.readPackagesManifest(
 args.packages_manifest)
diff --git a/meta/lib/oeqa/utils/dump.py b/meta/lib/oeqa/utils/dump.py
index 44037a9..5a7edc1 100644
--- a/meta/lib/oeqa/utils/dump.py
+++ b/meta/lib/oeqa/utils/dump.py
@@ -5,12 +5,6 @@ import datetime
 import itertools
 from .commands 

[OE-core] [PATCH 37/55] oeqa/runtime/files: Move runtime files from old directory

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

As part of the refactor we require to move the files used
in runtime testing to the new directory. This also adds
the path to the runtime test context.

[YOCTO #10234]

Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/runtime/context.py | 2 ++
 meta/lib/oeqa/{runtime_cases => runtime}/files/hellomod.c| 0
 meta/lib/oeqa/{runtime_cases => runtime}/files/hellomod_makefile | 0
 meta/lib/oeqa/{runtime_cases => runtime}/files/testmakefile  | 0
 4 files changed, 2 insertions(+)
 rename meta/lib/oeqa/{runtime_cases => runtime}/files/hellomod.c (100%)
 rename meta/lib/oeqa/{runtime_cases => runtime}/files/hellomod_makefile (100%)
 rename meta/lib/oeqa/{runtime_cases => runtime}/files/testmakefile (100%)

diff --git a/meta/lib/oeqa/runtime/context.py b/meta/lib/oeqa/runtime/context.py
index 496730d..10a8872 100644
--- a/meta/lib/oeqa/runtime/context.py
+++ b/meta/lib/oeqa/runtime/context.py
@@ -9,6 +9,8 @@ from oeqa.runtime.loader import OERuntimeTestLoader
 
 class OERuntimeTestContext(OETestContext):
 loaderClass = OERuntimeTestLoader
+runtime_files_dir = os.path.join(
+os.path.dirname(os.path.abspath(__file__)), "files")
 
 def __init__(self, td, logger, target, packages_manifest):
 super(OERuntimeTestContext, self).__init__(td, logger)
diff --git a/meta/lib/oeqa/runtime_cases/files/hellomod.c 
b/meta/lib/oeqa/runtime/files/hellomod.c
similarity index 100%
rename from meta/lib/oeqa/runtime_cases/files/hellomod.c
rename to meta/lib/oeqa/runtime/files/hellomod.c
diff --git a/meta/lib/oeqa/runtime_cases/files/hellomod_makefile 
b/meta/lib/oeqa/runtime/files/hellomod_makefile
similarity index 100%
rename from meta/lib/oeqa/runtime_cases/files/hellomod_makefile
rename to meta/lib/oeqa/runtime/files/hellomod_makefile
diff --git a/meta/lib/oeqa/runtime_cases/files/testmakefile 
b/meta/lib/oeqa/runtime/files/testmakefile
similarity index 100%
rename from meta/lib/oeqa/runtime_cases/files/testmakefile
rename to meta/lib/oeqa/runtime/files/testmakefile
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 39/55] oeqa/core/decorator: Add skipIfNotDataVar and skipIfNotInDataVar

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

skipIfNotDataVar will skip a test if a variable doesn't have certain value.

skipIfNotInDataVar will skip a test if a value is not in a certain variable.

Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/core/decorator/data.py | 36 +++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/core/decorator/data.py 
b/meta/lib/oeqa/core/decorator/data.py
index fdeba9f..ff7bdd9 100644
--- a/meta/lib/oeqa/core/decorator/data.py
+++ b/meta/lib/oeqa/core/decorator/data.py
@@ -28,12 +28,46 @@ class skipIfDataVar(OETestDecorator):
 attrs = ('var', 'value', 'msg')
 
 def setUpDecorator(self):
-msg = 'Checking if %r value is %r to skip test' % (self.var, 
self.value)
+msg = ('Checking if %r value is %r to skip test' %
+   (self.var, self.value))
 self.logger.debug(msg)
 if self.case.td.get(self.var) == self.value:
 self.case.skipTest(self.msg)
 
 @registerDecorator
+class skipIfNotDataVar(OETestDecorator):
+"""
+Skip test based on value of a data store's variable.
+
+It will get the info of var from the data store and will
+check it against value; if are not equal it will skip the
+test with msg as the reason.
+"""
+
+attrs = ('var', 'value', 'msg')
+
+def setUpDecorator(self):
+msg = ('Checking if %r value is not %r to skip test' %
+   (self.var, self.value))
+self.logger.debug(msg)
+if not self.case.td.get(self.var) == self.value:
+self.case.skipTest(self.msg)
+
+@registerDecorator
+class skipIfNotInDataVar(OETestDecorator):
+"""
+Skip test if value is not in data store's variable.
+"""
+
+attrs = ('var', 'value', 'msg')
+def setUpDecorator(self):
+msg = ('Checking if %r value is in %r to run '
+  'the test' % (self.var, self.value))
+self.logger.debug(msg)
+if not self.value in self.case.td.get(self.var):
+self.case.skipTest(self.msg)
+
+@registerDecorator
 class OETestDataDepends(OETestDecorator):
 attrs = ('td_depends',)
 
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 38/55] oeqa/runtime/utils/targetbuildproject.py: Don't use more than 80 characters per line

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/runtime/utils/targetbuildproject.py | 29 +--
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/meta/lib/oeqa/runtime/utils/targetbuildproject.py 
b/meta/lib/oeqa/runtime/utils/targetbuildproject.py
index 006d4d4..1ed5789 100644
--- a/meta/lib/oeqa/runtime/utils/targetbuildproject.py
+++ b/meta/lib/oeqa/runtime/utils/targetbuildproject.py
@@ -14,20 +14,23 @@ class TargetBuildProject(BuildProject):
 def download_archive(self):
 self._download_archive()
 
-(status, output) = self.target.copy_to(self.localarchive, 
self.targetdir)
-if status != 0:
-raise Exception("Failed to copy archive to target, output: %s" % 
output)
-
-(status, output) = self.target.run('tar xf %s%s -C %s' % 
(self.targetdir, self.archive, self.targetdir))
-if status != 0:
-raise Exception("Failed to extract archive, output: %s" % output)
-
-#Change targetdir to project folder
+status, output = self.target.copyTo(self.localarchive, self.targetdir)
+if status:
+raise Exception('Failed to copy archive to target, '
+'output: %s' % output)
+
+cmd = 'tar xf %s%s -C %s' % (self.targetdir,
+ self.archive,
+ self.targetdir)
+status, output = self.target.run(cmd)
+if status:
+raise Exception('Failed to extract archive, '
+'output: %s' % output)
+
+# Change targetdir to project folder
 self.targetdir = self.targetdir + self.fname
 
-# The timeout parameter of target.run is set to 0 to make the ssh command
-# run with no timeout.
+# The timeout parameter of target.run is set to 0
+# to make the ssh command run with no timeout.
 def _run(self, cmd):
 return self.target.run(cmd, 0)[0]
-
-
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 40/55] oeqa/core/context: Add option to select tests to run

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

This add the option to select what tests to run in the
[.[.]] format.

Currently it just support modules

Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/core/context.py | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/meta/lib/oeqa/core/context.py b/meta/lib/oeqa/core/context.py
index ba6ccf8..efed4e6 100644
--- a/meta/lib/oeqa/core/context.py
+++ b/meta/lib/oeqa/core/context.py
@@ -157,6 +157,7 @@ class OETestContextExecutor(object):
 default_cases = [os.path.join(os.path.abspath(os.path.dirname(__file__)),
 'cases/example')]
 default_test_data = os.path.join(default_cases[0], 'data.json')
+default_tests = None
 
 def register_commands(self, logger, subparsers):
 self.parser = subparsers.add_parser(self.name, help=self.help,
@@ -167,6 +168,9 @@ class OETestContextExecutor(object):
 self.parser.add_argument('--output-log', action='store',
 default=self.default_output_log,
 help="results output log, default: %s" % 
self.default_output_log)
+self.parser.add_argument('--run-tests', action='store',
+default=self.default_tests,
+help="tests to run in [.[.]] format. Just 
works for modules now")
 
 if self.default_test_data:
 self.parser.add_argument('--test-data-file', action='store',
@@ -211,6 +215,8 @@ class OETestContextExecutor(object):
 else:
 self.tc_kwargs['init']['td'] = {}
 
+self.tc_kwargs['load']['modules'] = args.run_tests.split()
+
 self.module_paths = args.CASES_PATHS
 
 def run(self, logger, args):
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 35/55] oeqa/runtime: Add OEHasPackage decorator

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

This new decorator will be used to skip the test
if the image under test doesn't have the required
packages installed.

[YOCTO #10234]

Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/runtime/decorator/package.py | 53 ++
 1 file changed, 53 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/decorator/package.py

diff --git a/meta/lib/oeqa/runtime/decorator/package.py 
b/meta/lib/oeqa/runtime/decorator/package.py
new file mode 100644
index 000..aa6ecb6
--- /dev/null
+++ b/meta/lib/oeqa/runtime/decorator/package.py
@@ -0,0 +1,53 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+from oeqa.core.decorator import OETestDecorator, registerDecorator
+from oeqa.core.utils.misc import strToSet
+
+@registerDecorator
+class OEHasPackage(OETestDecorator):
+"""
+Checks if image has packages (un)installed.
+
+The argument must be a string, set, or list of packages that must be
+installed or not present in the image.
+
+The way to tell a package must not be in an image is using an
+exclamation point ('!') before the name of the package.
+
+If test depends on pkg1 or pkg2 you need to use:
+@OEHasPackage({'pkg1', 'pkg2'})
+
+If test depends on pkg1 and pkg2 you need to use:
+@OEHasPackage('pkg1')
+@OEHasPackage('pkg2')
+
+If test depends on pkg1 but pkg2 must not be present use:
+@OEHasPackage({'pkg1', '!pkg2'})
+"""
+
+attrs = ('need_pkgs',)
+
+def setUpDecorator(self):
+need_pkgs = set()
+unneed_pkgs = set()
+pkgs = strToSet(self.need_pkgs)
+for pkg in pkgs:
+if pkg.startswith('!'):
+unneed_pkgs.add(pkg[1:])
+else:
+need_pkgs.add(pkg)
+
+if unneed_pkgs:
+msg = 'Checking if %s is not installed' % ', '.join(unneed_pkgs)
+self.logger.debug(msg)
+if not self.case.tc.image_packages.isdisjoint(unneed_pkgs):
+msg = "Test can't run with %s installed" % ', 
or'.join(unneed_pkgs)
+self.case.skipTest(msg)
+
+if need_pkgs:
+msg = 'Checking if at least one of %s is installed' % ', 
'.join(need_pkgs)
+self.logger.debug(msg)
+if self.case.tc.image_packages.isdisjoint(need_pkgs):
+msg = "Test requires %s to be installed" % ', 
or'.join(need_pkgs)
+self.case.skipTest(msg)
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 36/55] oeqa/core/decorator/data.py: Add skipIfNotFeature decorator

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

This adds a new decorator to check if image under tests has
certain DISTRO_FEATURE or IMAGE_FEATURE.

[YOCTO #10234]

Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/core/decorator/data.py | 28 
 1 file changed, 28 insertions(+)

diff --git a/meta/lib/oeqa/core/decorator/data.py 
b/meta/lib/oeqa/core/decorator/data.py
index 73cca88..fdeba9f 100644
--- a/meta/lib/oeqa/core/decorator/data.py
+++ b/meta/lib/oeqa/core/decorator/data.py
@@ -5,6 +5,16 @@ from oeqa.core.exception import OEQAMissingVariable
 
 from . import OETestDecorator, registerDecorator
 
+def has_feature(td, feature):
+"""
+Checks for feature in DISTRO_FEATURES or IMAGE_FEATURES.
+"""
+
+if (feature in td.get('DISTRO_FEATURES', '') or
+feature in td.get('IMAGE_FEATURES', '')):
+return True
+return False
+
 @registerDecorator
 class skipIfDataVar(OETestDecorator):
 """
@@ -34,3 +44,21 @@ class OETestDataDepends(OETestDecorator):
 except KeyError:
 raise OEQAMissingVariable("Test case need %s variable but"\
 " isn't into td" % v)
+
+@registerDecorator
+class skipIfNotFeature(OETestDecorator):
+"""
+Skip test based on DISTRO_FEATURES.
+
+value must be in distro features or it will skip the test
+with msg as the reason.
+"""
+
+attrs = ('value', 'msg')
+
+def setUpDecorator(self):
+msg = ('Checking if %s is in DISTRO_FEATURES '
+   'or IMAGE_FEATURES' % (self.value))
+self.logger.debug(msg)
+if not has_feature(self.case.td, self.value):
+self.case.skipTest(self.msg)
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 33/55] oeqa/core/target Add OESSHTarget to sent commands to targets using SSH

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

With this commit now it is possible to add targets with SSH for testing.
Most of it was imported for existing code, with improvements in log
handling.

[YOCTO #10234]

Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/core/target/__init__.py |  33 +
 meta/lib/oeqa/core/target/ssh.py  | 266 ++
 2 files changed, 299 insertions(+)
 create mode 100644 meta/lib/oeqa/core/target/__init__.py
 create mode 100644 meta/lib/oeqa/core/target/ssh.py

diff --git a/meta/lib/oeqa/core/target/__init__.py 
b/meta/lib/oeqa/core/target/__init__.py
new file mode 100644
index 000..d2468bc
--- /dev/null
+++ b/meta/lib/oeqa/core/target/__init__.py
@@ -0,0 +1,33 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+from abc import abstractmethod
+
+class OETarget(object):
+
+def __init__(self, logger, *args, **kwargs):
+self.logger = logger
+
+@abstractmethod
+def start(self):
+pass
+
+@abstractmethod
+def stop(self):
+pass
+
+@abstractmethod
+def run(self, cmd, timeout=None):
+pass
+
+@abstractmethod
+def copyTo(self, localSrc, remoteDst):
+pass
+
+@abstractmethod
+def copyFrom(self, remoteSrc, localDst):
+pass
+
+@abstractmethod
+def copyDirTo(self, localSrc, remoteDst):
+pass
diff --git a/meta/lib/oeqa/core/target/ssh.py b/meta/lib/oeqa/core/target/ssh.py
new file mode 100644
index 000..b80939c
--- /dev/null
+++ b/meta/lib/oeqa/core/target/ssh.py
@@ -0,0 +1,266 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+import os
+import time
+import select
+import logging
+import subprocess
+
+from . import OETarget
+
+class OESSHTarget(OETarget):
+def __init__(self, logger, ip, server_ip, timeout=300, user='root',
+ port=None, **kwargs):
+if not logger:
+logger = logging.getLogger('target')
+logger.setLevel(logging.INFO)
+filePath = os.path.join(os.getcwd(), 'remoteTarget.log')
+fileHandler = logging.FileHandler(filePath, 'w', 'utf-8')
+formatter = logging.Formatter(
+'%(asctime)s.%(msecs)03d %(levelname)s: %(message)s',
+'%H:%M:%S')
+fileHandler.setFormatter(formatter)
+logger.addHandler(fileHandler)
+
+super(OESSHTarget, self).__init__(logger)
+self.ip = ip
+self.server_ip = server_ip
+self.timeout = timeout
+self.user = user
+ssh_options = [
+'-o', 'UserKnownHostsFile=/dev/null',
+'-o', 'StrictHostKeyChecking=no',
+'-o', 'LogLevel=ERROR'
+]
+self.ssh = ['ssh', '-l', self.user ] + ssh_options
+self.scp = ['scp'] + ssh_options
+if port:
+self.ssh = self.ssh + [ '-p', port ]
+self.scp = self.scp + [ '-P', port ]
+
+def start(self, **kwargs):
+pass
+
+def stop(self, **kwargs):
+pass
+
+def _run(self, command, timeout=None, ignore_status=True):
+"""
+Runs command in target using SSHProcess.
+"""
+self.logger.debug("[Running]$ %s" % " ".join(command))
+
+starttime = time.time()
+status, output = SSHCall(command, self.logger, timeout)
+self.logger.debug("[Command returned '%d' after %.2f seconds]"
+ "" % (status, time.time() - starttime))
+
+if status and not ignore_status:
+raise AssertionError("Command '%s' returned non-zero exit "
+ "status %d:\n%s" % (command, status, output))
+
+return (status, output)
+
+def run(self, command, timeout=None):
+"""
+Runs command in target.
+
+command:Command to run on target.
+timeout::Kill command after  seconds.
+None:   Kill command default value seconds.
+0:  No timeout, runs until return.
+"""
+targetCmd = 'export PATH=/usr/sbin:/sbin:/usr/bin:/bin; %s' % command
+sshCmd = self.ssh + [self.ip, targetCmd]
+
+if timeout:
+processTimeout = timeout
+elif timeout==0:
+processTimeout = None
+else:
+processTimeout = self.timeout
+
+status, output = self._run(sshCmd, processTimeout, True)
+self.logger.info('\nCommand: %s\nOutput:  %s\n' % (command, output))
+return (status, output)
+
+def copyTo(self, localSrc, remoteDst):
+"""
+Copy file to target.
+
+If local file is symlink, recreate symlink in target.
+"""
+if os.path.islink(localSrc):
+link = os.readlink(localSrc)
+dstDir, dstBase = 

[OE-core] [PATCH 34/55] oeqa/runtime: Add case, context and loader classes for runtime testing

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

This adds OERuntimeTestCase, OERuntimeTestContext, and OERuntimeTestLoader
to be used for runtime testing.

As expected there are some changes in runtime context:

- Adds the target to be used for runtime testing, the default
is a SSH connection to the device under test running a OE image.
- Runtime context requires image manifest because several
tests are skipped if a package is missing or installed.
- Several tests require the output of the ps command and it changes
its output and arguments if busybox o procps is installed, so the
case must use the correct ps command.

[YOCTO #10234]

Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/runtime/case.py|  8 +
 meta/lib/oeqa/runtime/context.py | 69 
 meta/lib/oeqa/runtime/loader.py  | 16 ++
 3 files changed, 93 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/case.py
 create mode 100644 meta/lib/oeqa/runtime/context.py
 create mode 100644 meta/lib/oeqa/runtime/loader.py

diff --git a/meta/lib/oeqa/runtime/case.py b/meta/lib/oeqa/runtime/case.py
new file mode 100644
index 000..43f1b2f
--- /dev/null
+++ b/meta/lib/oeqa/runtime/case.py
@@ -0,0 +1,8 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+from oeqa.core.case import OETestCase
+
+class OERuntimeTestCase(OETestCase):
+# target instance set by OERuntimeTestLoader.
+target = None
diff --git a/meta/lib/oeqa/runtime/context.py b/meta/lib/oeqa/runtime/context.py
new file mode 100644
index 000..496730d
--- /dev/null
+++ b/meta/lib/oeqa/runtime/context.py
@@ -0,0 +1,69 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+import os
+
+from oeqa.core.context import OETestContext, OETestContextExecutor
+from oeqa.core.target.ssh import OESSHTarget
+from oeqa.runtime.loader import OERuntimeTestLoader
+
+class OERuntimeTestContext(OETestContext):
+loaderClass = OERuntimeTestLoader
+
+def __init__(self, td, logger, target, packages_manifest):
+super(OERuntimeTestContext, self).__init__(td, logger)
+self.target = target
+self.image_packages = self.readPackagesManifest(packages_manifest)
+self._set_target_cmds()
+
+def _set_target_cmds(self):
+self.target_cmds = {}
+
+self.target_cmds['ps'] = 'ps'
+if 'procps' in self.image_packages:
+self.target_cmds['ps'] = self.target_cmds['ps'] + ' -ef'
+
+def readPackagesManifest(self, manifest):
+if not os.path.exists(manifest):
+raise OSError("Couldn't find manifest file: %s" % manifest)
+
+image_packages = set()
+with open(manifest, 'r') as f:
+for line in f.readlines():
+line = line.strip()
+if line and not line.startswith("#"):
+image_packages.add(line.split()[0])
+
+return image_packages
+
+class OERuntimeTestContextExecutor(OETestContextExecutor):
+_context_class = OERuntimeTestContext
+
+name = 'runtime'
+help = 'runtime test component'
+description = 'executes runtime tests over targets'
+default_cases = os.path.join(os.path.abspath(os.path.dirname(__file__)),
+'cases')
+default_target_ip = '192.168.7.2'
+
+def register_commands(self, logger, subparsers):
+super(OERuntimeTestContextExecutor, self).register_commands(logger, 
subparsers)
+self.parser.add_argument('--target-ip', action='store',
+default=self.default_target_ip,
+help="IP address of device under test, default: %s" \
+% self.default_target_ip)
+self.parser.add_argument('--packages-manifest', action='store',
+help="Package manifest of the image under test")
+
+def _process_args(self, logger, args):
+if not args.packages_manifest:
+raise TypeError('Manifest file not provided')
+
+super(OERuntimeTestContextExecutor, self)._process_args(logger, args)
+target = OESSHTarget(args.target_ip)
+self.tc_kwargs['init']['target'] = target
+
+packages_manifest = os.path.join(os.getcwd(), args.packages_manifest)
+self.tc_kwargs['init']['packages_manifest'] = packages_manifest
+
+_executor_class = OERuntimeTestContextExecutor
diff --git a/meta/lib/oeqa/runtime/loader.py b/meta/lib/oeqa/runtime/loader.py
new file mode 100644
index 000..041ef97
--- /dev/null
+++ b/meta/lib/oeqa/runtime/loader.py
@@ -0,0 +1,16 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+from oeqa.core.loader import OETestLoader
+from oeqa.runtime.case import OERuntimeTestCase
+
+class OERuntimeTestLoader(OETestLoader):
+caseClass = OERuntimeTestCase
+
+def _getTestCase(self, testCaseClass, tcName):
+case = super(OERuntimeTestLoader, 

[OE-core] [PATCH 30/55] oeqa/runtime: Fix TargetBuildProject instances

2017-01-20 Thread Aníbal Limón
TargetBuildProject was refactored to avoid bitbake dependency so
the instance don't allow to pass data store anymore.

classes/testimage: Export proxies before run tests

The TargetBuildProject based tests download archives from network.

Signed-off-by: Aníbal Limón 
---
 meta/classes/testimage.bbclass   | 4 
 meta/lib/oeqa/runtime/buildcvs.py| 9 +
 meta/lib/oeqa/runtime/buildgalculator.py | 8 +---
 meta/lib/oeqa/runtime/buildiptables.py   | 8 +---
 4 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index 7eb4038..6fed408 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -129,11 +129,15 @@ def testimage_main(d):
 from oeqa.oetest import ImageTestContext
 from oeqa.targetcontrol import get_target_controller
 from oeqa.utils.dump import get_host_dumper
+from bb.utils import export_proxies
 
 pn = d.getVar("PN")
 bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR"))
 test_create_extract_dirs(d)
 
+# runtime use network for download projects for build
+export_proxies(d)
+
 # we need the host dumper in test context
 host_dumper = get_host_dumper(d)
 
diff --git a/meta/lib/oeqa/runtime/buildcvs.py 
b/meta/lib/oeqa/runtime/buildcvs.py
index fe6cbfb..a5ca3a5 100644
--- a/meta/lib/oeqa/runtime/buildcvs.py
+++ b/meta/lib/oeqa/runtime/buildcvs.py
@@ -1,6 +1,6 @@
 from oeqa.oetest import oeRuntimeTest, skipModule
 from oeqa.utils.decorators import *
-from oeqa.utils.targetbuild import TargetBuildProject
+from oeqa.runtime.utils.targetbuildproject import TargetBuildProject
 
 def setUpModule():
 if not oeRuntimeTest.hasFeature("tools-sdk"):
@@ -10,9 +10,10 @@ class BuildCvsTest(oeRuntimeTest):
 
 @classmethod
 def setUpClass(self):
-self.project = TargetBuildProject(oeRuntimeTest.tc.target, 
oeRuntimeTest.tc.d,
-
"http://ftp.gnu.org/non-gnu/cvs/source/feature/1.12.13/cvs-1.12.13.tar.bz2;)
-self.project.download_archive()
+dl_dir = oeRuntimeTest.tc.d.getVar('DL_DIR', True)
+self.project = TargetBuildProject(oeRuntimeTest.tc.target,
+
"http://ftp.gnu.org/non-gnu/cvs/source/feature/1.12.13/cvs-1.12.13.tar.bz2;,
+dl_dir=dl_dir)
 
 @testcase(205)
 @skipUnlessPassed("test_ssh")
diff --git a/meta/lib/oeqa/runtime/buildgalculator.py 
b/meta/lib/oeqa/runtime/buildgalculator.py
index 220101d..20f0a79 100644
--- a/meta/lib/oeqa/runtime/buildgalculator.py
+++ b/meta/lib/oeqa/runtime/buildgalculator.py
@@ -1,6 +1,6 @@
 from oeqa.oetest import oeRuntimeTest, skipModule
 from oeqa.utils.decorators import *
-from oeqa.utils.targetbuild import TargetBuildProject
+from oeqa.runtime.utils.targetbuildproject import TargetBuildProject
 
 def setUpModule():
 if not oeRuntimeTest.hasFeature("tools-sdk"):
@@ -10,9 +10,11 @@ class GalculatorTest(oeRuntimeTest):
 @testcase(1526)
 @skipUnlessPassed("test_ssh")
 def test_galculator(self):
+dl_dir = oeRuntimeTest.tc.d.getVar('DL_DIR', True)
 try:
-project = TargetBuildProject(oeRuntimeTest.tc.target, 
oeRuntimeTest.tc.d,
-  
"http://galculator.mnim.org/downloads/galculator-2.1.4.tar.bz2;)
+project = TargetBuildProject(oeRuntimeTest.tc.target,
+  
"http://galculator.mnim.org/downloads/galculator-2.1.4.tar.bz2;,
+  dl_dir=dl_dir)
 project.download_archive()
 
 self.assertEqual(project.run_configure(), 0,
diff --git a/meta/lib/oeqa/runtime/buildiptables.py 
b/meta/lib/oeqa/runtime/buildiptables.py
index bc75d0a..a0e82f0 100644
--- a/meta/lib/oeqa/runtime/buildiptables.py
+++ b/meta/lib/oeqa/runtime/buildiptables.py
@@ -1,6 +1,6 @@
 from oeqa.oetest import oeRuntimeTest, skipModule
 from oeqa.utils.decorators import *
-from oeqa.utils.targetbuild import TargetBuildProject
+from oeqa.runtime.utils.targetbuildproject import TargetBuildProject
 
 def setUpModule():
 if not oeRuntimeTest.hasFeature("tools-sdk"):
@@ -10,8 +10,10 @@ class BuildIptablesTest(oeRuntimeTest):
 
 @classmethod
 def setUpClass(self):
-self.project = TargetBuildProject(oeRuntimeTest.tc.target, 
oeRuntimeTest.tc.d,
-
"http://downloads.yoctoproject.org/mirror/sources/iptables-1.4.13.tar.bz2;)
+dl_dir = oeRuntimeTest.tc.d.getVar('DL_DIR', True)
+self.project = TargetBuildProject(oeRuntimeTest.tc.target,
+
"http://downloads.yoctoproject.org/mirror/sources/iptables-1.4.13.tar.bz2;,
+dl_dir=dl_dir)
 self.project.download_archive()
 
 @testcase(206)
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org

[OE-core] [PATCH 31/55] oeqa: Fix files handling on runtime tests.

2017-01-20 Thread Aníbal Limón
Common files was move to oeqa/files from oeqa/runtime/files
because the same files are used across Runtime,SDK,eSDK tests.

Signed-off-by: Aníbal Limón 
---
 meta/classes/testexport.bbclass | 5 +
 meta/lib/oeqa/oetest.py | 1 +
 meta/lib/oeqa/runtime/gcc.py| 4 ++--
 meta/lib/oeqa/runtime/perl.py   | 2 +-
 meta/lib/oeqa/runtime/python.py | 2 +-
 5 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/meta/classes/testexport.bbclass b/meta/classes/testexport.bbclass
index e287f5a..00cf24e 100644
--- a/meta/classes/testexport.bbclass
+++ b/meta/classes/testexport.bbclass
@@ -87,6 +87,7 @@ def exportTests(d,tc):
 #   - the contents of oeqa/utils and oeqa/runtime/files
 #   - oeqa/oetest.py and oeqa/runexport.py (this will get copied to 
exportpath not exportpath/oeqa)
 #   - __init__.py files
+bb.utils.mkdirhier(os.path.join(exportpath, "oeqa/files"))
 bb.utils.mkdirhier(os.path.join(exportpath, "oeqa/runtime/files"))
 bb.utils.mkdirhier(os.path.join(exportpath, "oeqa/utils"))
 # copy test modules, this should cover tests in other layers too
@@ -124,6 +125,10 @@ def exportTests(d,tc):
 for f in files:
 if f.endswith(".py"):
 shutil.copy2(os.path.join(root, f), os.path.join(exportpath, 
"oeqa/utils"))
+# copy oeqa/files/*
+for root, dirs, files in os.walk(os.path.join(oeqadir, "files")):
+for f in files:
+shutil.copy2(os.path.join(root, f), os.path.join(exportpath, 
"oeqa/files"))
 # copy oeqa/runtime/files/*
 for root, dirs, files in os.walk(os.path.join(oeqadir, "runtime/files")):
 for f in files:
diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py
index 503f6fc..b886130 100644
--- a/meta/lib/oeqa/oetest.py
+++ b/meta/lib/oeqa/oetest.py
@@ -201,6 +201,7 @@ class TestContext(object):
 self.testsrequired = self._get_test_suites_required()
 
 self.filesdir = 
os.path.join(os.path.dirname(os.path.abspath(__file__)), "runtime/files")
+self.corefilesdir = 
os.path.join(os.path.dirname(os.path.abspath(__file__)), "files")
 self.imagefeatures = d.getVar("IMAGE_FEATURES").split()
 self.distrofeatures = d.getVar("DISTRO_FEATURES").split()
 
diff --git a/meta/lib/oeqa/runtime/gcc.py b/meta/lib/oeqa/runtime/gcc.py
index d90cd17..6edb89f 100644
--- a/meta/lib/oeqa/runtime/gcc.py
+++ b/meta/lib/oeqa/runtime/gcc.py
@@ -12,9 +12,9 @@ class GccCompileTest(oeRuntimeTest):
 
 @classmethod
 def setUpClass(self):
-
oeRuntimeTest.tc.target.copy_to(os.path.join(oeRuntimeTest.tc.filesdir, 
"test.c"), "/tmp/test.c")
+
oeRuntimeTest.tc.target.copy_to(os.path.join(oeRuntimeTest.tc.corefilesdir, 
"test.c"), "/tmp/test.c")
 
oeRuntimeTest.tc.target.copy_to(os.path.join(oeRuntimeTest.tc.filesdir, 
"testmakefile"), "/tmp/testmakefile")
-
oeRuntimeTest.tc.target.copy_to(os.path.join(oeRuntimeTest.tc.filesdir, 
"test.cpp"), "/tmp/test.cpp")
+
oeRuntimeTest.tc.target.copy_to(os.path.join(oeRuntimeTest.tc.corefilesdir, 
"test.cpp"), "/tmp/test.cpp")
 
 @testcase(203)
 def test_gcc_compile(self):
diff --git a/meta/lib/oeqa/runtime/perl.py b/meta/lib/oeqa/runtime/perl.py
index e044d0a..6bf98f1 100644
--- a/meta/lib/oeqa/runtime/perl.py
+++ b/meta/lib/oeqa/runtime/perl.py
@@ -12,7 +12,7 @@ class PerlTest(oeRuntimeTest):
 
 @classmethod
 def setUpClass(self):
-
oeRuntimeTest.tc.target.copy_to(os.path.join(oeRuntimeTest.tc.filesdir, 
"test.pl"), "/tmp/test.pl")
+
oeRuntimeTest.tc.target.copy_to(os.path.join(oeRuntimeTest.tc.corefilesdir, 
"test.pl"), "/tmp/test.pl")
 
 @testcase(1141)
 def test_perl_exists(self):
diff --git a/meta/lib/oeqa/runtime/python.py b/meta/lib/oeqa/runtime/python.py
index 29a231c..93e822c 100644
--- a/meta/lib/oeqa/runtime/python.py
+++ b/meta/lib/oeqa/runtime/python.py
@@ -12,7 +12,7 @@ class PythonTest(oeRuntimeTest):
 
 @classmethod
 def setUpClass(self):
-
oeRuntimeTest.tc.target.copy_to(os.path.join(oeRuntimeTest.tc.filesdir, 
"test.py"), "/tmp/test.py")
+
oeRuntimeTest.tc.target.copy_to(os.path.join(oeRuntimeTest.tc.corefilesdir, 
"test.py"), "/tmp/test.py")
 
 @testcase(1145)
 def test_python_exists(self):
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 32/55] oeqa/runtime: Move to runtime_cases

2017-01-20 Thread Aníbal Limón
The new oeqa core framework will modify the structure of the runtime
folder the new runtime folder will have python code inside to support
runtime test cases.

Signed-off-by: Aníbal Limón 
---
 meta/lib/oeqa/{runtime => runtime_cases}/_ptest.py   | 0
 meta/lib/oeqa/{runtime => runtime_cases}/_qemutiny.py| 0
 meta/lib/oeqa/{runtime => runtime_cases}/buildcvs.py | 0
 meta/lib/oeqa/{runtime => runtime_cases}/buildgalculator.py  | 0
 meta/lib/oeqa/{runtime => runtime_cases}/buildiptables.py| 0
 meta/lib/oeqa/{runtime => runtime_cases}/connman.py  | 0
 meta/lib/oeqa/{runtime => runtime_cases}/date.py | 0
 meta/lib/oeqa/{runtime => runtime_cases}/df.py   | 0
 meta/lib/oeqa/{runtime => runtime_cases}/files/hellomod.c| 0
 meta/lib/oeqa/{runtime => runtime_cases}/files/hellomod_makefile | 0
 meta/lib/oeqa/{runtime => runtime_cases}/files/testmakefile  | 0
 meta/lib/oeqa/{runtime => runtime_cases}/gcc.py  | 0
 meta/lib/oeqa/{runtime => runtime_cases}/kernelmodule.py | 0
 meta/lib/oeqa/{runtime => runtime_cases}/ldd.py  | 0
 meta/lib/oeqa/{runtime => runtime_cases}/logrotate.py| 0
 meta/lib/oeqa/{runtime => runtime_cases}/multilib.py | 0
 meta/lib/oeqa/{runtime => runtime_cases}/pam.py  | 0
 meta/lib/oeqa/{runtime => runtime_cases}/parselogs.py| 0
 meta/lib/oeqa/{runtime => runtime_cases}/perl.py | 0
 meta/lib/oeqa/{runtime => runtime_cases}/ping.py | 0
 meta/lib/oeqa/{runtime => runtime_cases}/python.py   | 0
 meta/lib/oeqa/{runtime => runtime_cases}/rpm.py  | 0
 meta/lib/oeqa/{runtime => runtime_cases}/scanelf.py  | 0
 meta/lib/oeqa/{runtime => runtime_cases}/scp.py  | 0
 meta/lib/oeqa/{runtime => runtime_cases}/skeletoninit.py | 0
 meta/lib/oeqa/{runtime => runtime_cases}/smart.py| 0
 meta/lib/oeqa/{runtime => runtime_cases}/ssh.py  | 0
 meta/lib/oeqa/{runtime => runtime_cases}/syslog.py   | 0
 meta/lib/oeqa/{runtime => runtime_cases}/systemd.py  | 0
 meta/lib/oeqa/{runtime => runtime_cases}/x32lib.py   | 0
 meta/lib/oeqa/{runtime => runtime_cases}/xorg.py | 0
 31 files changed, 0 insertions(+), 0 deletions(-)
 rename meta/lib/oeqa/{runtime => runtime_cases}/_ptest.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/_qemutiny.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/buildcvs.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/buildgalculator.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/buildiptables.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/connman.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/date.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/df.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/files/hellomod.c (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/files/hellomod_makefile (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/files/testmakefile (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/gcc.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/kernelmodule.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/ldd.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/logrotate.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/multilib.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/pam.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/parselogs.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/perl.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/ping.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/python.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/rpm.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/scanelf.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/scp.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/skeletoninit.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/smart.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/ssh.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/syslog.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/systemd.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/x32lib.py (100%)
 rename meta/lib/oeqa/{runtime => runtime_cases}/xorg.py (100%)

diff --git a/meta/lib/oeqa/runtime/_ptest.py 
b/meta/lib/oeqa/runtime_cases/_ptest.py
similarity index 100%
rename from meta/lib/oeqa/runtime/_ptest.py
rename to meta/lib/oeqa/runtime_cases/_ptest.py
diff --git a/meta/lib/oeqa/runtime/_qemutiny.py 
b/meta/lib/oeqa/runtime_cases/_qemutiny.py
similarity index 100%
rename from meta/lib/oeqa/runtime/_qemutiny.py
rename to meta/lib/oeqa/runtime_cases/_qemutiny.py
diff --git a/meta/lib/oeqa/runtime/buildcvs.py 

[OE-core] [PATCH 29/55] oeqa/sdkext/cases: Migrate test case to new OEQA framework

2017-01-20 Thread Aníbal Limón
Summary,

- Changes base case class to OESDKExtTest.
- Changes decorator classes to new ones.
- Chnages variable names sdktestdir -> sdk_dir.
- Added missing license to MIT.

Signed-off-by: Aníbal Limón 
---
 meta/lib/oeqa/sdk/cases/buildgalculator.py |  2 +-
 meta/lib/oeqa/sdk/cases/gcc.py |  3 +-
 meta/lib/oeqa/sdkext/cases/devtool.py  | 49 --
 meta/lib/oeqa/sdkext/cases/sdk_update.py   | 17 ++-
 4 files changed, 38 insertions(+), 33 deletions(-)

diff --git a/meta/lib/oeqa/sdk/cases/buildgalculator.py 
b/meta/lib/oeqa/sdk/cases/buildgalculator.py
index bdc8b6a..42e8ddb 100644
--- a/meta/lib/oeqa/sdk/cases/buildgalculator.py
+++ b/meta/lib/oeqa/sdk/cases/buildgalculator.py
@@ -10,7 +10,7 @@ class GalculatorTest(OESDKTestCase):
 def setUpClass(self):
 if not (self.tc.hasTargetPackage("gtk+3") or\
 self.tc.hasTargetPackage("libgtk-3.0")):
-raise unittest.SkipTest("%s class: SDK don't support gtk+3" % 
self.__name__)
+raise unittest.SkipTest("GalculatorTest class: SDK don't support 
gtk+3")
 
 def test_galculator(self):
 dl_dir = self.td.get('DL_DIR', None)
diff --git a/meta/lib/oeqa/sdk/cases/gcc.py b/meta/lib/oeqa/sdk/cases/gcc.py
index e06af4c..74ad2a2 100644
--- a/meta/lib/oeqa/sdk/cases/gcc.py
+++ b/meta/lib/oeqa/sdk/cases/gcc.py
@@ -19,8 +19,7 @@ class GccCompileTest(OESDKTestCase):
 def setUp(self):
 machine = self.td.get("MACHINE")
 if not self.tc.hasHostPackage("packagegroup-cross-canadian-%s" % 
machine):
-raise unittest.SkipTest("%s class: SDK doesn't contain a 
cross-canadian toolchain",
-self.__name__)
+raise unittest.SkipTest("GccCompileTest class: SDK doesn't contain 
a cross-canadian toolchain")
 
 def test_gcc_compile(self):
 self._run('$CC %s/test.c -o %s/test -lm' % (self.tc.sdk_dir, 
self.tc.sdk_dir))
diff --git a/meta/lib/oeqa/sdkext/cases/devtool.py 
b/meta/lib/oeqa/sdkext/cases/devtool.py
index 65f41f6..da0050c 100644
--- a/meta/lib/oeqa/sdkext/cases/devtool.py
+++ b/meta/lib/oeqa/sdkext/cases/devtool.py
@@ -1,18 +1,22 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
 import shutil
 import subprocess
-import urllib.request
-from oeqa.oetest import oeSDKExtTest
-from oeqa.utils.decorators import *
 
-class DevtoolTest(oeSDKExtTest):
+from oeqa.sdkext.case import OESDKExtTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.core.decorator.oeid import OETestID
+
+class DevtoolTest(OESDKExtTestCase):
 @classmethod
 def setUpClass(self):
-self.myapp_src = os.path.join(self.tc.sdkextfilesdir, "myapp")
-self.myapp_dst = os.path.join(self.tc.sdktestdir, "myapp")
+self.myapp_src = os.path.join(self.tc.esdk_files_dir, "myapp")
+self.myapp_dst = os.path.join(self.tc.sdk_dir, "myapp")
 shutil.copytree(self.myapp_src, self.myapp_dst)
 
-self.myapp_cmake_src = os.path.join(self.tc.sdkextfilesdir, 
"myapp_cmake")
-self.myapp_cmake_dst = os.path.join(self.tc.sdktestdir, "myapp_cmake")
+self.myapp_cmake_src = os.path.join(self.tc.esdk_files_dir, 
"myapp_cmake")
+self.myapp_cmake_dst = os.path.join(self.tc.sdk_dir, "myapp_cmake")
 shutil.copytree(self.myapp_cmake_src, self.myapp_cmake_dst)
 
 def _test_devtool_build(self, directory):
@@ -37,31 +41,31 @@ class DevtoolTest(oeSDKExtTest):
 
 def test_devtool_location(self):
 output = self._run('which devtool')
-self.assertEqual(output.startswith(self.tc.sdktestdir), True, \
+self.assertEqual(output.startswith(self.tc.sdk_dir), True, \
 msg="Seems that devtool isn't the eSDK one: %s" % output)
 
-@skipUnlessPassed('test_devtool_location')
+@OETestDepends(['test_devtool_location'])
 def test_devtool_add_reset(self):
 self._run('devtool add myapp %s' % self.myapp_dst)
 self._run('devtool reset myapp')
 
-@testcase(1473)
-@skipUnlessPassed('test_devtool_location')
+@OETestID(1473)
+@OETestDepends(['test_devtool_location'])
 def test_devtool_build_make(self):
 self._test_devtool_build(self.myapp_dst)
 
-@testcase(1474)
-@skipUnlessPassed('test_devtool_location')
+@OETestID(1474)
+@OETestDepends(['test_devtool_location'])
 def test_devtool_build_esdk_package(self):
 self._test_devtool_build_package(self.myapp_dst)
 
-@testcase(1479)
-@skipUnlessPassed('test_devtool_location')
+@OETestID(1479)
+@OETestDepends(['test_devtool_location'])
 def test_devtool_build_cmake(self):
 self._test_devtool_build(self.myapp_cmake_dst)
 
-@testcase(1482)
-@skipUnlessPassed('test_devtool_location')
+@OETestID(1482)
+@OETestDepends(['test_devtool_location'])
 def test_extend_autotools_recipe_creation(self):
 req 

[OE-core] [PATCH 28/55] classes/testsdk: Migrate to use the new OESDKExtTestContext

2017-01-20 Thread Aníbal Limón
Signed-off-by: Aníbal Limón 
---
 meta/classes/testsdk.bbclass | 98 
 1 file changed, 45 insertions(+), 53 deletions(-)

diff --git a/meta/classes/testsdk.bbclass b/meta/classes/testsdk.bbclass
index 176dafd..69689a1 100644
--- a/meta/classes/testsdk.bbclass
+++ b/meta/classes/testsdk.bbclass
@@ -16,37 +16,6 @@
 
 TESTSDKLOCK = "${TMPDIR}/testsdk.lock"
 
-def run_test_context(CTestContext, d, testdir, tcname, pn, *args):
-import glob
-import time
-
-targets = glob.glob(d.expand(testdir + "/tc/environment-setup-*"))
-for sdkenv in targets:
-bb.plain("Testing %s" % sdkenv)
-tc = CTestContext(d, testdir, sdkenv, tcname, args)
-
-# this is a dummy load of tests
-# we are doing that to find compile errors in the tests themselves
-# before booting the image
-try:
-tc.loadTests()
-except Exception as e:
-import traceback
-bb.fatal("Loading tests failed:\n%s" % traceback.format_exc())
-
-starttime = time.time()
-result = tc.runTests()
-stoptime = time.time()
-if result.wasSuccessful():
-bb.plain("%s SDK(%s):%s - Ran %d test%s in %.3fs" % (pn, 
os.path.basename(tcname), os.path.basename(sdkenv),result.testsRun, 
result.testsRun != 1 and "s" or "", stoptime - starttime))
-msg = "%s - OK - All required tests passed" % pn
-skipped = len(result.skipped)
-if skipped:
-msg += " (skipped=%d)" % skipped
-bb.plain(msg)
-else:
-bb.fatal("%s - FAILED - check the task log and the commands log" % 
pn)
-
 def testsdk_main(d):
 import os
 import subprocess
@@ -122,7 +91,6 @@ addtask testsdk
 do_testsdk[nostamp] = "1"
 do_testsdk[lockfiles] += "${TESTSDKLOCK}"
 
-TEST_LOG_SDKEXT_DIR ?= "${WORKDIR}/testsdkext"
 TESTSDKEXTLOCK = "${TMPDIR}/testsdkext.lock"
 
 def testsdkext_main(d):
@@ -132,7 +100,11 @@ def testsdkext_main(d):
 import logging
 
 from bb.utils import export_proxies
-from oeqa.utils import avoid_paths_in_environ
+from oeqa.utils import avoid_paths_in_environ, 
make_logger_bitbake_compatible
+from oeqa.sdkext.context import OESDKExtTestContext, 
OESDKExtTestContextExecutor
+
+pn = d.getVar("PN", True)
+logger = make_logger_bitbake_compatible(logging.getLogger("BitBake"))
 
 # extensible sdk use network
 export_proxies(d)
@@ -143,23 +115,27 @@ def testsdkext_main(d):
   d.getVar('BASE_WORKDIR')]
 os.environ['PATH'] = avoid_paths_in_environ(paths_to_avoid)
 
-pn = d.getVar("PN")
-bb.utils.mkdirhier(d.getVar("TEST_LOG_SDKEXT_DIR"))
-
 tcname = d.expand("${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.sh")
 if not os.path.exists(tcname):
 bb.fatal("The toolchain ext %s is not built. Build it before running 
the" \
  " tests: 'bitbake  -c populate_sdk_ext' ." % tcname)
 
-testdir = d.expand("${WORKDIR}/testsdkext/")
-bb.utils.remove(testdir, True)
-bb.utils.mkdirhier(testdir)
-sdkdir = os.path.join(testdir, 'tc')
+tdname = d.expand("${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.testdata.json")
+test_data = json.load(open(tdname, "r"))
+
+target_pkg_manifest = OESDKExtTestContextExecutor._load_manifest(
+d.expand("${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.target.manifest"))
+host_pkg_manifest = OESDKExtTestContextExecutor._load_manifest(
+d.expand("${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.host.manifest"))
+
+sdk_dir = d.expand("${WORKDIR}/testsdkext/")
+bb.utils.remove(sdk_dir, True)
+bb.utils.mkdirhier(sdk_dir)
 try:
-subprocess.check_output("%s -y -d %s" % (tcname, sdkdir), shell=True)
+subprocess.check_output("%s -y -d %s" % (tcname, sdk_dir), shell=True)
 except subprocess.CalledProcessError as e:
 msg = "Couldn't install the extensible SDK:\n%s" % 
e.output.decode("utf-8")
-logfn = os.path.join(sdkdir, 'preparing_build_system.log')
+logfn = os.path.join(sdk_dir, 'preparing_build_system.log')
 if os.path.exists(logfn):
 msg += '\n\nContents of preparing_build_system.log:\n'
 with open(logfn, 'r') as f:
@@ -167,19 +143,35 @@ def testsdkext_main(d):
 msg += line
 bb.fatal(msg)
 
-try:
-bb.plain("Running SDK Compatibility tests ...")
-run_test_context(SDKExtTestContext, d, testdir, tcname, pn, True)
-finally:
-pass
+fail = False
+sdk_envs = OESDKExtTestContextExecutor._get_sdk_environs(sdk_dir)
+for s in sdk_envs:
+bb.plain("Extensible SDK testing environment: %s" % s)
 
-try:
-bb.plain("Running Extensible SDK tests ...")
-run_test_context(SDKExtTestContext, d, testdir, tcname, pn)
-finally:
-pass
+sdk_env = sdk_envs[s]
+tc = OESDKExtTestContext(td=test_data, 

[OE-core] [PATCH 26/55] oeqa/sdkext: Move test cases inside cases directory

2017-01-20 Thread Aníbal Limón
For match with the new structure of the OEQA framework.

In the new framework Test component base directory in this case
sdk module will contain case and context implementations.

[YOCTO #10599]

Signed-off-by: Aníbal Limón 
---
 meta/lib/oeqa/sdkext/__init__.py   | 3 ---
 meta/lib/oeqa/sdkext/{ => cases}/devtool.py| 0
 meta/lib/oeqa/sdkext/{ => cases}/sdk_update.py | 0
 3 files changed, 3 deletions(-)
 rename meta/lib/oeqa/sdkext/{ => cases}/devtool.py (100%)
 rename meta/lib/oeqa/sdkext/{ => cases}/sdk_update.py (100%)

diff --git a/meta/lib/oeqa/sdkext/__init__.py b/meta/lib/oeqa/sdkext/__init__.py
index 4cf3fa7..e69de29 100644
--- a/meta/lib/oeqa/sdkext/__init__.py
+++ b/meta/lib/oeqa/sdkext/__init__.py
@@ -1,3 +0,0 @@
-# Enable other layers to have tests in the same named directory
-from pkgutil import extend_path
-__path__ = extend_path(__path__, __name__)
diff --git a/meta/lib/oeqa/sdkext/devtool.py 
b/meta/lib/oeqa/sdkext/cases/devtool.py
similarity index 100%
rename from meta/lib/oeqa/sdkext/devtool.py
rename to meta/lib/oeqa/sdkext/cases/devtool.py
diff --git a/meta/lib/oeqa/sdkext/sdk_update.py 
b/meta/lib/oeqa/sdkext/cases/sdk_update.py
similarity index 100%
rename from meta/lib/oeqa/sdkext/sdk_update.py
rename to meta/lib/oeqa/sdkext/cases/sdk_update.py
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 27/55] oeqa/sdkext: Adds case and context modules.

2017-01-20 Thread Aníbal Limón
The extensible sdk context and case modules extends the sdk ones,
this means that the tests from sdk are run also the sdkext tests.

Enables support in context for use oe-test esdk command for run
the test suites, the same options of sdk are required for run esdk tests.

Removes old related to case and context inside oetest.py.

[YOCTO #10599]

Signed-off-by: Aníbal Limón 
---
 meta/lib/oeqa/oetest.py | 40 
 meta/lib/oeqa/sdkext/case.py| 21 +
 meta/lib/oeqa/sdkext/context.py | 21 +
 3 files changed, 42 insertions(+), 40 deletions(-)
 create mode 100644 meta/lib/oeqa/sdkext/case.py
 create mode 100644 meta/lib/oeqa/sdkext/context.py

diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py
index d7c3588..503f6fc 100644
--- a/meta/lib/oeqa/oetest.py
+++ b/meta/lib/oeqa/oetest.py
@@ -27,7 +27,6 @@ try:
 except ImportError:
 pass
 from oeqa.utils.decorators import LogResults, gettag, getResults
-from oeqa.utils import avoid_paths_in_environ
 
 logger = logging.getLogger("BitBake")
 
@@ -145,18 +144,6 @@ class 
OETestCalledProcessError(subprocess.CalledProcessError):
 
 subprocess.CalledProcessError = OETestCalledProcessError
 
-class oeSDKExtTest(oeSDKTest):
-def _run(self, cmd):
-# extensible sdk shows a warning if found bitbake in the path
-# because can cause contamination, i.e. use devtool from
-# poky/scripts instead of eSDK one.
-env = os.environ.copy()
-paths_to_avoid = ['bitbake/bin', 'poky/scripts']
-env['PATH'] = avoid_paths_in_environ(paths_to_avoid)
-
-return subprocess.check_output(". %s > /dev/null;"\
-" %s;" % (self.tc.sdkenv, cmd), stderr=subprocess.STDOUT, 
shell=True, env=env).decode("utf-8")
-
 def getmodule(pos=2):
 # stack returns a list of tuples containg frame information
 # First element of the list the is current frame, caller is 1
@@ -642,30 +629,3 @@ class ExportTestContext(RuntimeTestContext):
 extracted_dir = self.d.getVar("TEST_EXPORT_EXTRACTED_DIR")
 pkg_dir = os.path.join(export_dir, extracted_dir)
 super(ExportTestContext, self).install_uninstall_packages(test_id, 
pkg_dir, install)
-
-class SDKExtTestContext(SDKTestContext):
-def __init__(self, d, sdktestdir, sdkenv, tcname, *args):
-self.target_manifest = d.getVar("SDK_EXT_TARGET_MANIFEST")
-self.host_manifest = d.getVar("SDK_EXT_HOST_MANIFEST")
-if args:
-self.cm = args[0] # Compatibility mode for run SDK tests
-else:
-self.cm = False
-
-super(SDKExtTestContext, self).__init__(d, sdktestdir, sdkenv, tcname)
-
-self.sdkextfilesdir = os.path.join(os.path.dirname(os.path.abspath(
-oeqa.sdkext.__file__)), "files")
-
-def _get_test_namespace(self):
-if self.cm:
-return "sdk"
-else:
-return "sdkext"
-
-def _get_test_suites(self):
-return (self.d.getVar("TEST_SUITES_SDK_EXT") or "auto").split()
-
-def _get_test_suites_required(self):
-return [t for t in (self.d.getVar("TEST_SUITES_SDK_EXT") or \
-"auto").split() if t != "auto"]
diff --git a/meta/lib/oeqa/sdkext/case.py b/meta/lib/oeqa/sdkext/case.py
new file mode 100644
index 000..6f708aa
--- /dev/null
+++ b/meta/lib/oeqa/sdkext/case.py
@@ -0,0 +1,21 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+import os
+import subprocess
+
+from oeqa.utils import avoid_paths_in_environ
+from oeqa.sdk.case import OESDKTestCase
+
+class OESDKExtTestCase(OESDKTestCase):
+def _run(self, cmd):
+# extensible sdk shows a warning if found bitbake in the path
+# because can cause contamination, i.e. use devtool from
+# poky/scripts instead of eSDK one.
+env = os.environ.copy()
+paths_to_avoid = ['bitbake/bin', 'poky/scripts']
+env['PATH'] = avoid_paths_in_environ(paths_to_avoid)
+
+return subprocess.check_output(". %s > /dev/null;"\
+" %s;" % (self.tc.sdk_env, cmd), stderr=subprocess.STDOUT,
+shell=True, env=env).decode("utf-8")
diff --git a/meta/lib/oeqa/sdkext/context.py b/meta/lib/oeqa/sdkext/context.py
new file mode 100644
index 000..8dbcd80
--- /dev/null
+++ b/meta/lib/oeqa/sdkext/context.py
@@ -0,0 +1,21 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+import os
+from oeqa.sdk.context import OESDKTestContext, OESDKTestContextExecutor
+
+class OESDKExtTestContext(OESDKTestContext):
+esdk_files_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 
"files")
+
+class OESDKExtTestContextExecutor(OESDKTestContextExecutor):
+_context_class = OESDKExtTestContext
+
+name = 'esdk'
+help = 'esdk test component'
+description = 'executes esdk tests'
+
+default_cases = 

[OE-core] [PATCH 22/55] oeqa/utils: Move targetbuild to buildproject module

2017-01-20 Thread Aníbal Limón
The new buildproject module will contain only BuildProject class
a helper class for build source code.

The remaining classes TargetBuildProject and SDKBuildProject was
move to runtime and sdk respectively.

[YOCTO #10599]

Signed-off-by: Aníbal Limón 
Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/runtime/utils/__init__.py   |  0
 meta/lib/oeqa/runtime/utils/targetbuildproject.py | 33 +++
 meta/lib/oeqa/sdk/utils/__init__.py   |  0
 meta/lib/oeqa/sdk/utils/sdkbuildproject.py| 45 +++
 meta/lib/oeqa/utils/buildproject.py   | 69 +++
 5 files changed, 147 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/utils/__init__.py
 create mode 100644 meta/lib/oeqa/runtime/utils/targetbuildproject.py
 create mode 100644 meta/lib/oeqa/sdk/utils/__init__.py
 create mode 100644 meta/lib/oeqa/sdk/utils/sdkbuildproject.py
 create mode 100644 meta/lib/oeqa/utils/buildproject.py

diff --git a/meta/lib/oeqa/runtime/utils/__init__.py 
b/meta/lib/oeqa/runtime/utils/__init__.py
new file mode 100644
index 000..e69de29
diff --git a/meta/lib/oeqa/runtime/utils/targetbuildproject.py 
b/meta/lib/oeqa/runtime/utils/targetbuildproject.py
new file mode 100644
index 000..138b5ef
--- /dev/null
+++ b/meta/lib/oeqa/runtime/utils/targetbuildproject.py
@@ -0,0 +1,33 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+from oeqa.utils.buildproject import BuildProject
+
+class TargetBuildProject(BuildProject):
+
+def __init__(self, target, d, uri, foldername=None):
+self.target = target
+self.targetdir = "~/"
+BuildProject.__init__(self, d, uri, foldername, tmpdir="/tmp")
+
+def download_archive(self):
+
+self._download_archive()
+
+(status, output) = self.target.copy_to(self.localarchive, 
self.targetdir)
+if status != 0:
+raise Exception("Failed to copy archive to target, output: %s" % 
output)
+
+(status, output) = self.target.run('tar xf %s%s -C %s' % 
(self.targetdir, self.archive, self.targetdir))
+if status != 0:
+raise Exception("Failed to extract archive, output: %s" % output)
+
+#Change targetdir to project folder
+self.targetdir = self.targetdir + self.fname
+
+# The timeout parameter of target.run is set to 0 to make the ssh command
+# run with no timeout.
+def _run(self, cmd):
+return self.target.run(cmd, 0)[0]
+
+
diff --git a/meta/lib/oeqa/sdk/utils/__init__.py 
b/meta/lib/oeqa/sdk/utils/__init__.py
new file mode 100644
index 000..e69de29
diff --git a/meta/lib/oeqa/sdk/utils/sdkbuildproject.py 
b/meta/lib/oeqa/sdk/utils/sdkbuildproject.py
new file mode 100644
index 000..1eebd3a
--- /dev/null
+++ b/meta/lib/oeqa/sdk/utils/sdkbuildproject.py
@@ -0,0 +1,45 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+import os
+import subprocess
+
+from oeqa.utils.buildproject import BuildProject
+
+class SDKBuildProject(BuildProject):
+
+def __init__(self, testpath, sdkenv, d, uri, foldername=None):
+self.sdkenv = sdkenv
+self.testdir = testpath
+self.targetdir = testpath
+bb.utils.mkdirhier(testpath)
+self.datetime = d.getVar('DATETIME')
+self.testlogdir = d.getVar("TEST_LOG_DIR")
+bb.utils.mkdirhier(self.testlogdir)
+self.logfile = os.path.join(self.testlogdir, "sdk_target_log.%s" % 
self.datetime)
+BuildProject.__init__(self, d, uri, foldername, tmpdir=testpath)
+
+def download_archive(self):
+
+self._download_archive()
+
+cmd = 'tar xf %s%s -C %s' % (self.targetdir, self.archive, 
self.targetdir)
+subprocess.check_call(cmd, shell=True)
+
+#Change targetdir to project folder
+self.targetdir = os.path.join(self.targetdir, self.fname)
+
+def run_configure(self, configure_args='', extra_cmds=' gnu-configize; '):
+return super(SDKBuildProject, 
self).run_configure(configure_args=(configure_args or '$CONFIGURE_FLAGS'), 
extra_cmds=extra_cmds)
+
+def run_install(self, install_args=''):
+return super(SDKBuildProject, 
self).run_install(install_args=(install_args or "DESTDIR=%s/../install" % 
self.targetdir))
+
+def log(self, msg):
+if self.logfile:
+with open(self.logfile, "a") as f:
+   f.write("%s\n" % msg)
+
+def _run(self, cmd):
+self.log("Running . %s; " % self.sdkenv + cmd)
+return subprocess.call(". %s; " % self.sdkenv + cmd, shell=True)
diff --git a/meta/lib/oeqa/utils/buildproject.py 
b/meta/lib/oeqa/utils/buildproject.py
new file mode 100644
index 000..1ed9624
--- /dev/null
+++ b/meta/lib/oeqa/utils/buildproject.py
@@ -0,0 +1,69 @@
+# Copyright (C) 2013-2016 Intel Corporation
+#
+# Released under the MIT license (see COPYING.MIT)
+
+# Provides a class for 

[OE-core] [PATCH 25/55] classes/testsdk: Remove the need of TEST_LOG_DIR variable

2017-01-20 Thread Aníbal Limón
The TEST_LOG_DIR was used for store sdk_target_log this log
contains the output of the run of build commands now that information
could be found also on log.do_testsdk under WORKDIR.

The log will continue to store into SDK_DIR instead of TEST_LOG_DIR.

Signed-off-by: Aníbal Limón 
---
 meta/classes/testsdk.bbclass   | 6 --
 meta/lib/oeqa/sdk/cases/buildcvs.py| 4 ++--
 meta/lib/oeqa/sdk/cases/buildgalculator.py | 4 ++--
 meta/lib/oeqa/sdk/cases/buildiptables.py   | 4 ++--
 4 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/meta/classes/testsdk.bbclass b/meta/classes/testsdk.bbclass
index 7304129..176dafd 100644
--- a/meta/classes/testsdk.bbclass
+++ b/meta/classes/testsdk.bbclass
@@ -14,7 +14,6 @@
 #
 # where "" is an image like core-image-sato.
 
-TEST_LOG_DIR ?= "${WORKDIR}/testimage"
 TESTSDKLOCK = "${TMPDIR}/testsdk.lock"
 
 def run_test_context(CTestContext, d, testdir, tcname, pn, *args):
@@ -65,17 +64,12 @@ def testsdk_main(d):
 # sdk use network for download projects for build
 export_proxies(d)
 
-test_log_dir = d.getVar("TEST_LOG_DIR", True)
-
-bb.utils.mkdirhier(test_log_dir)
-
 tcname = d.expand("${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.sh")
 if not os.path.exists(tcname):
 bb.fatal("The toolchain %s is not built. Build it before running the 
tests: 'bitbake  -c populate_sdk' ." % tcname)
 
 tdname = d.expand("${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.testdata.json")
 test_data = json.load(open(tdname, "r"))
-test_data['TEST_LOG_DIR'] = test_log_dir
 
 target_pkg_manifest = OESDKTestContextExecutor._load_manifest(
 d.expand("${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.target.manifest"))
diff --git a/meta/lib/oeqa/sdk/cases/buildcvs.py 
b/meta/lib/oeqa/sdk/cases/buildcvs.py
index ee7fb73..6222a8e 100644
--- a/meta/lib/oeqa/sdk/cases/buildcvs.py
+++ b/meta/lib/oeqa/sdk/cases/buildcvs.py
@@ -2,7 +2,7 @@ from oeqa.sdk.case import OESDKTestCase
 from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject
 
 class BuildCvsTest(OESDKTestCase):
-td_vars = ['TEST_LOG_DIR', 'DATETIME']
+td_vars = ['DATETIME']
 
 @classmethod
 def setUpClass(self):
@@ -10,7 +10,7 @@ class BuildCvsTest(OESDKTestCase):
 
 self.project = SDKBuildProject(self.tc.sdk_dir + "/cvs/", 
self.tc.sdk_env,
 
"http://ftp.gnu.org/non-gnu/cvs/source/feature/1.12.13/cvs-1.12.13.tar.bz2;,
-self.td['TEST_LOG_DIR'], self.td['DATETIME'], 
dl_dir=dl_dir)
+self.tc.sdk_dir, self.td['DATETIME'], dl_dir=dl_dir)
 self.project.download_archive()
 
 def test_cvs(self):
diff --git a/meta/lib/oeqa/sdk/cases/buildgalculator.py 
b/meta/lib/oeqa/sdk/cases/buildgalculator.py
index d2c1189..bdc8b6a 100644
--- a/meta/lib/oeqa/sdk/cases/buildgalculator.py
+++ b/meta/lib/oeqa/sdk/cases/buildgalculator.py
@@ -4,7 +4,7 @@ from oeqa.sdk.case import OESDKTestCase
 from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject
 
 class GalculatorTest(OESDKTestCase):
-td_vars = ['TEST_LOG_DIR', 'DATETIME']
+td_vars = ['DATETIME']
 
 @classmethod
 def setUpClass(self):
@@ -19,7 +19,7 @@ class GalculatorTest(OESDKTestCase):
 project = SDKBuildProject(self.tc.sdk_dir + "/galculator/",
   self.tc.sdk_env,
   
"http://galculator.mnim.org/downloads/galculator-2.1.4.tar.bz2;,
-  self.td['TEST_LOG_DIR'], 
self.td['DATETIME'], dl_dir=dl_dir)
+  self.tc.sdk_dir, self.td['DATETIME'], 
dl_dir=dl_dir)
 
 project.download_archive()
 
diff --git a/meta/lib/oeqa/sdk/cases/buildiptables.py 
b/meta/lib/oeqa/sdk/cases/buildiptables.py
index a50fb5d..532b5de 100644
--- a/meta/lib/oeqa/sdk/cases/buildiptables.py
+++ b/meta/lib/oeqa/sdk/cases/buildiptables.py
@@ -2,7 +2,7 @@ from oeqa.sdk.case import OESDKTestCase
 from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject
 
 class BuildIptablesTest(OESDKTestCase):
-td_vars = ['TEST_LOG_DIR', 'DATETIME']
+td_vars = ['DATETIME']
 
 @classmethod
 def setUpClass(self):
@@ -10,7 +10,7 @@ class BuildIptablesTest(OESDKTestCase):
 
 self.project = SDKBuildProject(self.tc.sdk_dir + "/iptables/", 
self.tc.sdk_env, 
 
"http://downloads.yoctoproject.org/mirror/sources/iptables-1.4.13.tar.bz2;,
-self.td['TEST_LOG_DIR'], self.td['DATETIME'], 
dl_dir=dl_dir)
+self.tc.sdk_dir, self.td['DATETIME'], dl_dir=dl_dir)
 self.project.download_archive()
 
 def test_iptables(self):
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 18/55] oeqa/sdk: Move test cases inside cases directory

2017-01-20 Thread Aníbal Limón
For match with the new structure of the OEQA framework.

In the new framework Test component base directory in this case
sdk module will contain case and context implementations.

[YOCTO #10599]

Signed-off-by: Aníbal Limón 
Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/sdk/{ => cases}/__init__.py| 0
 meta/lib/oeqa/sdk/{ => cases}/buildcvs.py| 0
 meta/lib/oeqa/sdk/{ => cases}/buildgalculator.py | 0
 meta/lib/oeqa/sdk/{ => cases}/buildiptables.py   | 0
 meta/lib/oeqa/sdk/{ => cases}/gcc.py | 0
 meta/lib/oeqa/sdk/{ => cases}/perl.py| 0
 meta/lib/oeqa/sdk/{ => cases}/python.py  | 0
 7 files changed, 0 insertions(+), 0 deletions(-)
 rename meta/lib/oeqa/sdk/{ => cases}/__init__.py (100%)
 rename meta/lib/oeqa/sdk/{ => cases}/buildcvs.py (100%)
 rename meta/lib/oeqa/sdk/{ => cases}/buildgalculator.py (100%)
 rename meta/lib/oeqa/sdk/{ => cases}/buildiptables.py (100%)
 rename meta/lib/oeqa/sdk/{ => cases}/gcc.py (100%)
 rename meta/lib/oeqa/sdk/{ => cases}/perl.py (100%)
 rename meta/lib/oeqa/sdk/{ => cases}/python.py (100%)

diff --git a/meta/lib/oeqa/sdk/__init__.py b/meta/lib/oeqa/sdk/cases/__init__.py
similarity index 100%
rename from meta/lib/oeqa/sdk/__init__.py
rename to meta/lib/oeqa/sdk/cases/__init__.py
diff --git a/meta/lib/oeqa/sdk/buildcvs.py b/meta/lib/oeqa/sdk/cases/buildcvs.py
similarity index 100%
rename from meta/lib/oeqa/sdk/buildcvs.py
rename to meta/lib/oeqa/sdk/cases/buildcvs.py
diff --git a/meta/lib/oeqa/sdk/buildgalculator.py 
b/meta/lib/oeqa/sdk/cases/buildgalculator.py
similarity index 100%
rename from meta/lib/oeqa/sdk/buildgalculator.py
rename to meta/lib/oeqa/sdk/cases/buildgalculator.py
diff --git a/meta/lib/oeqa/sdk/buildiptables.py 
b/meta/lib/oeqa/sdk/cases/buildiptables.py
similarity index 100%
rename from meta/lib/oeqa/sdk/buildiptables.py
rename to meta/lib/oeqa/sdk/cases/buildiptables.py
diff --git a/meta/lib/oeqa/sdk/gcc.py b/meta/lib/oeqa/sdk/cases/gcc.py
similarity index 100%
rename from meta/lib/oeqa/sdk/gcc.py
rename to meta/lib/oeqa/sdk/cases/gcc.py
diff --git a/meta/lib/oeqa/sdk/perl.py b/meta/lib/oeqa/sdk/cases/perl.py
similarity index 100%
rename from meta/lib/oeqa/sdk/perl.py
rename to meta/lib/oeqa/sdk/cases/perl.py
diff --git a/meta/lib/oeqa/sdk/python.py b/meta/lib/oeqa/sdk/cases/python.py
similarity index 100%
rename from meta/lib/oeqa/sdk/python.py
rename to meta/lib/oeqa/sdk/cases/python.py
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 21/55] classes/testsdk: Migrates testsdk.bbclass to use new OESDKTestContext

2017-01-20 Thread Aníbal Limón
The functionality provided is the same with imporvements on code
reuse and better interfaces.

Signed-off-by: Aníbal Limón 
---
 meta/classes/testsdk.bbclass | 75 +++-
 1 file changed, 60 insertions(+), 15 deletions(-)

diff --git a/meta/classes/testsdk.bbclass b/meta/classes/testsdk.bbclass
index 063b908..7304129 100644
--- a/meta/classes/testsdk.bbclass
+++ b/meta/classes/testsdk.bbclass
@@ -50,30 +50,75 @@ def run_test_context(CTestContext, d, testdir, tcname, pn, 
*args):
 
 def testsdk_main(d):
 import os
-import oeqa.sdk
 import subprocess
-from oeqa.oetest import SDKTestContext
+import json
+import logging
 
-pn = d.getVar("PN")
-bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR"))
+from bb.utils import export_proxies
+from oeqa.core.runner import OEStreamLogger
+from oeqa.sdk.context import OESDKTestContext, OESDKTestContextExecutor
+from oeqa.utils import make_logger_bitbake_compatible
+
+pn = d.getVar("PN", True)
+logger = make_logger_bitbake_compatible(logging.getLogger("BitBake"))
+
+# sdk use network for download projects for build
+export_proxies(d)
+
+test_log_dir = d.getVar("TEST_LOG_DIR", True)
+
+bb.utils.mkdirhier(test_log_dir)
 
 tcname = d.expand("${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.sh")
 if not os.path.exists(tcname):
 bb.fatal("The toolchain %s is not built. Build it before running the 
tests: 'bitbake  -c populate_sdk' ." % tcname)
 
-sdktestdir = d.expand("${WORKDIR}/testimage-sdk/")
-bb.utils.remove(sdktestdir, True)
-bb.utils.mkdirhier(sdktestdir)
+tdname = d.expand("${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.testdata.json")
+test_data = json.load(open(tdname, "r"))
+test_data['TEST_LOG_DIR'] = test_log_dir
+
+target_pkg_manifest = OESDKTestContextExecutor._load_manifest(
+d.expand("${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.target.manifest"))
+host_pkg_manifest = OESDKTestContextExecutor._load_manifest(
+d.expand("${SDK_DEPLOY}/${TOOLCHAIN_OUTPUTNAME}.host.manifest"))
+
+sdk_dir = d.expand("${WORKDIR}/testimage-sdk/")
+bb.utils.remove(sdk_dir, True)
+bb.utils.mkdirhier(sdk_dir)
 try:
-subprocess.check_output("cd %s; %s <

[OE-core] [PATCH 19/55] oeqa/{runtime, sdk}/files: Move testsdkmakefile from runtime to sdk module

2017-01-20 Thread Aníbal Limón
It doesn't make sense to have files related to sdk module into runtime
module.

[YOCTO #10599]

Signed-off-by: Aníbal Limón 
Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/{runtime => sdk}/files/testsdkmakefile | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename meta/lib/oeqa/{runtime => sdk}/files/testsdkmakefile (100%)

diff --git a/meta/lib/oeqa/runtime/files/testsdkmakefile 
b/meta/lib/oeqa/sdk/files/testsdkmakefile
similarity index 100%
rename from meta/lib/oeqa/runtime/files/testsdkmakefile
rename to meta/lib/oeqa/sdk/files/testsdkmakefile
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 24/55] oeqa/sdk/cases: Migrate tests to the new OEQA framework

2017-01-20 Thread Aníbal Limón
Summary of the changes:

- Remove auto extend_path using pkgutil at __init__, is not needed.
- Change base class to OESDKTestCase.
- Add td_vars attr to set dependencies of certain variables in test
data.
- Change skips from module level to class level because Test context
  (tc)
now isn't at module level.
- Variable names changes to be consistent (i.e. sdktestdir ->
  sdk_dir).

[YOCTO #10599]

- Don't use bb.utils functions use instead remove_safe and shutil
  for copy files.
- SDKBuildProject pass test data variables instead of call getVar
  inside.

[YOCTO #10231]

Signed-off-by: Aníbal Limón 
Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/sdk/cases/__init__.py|  3 ---
 meta/lib/oeqa/sdk/cases/buildcvs.py| 15 ++-
 meta/lib/oeqa/sdk/cases/buildgalculator.py | 28 
 meta/lib/oeqa/sdk/cases/buildiptables.py   | 16 +++-
 meta/lib/oeqa/sdk/cases/gcc.py | 41 +-
 meta/lib/oeqa/sdk/cases/perl.py| 25 +-
 meta/lib/oeqa/sdk/cases/python.py  | 25 +-
 7 files changed, 84 insertions(+), 69 deletions(-)
 delete mode 100644 meta/lib/oeqa/sdk/cases/__init__.py

diff --git a/meta/lib/oeqa/sdk/cases/__init__.py 
b/meta/lib/oeqa/sdk/cases/__init__.py
deleted file mode 100644
index 4cf3fa7..000
--- a/meta/lib/oeqa/sdk/cases/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-# Enable other layers to have tests in the same named directory
-from pkgutil import extend_path
-__path__ = extend_path(__path__, __name__)
diff --git a/meta/lib/oeqa/sdk/cases/buildcvs.py 
b/meta/lib/oeqa/sdk/cases/buildcvs.py
index c7146fa..ee7fb73 100644
--- a/meta/lib/oeqa/sdk/cases/buildcvs.py
+++ b/meta/lib/oeqa/sdk/cases/buildcvs.py
@@ -1,13 +1,16 @@
-from oeqa.oetest import oeSDKTest, skipModule
-from oeqa.utils.decorators import *
-from oeqa.utils.targetbuild import SDKBuildProject
+from oeqa.sdk.case import OESDKTestCase
+from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject
 
-class BuildCvsTest(oeSDKTest):
+class BuildCvsTest(OESDKTestCase):
+td_vars = ['TEST_LOG_DIR', 'DATETIME']
 
 @classmethod
 def setUpClass(self):
-self.project = SDKBuildProject(oeSDKTest.tc.sdktestdir + "/cvs/", 
oeSDKTest.tc.sdkenv, oeSDKTest.tc.d,
-
"http://ftp.gnu.org/non-gnu/cvs/source/feature/1.12.13/cvs-1.12.13.tar.bz2;)
+dl_dir = self.td.get('DL_DIR', None)
+
+self.project = SDKBuildProject(self.tc.sdk_dir + "/cvs/", 
self.tc.sdk_env,
+
"http://ftp.gnu.org/non-gnu/cvs/source/feature/1.12.13/cvs-1.12.13.tar.bz2;,
+self.td['TEST_LOG_DIR'], self.td['DATETIME'], 
dl_dir=dl_dir)
 self.project.download_archive()
 
 def test_cvs(self):
diff --git a/meta/lib/oeqa/sdk/cases/buildgalculator.py 
b/meta/lib/oeqa/sdk/cases/buildgalculator.py
index dc2fa9c..d2c1189 100644
--- a/meta/lib/oeqa/sdk/cases/buildgalculator.py
+++ b/meta/lib/oeqa/sdk/cases/buildgalculator.py
@@ -1,17 +1,25 @@
-from oeqa.oetest import oeSDKTest, skipModule
-from oeqa.utils.decorators import *
-from oeqa.utils.targetbuild import SDKBuildProject
+import unittest
 
-def setUpModule():
-if not (oeSDKTest.hasPackage("gtk+3") or 
oeSDKTest.hasPackage("libgtk-3.0")):
-skipModule("Image doesn't have gtk+3 in manifest")
+from oeqa.sdk.case import OESDKTestCase
+from oeqa.sdk.utils.sdkbuildproject import SDKBuildProject
+
+class GalculatorTest(OESDKTestCase):
+td_vars = ['TEST_LOG_DIR', 'DATETIME']
+
+@classmethod
+def setUpClass(self):
+if not (self.tc.hasTargetPackage("gtk+3") or\
+self.tc.hasTargetPackage("libgtk-3.0")):
+raise unittest.SkipTest("%s class: SDK don't support gtk+3" % 
self.__name__)
 
-class GalculatorTest(oeSDKTest):
 def test_galculator(self):
+dl_dir = self.td.get('DL_DIR', None)
+project = None
 try:
-project = SDKBuildProject(oeSDKTest.tc.sdktestdir + "/galculator/",
-  oeSDKTest.tc.sdkenv, oeSDKTest.tc.d,
-  
"http://galculator.mnim.org/downloads/galculator-2.1.4.tar.bz2;)
+project = SDKBuildProject(self.tc.sdk_dir + "/galculator/",
+  self.tc.sdk_env,
+  
"http://galculator.mnim.org/downloads/galculator-2.1.4.tar.bz2;,
+  self.td['TEST_LOG_DIR'], 
self.td['DATETIME'], dl_dir=dl_dir)
 
 project.download_archive()
 
diff --git a/meta/lib/oeqa/sdk/cases/buildiptables.py 
b/meta/lib/oeqa/sdk/cases/buildiptables.py
index f0cb8a4..a50fb5d 100644
--- a/meta/lib/oeqa/sdk/cases/buildiptables.py
+++ b/meta/lib/oeqa/sdk/cases/buildiptables.py
@@ -1,14 +1,16 @@
-from oeqa.oetest import oeSDKTest
-from oeqa.utils.decorators import *
-from oeqa.utils.targetbuild import 

[OE-core] [PATCH 23/55] oeqa/utils: {Target, SDK, }BuildProject remove dependency of bb

2017-01-20 Thread Aníbal Limón
Don't use bitbake references inside utils modules, in order todo
that changes getVar calls for arguments in the __init__ method like
dl_dir for all the classes and testlogdir, builddatetime in
SDKBUildProject.

Also don't export proxies inside _download_archive method, a good
practice is to setup the proxies at init of the process instead of
do it in this helper module.

[YOCTO #10231]
[YOCTO #10599]

Signed-off-by: Aníbal Limón 
---
 meta/lib/oeqa/runtime/utils/targetbuildproject.py |  6 ++---
 meta/lib/oeqa/sdk/utils/sdkbuildproject.py| 14 +-
 meta/lib/oeqa/utils/buildproject.py   | 31 +--
 3 files changed, 17 insertions(+), 34 deletions(-)

diff --git a/meta/lib/oeqa/runtime/utils/targetbuildproject.py 
b/meta/lib/oeqa/runtime/utils/targetbuildproject.py
index 138b5ef..006d4d4 100644
--- a/meta/lib/oeqa/runtime/utils/targetbuildproject.py
+++ b/meta/lib/oeqa/runtime/utils/targetbuildproject.py
@@ -5,13 +5,13 @@ from oeqa.utils.buildproject import BuildProject
 
 class TargetBuildProject(BuildProject):
 
-def __init__(self, target, d, uri, foldername=None):
+def __init__(self, target, uri, foldername=None, dl_dir=None):
 self.target = target
 self.targetdir = "~/"
-BuildProject.__init__(self, d, uri, foldername, tmpdir="/tmp")
+BuildProject.__init__(self, uri, foldername, tmpdir="/tmp",
+dl_dir=dl_dir)
 
 def download_archive(self):
-
 self._download_archive()
 
 (status, output) = self.target.copy_to(self.localarchive, 
self.targetdir)
diff --git a/meta/lib/oeqa/sdk/utils/sdkbuildproject.py 
b/meta/lib/oeqa/sdk/utils/sdkbuildproject.py
index 1eebd3a..cc34e0c 100644
--- a/meta/lib/oeqa/sdk/utils/sdkbuildproject.py
+++ b/meta/lib/oeqa/sdk/utils/sdkbuildproject.py
@@ -7,17 +7,17 @@ import subprocess
 from oeqa.utils.buildproject import BuildProject
 
 class SDKBuildProject(BuildProject):
-
-def __init__(self, testpath, sdkenv, d, uri, foldername=None):
+def __init__(self, testpath, sdkenv, uri, testlogdir, builddatetime,
+foldername=None, dl_dir=None):
 self.sdkenv = sdkenv
 self.testdir = testpath
 self.targetdir = testpath
-bb.utils.mkdirhier(testpath)
-self.datetime = d.getVar('DATETIME')
-self.testlogdir = d.getVar("TEST_LOG_DIR")
-bb.utils.mkdirhier(self.testlogdir)
+os.makedirs(testpath, exist_ok=True)
+self.datetime = builddatetime
+self.testlogdir = testlogdir
+os.makedirs(self.testlogdir, exist_ok=True)
 self.logfile = os.path.join(self.testlogdir, "sdk_target_log.%s" % 
self.datetime)
-BuildProject.__init__(self, d, uri, foldername, tmpdir=testpath)
+BuildProject.__init__(self, uri, foldername, tmpdir=testpath, 
dl_dir=dl_dir)
 
 def download_archive(self):
 
diff --git a/meta/lib/oeqa/utils/buildproject.py 
b/meta/lib/oeqa/utils/buildproject.py
index 1ed9624..386a927 100644
--- a/meta/lib/oeqa/utils/buildproject.py
+++ b/meta/lib/oeqa/utils/buildproject.py
@@ -6,17 +6,17 @@
 
 import os
 import re
-import bb.utils
 import subprocess
+import shutil
+
 from abc import ABCMeta, abstractmethod
 
 class BuildProject(metaclass=ABCMeta):
-
-def __init__(self, d, uri, foldername=None, tmpdir="/tmp/"):
-self.d = d
+def __init__(self, uri, foldername=None, tmpdir="/tmp/", dl_dir=None):
 self.uri = uri
 self.archive = os.path.basename(uri)
 self.localarchive = os.path.join(tmpdir,self.archive)
+self.dl_dir = dl_dir
 if foldername:
 self.fname = foldername
 else:
@@ -24,27 +24,11 @@ class BuildProject(metaclass=ABCMeta):
 
 # Download self.archive to self.localarchive
 def _download_archive(self):
-
-dl_dir = self.d.getVar("DL_DIR")
-if dl_dir and os.path.exists(os.path.join(dl_dir, self.archive)):
-bb.utils.copyfile(os.path.join(dl_dir, self.archive), 
self.localarchive)
+if self.dl_dir and os.path.exists(os.path.join(self.dl_dir, 
self.archive)):
+shutil.copyfile(os.path.join(self.dl_dir, self.archive), 
self.localarchive)
 return
 
-exportvars = ['HTTP_PROXY', 'http_proxy',
-  'HTTPS_PROXY', 'https_proxy',
-  'FTP_PROXY', 'ftp_proxy',
-  'FTPS_PROXY', 'ftps_proxy',
-  'NO_PROXY', 'no_proxy',
-  'ALL_PROXY', 'all_proxy',
-  'SOCKS5_USER', 'SOCKS5_PASSWD']
-
-cmd = ''
-for var in exportvars:
-val = self.d.getVar(var)
-if val:
-cmd = 'export ' + var + '=\"%s\"; %s' % (val, cmd)
-
-cmd = cmd + "wget -O %s %s" % (self.localarchive, self.uri)
+cmd = "wget -O %s %s" % (self.localarchive, self.uri)
 subprocess.check_call(cmd, shell=True)
 
 # This method should provide a way to 

[OE-core] [PATCH 20/55] oeqa/sdk: Add case and context modules for the SDK component

2017-01-20 Thread Aníbal Limón
Adds case and context modules for SDK based on oetest.py old code.

Enables SDK Test component usage with oe-test, the SDK Test component
adds command line options for specify sdk installed dir, sdk environment
and target/hosts maniftest.

[YOCTO #10599]

Signed-off-by: Aníbal Limón 
Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/oetest.py   |  51 
 meta/lib/oeqa/sdk/__init__.py |   0
 meta/lib/oeqa/sdk/case.py |  12 
 meta/lib/oeqa/sdk/context.py  | 133 ++
 4 files changed, 145 insertions(+), 51 deletions(-)
 create mode 100644 meta/lib/oeqa/sdk/__init__.py
 create mode 100644 meta/lib/oeqa/sdk/case.py
 create mode 100644 meta/lib/oeqa/sdk/context.py

diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py
index d1aef96..d7c3588 100644
--- a/meta/lib/oeqa/oetest.py
+++ b/meta/lib/oeqa/oetest.py
@@ -145,20 +145,6 @@ class 
OETestCalledProcessError(subprocess.CalledProcessError):
 
 subprocess.CalledProcessError = OETestCalledProcessError
 
-class oeSDKTest(oeTest):
-def __init__(self, methodName='runTest'):
-self.sdktestdir = oeSDKTest.tc.sdktestdir
-super(oeSDKTest, self).__init__(methodName)
-
-@classmethod
-def hasHostPackage(self, pkg):
-if re.search(pkg, oeTest.tc.hostpkgmanifest):
-return True
-return False
-
-def _run(self, cmd):
-return subprocess.check_output(". %s > /dev/null; %s;" % 
(self.tc.sdkenv, cmd), shell=True, stderr=subprocess.STDOUT).decode("utf-8")
-
 class oeSDKExtTest(oeSDKTest):
 def _run(self, cmd):
 # extensible sdk shows a warning if found bitbake in the path
@@ -657,43 +643,6 @@ class ExportTestContext(RuntimeTestContext):
 pkg_dir = os.path.join(export_dir, extracted_dir)
 super(ExportTestContext, self).install_uninstall_packages(test_id, 
pkg_dir, install)
 
-class SDKTestContext(TestContext):
-def __init__(self, d, sdktestdir, sdkenv, tcname, *args):
-super(SDKTestContext, self).__init__(d)
-
-self.sdktestdir = sdktestdir
-self.sdkenv = sdkenv
-self.tcname = tcname
-
-if not hasattr(self, 'target_manifest'):
-self.target_manifest = d.getVar("SDK_TARGET_MANIFEST")
-try:
-self.pkgmanifest = {}
-with open(self.target_manifest) as f:
-for line in f:
-(pkg, arch, version) = line.strip().split()
-self.pkgmanifest[pkg] = (version, arch)
-except IOError as e:
-bb.fatal("No package manifest file found. Did you build the sdk 
image?\n%s" % e)
-
-if not hasattr(self, 'host_manifest'):
-self.host_manifest = d.getVar("SDK_HOST_MANIFEST")
-try:
-with open(self.host_manifest) as f:
-self.hostpkgmanifest = f.read()
-except IOError as e:
-bb.fatal("No host package manifest file found. Did you build the 
sdk image?\n%s" % e)
-
-def _get_test_namespace(self):
-return "sdk"
-
-def _get_test_suites(self):
-return (self.d.getVar("TEST_SUITES_SDK") or "auto").split()
-
-def _get_test_suites_required(self):
-return [t for t in (self.d.getVar("TEST_SUITES_SDK") or \
-"auto").split() if t != "auto"]
-
 class SDKExtTestContext(SDKTestContext):
 def __init__(self, d, sdktestdir, sdkenv, tcname, *args):
 self.target_manifest = d.getVar("SDK_EXT_TARGET_MANIFEST")
diff --git a/meta/lib/oeqa/sdk/__init__.py b/meta/lib/oeqa/sdk/__init__.py
new file mode 100644
index 000..e69de29
diff --git a/meta/lib/oeqa/sdk/case.py b/meta/lib/oeqa/sdk/case.py
new file mode 100644
index 000..782db8b
--- /dev/null
+++ b/meta/lib/oeqa/sdk/case.py
@@ -0,0 +1,12 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+import subprocess
+
+from oeqa.core.case import OETestCase
+
+class OESDKTestCase(OETestCase):
+def _run(self, cmd):
+return subprocess.check_output(". %s > /dev/null; %s;" % \
+(self.tc.sdk_env, cmd), shell=True,
+stderr=subprocess.STDOUT).decode("utf-8")
diff --git a/meta/lib/oeqa/sdk/context.py b/meta/lib/oeqa/sdk/context.py
new file mode 100644
index 000..0189ed8
--- /dev/null
+++ b/meta/lib/oeqa/sdk/context.py
@@ -0,0 +1,133 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+import os
+import sys
+import glob
+import re
+
+from oeqa.core.context import OETestContext, OETestContextExecutor
+
+class OESDKTestContext(OETestContext):
+sdk_files_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 
"files")
+
+def __init__(self, td=None, logger=None, sdk_dir=None, sdk_env=None,
+target_pkg_manifest=None, host_pkg_manifest=None):
+super(OESDKTestContext, self).__init__(td, logger)
+
+self.sdk_dir = 

[OE-core] [PATCH 16/55] oeqa/utils/__init__.py: Adds compatibility with bitbake logger

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

The bitbake logger changes the way debug is logged and adds
different levels within debug, this is passed as argument
to the function and breaks compatibility with vanilla loggers.

This implements a way to handle this adding a new function for
debug, that will dispatch the correct logging method signature.

Also overrides info method to use logging.INFO + 1 in order to
see plain data.

Also this commit fix the issue of not showing the test summary
and results when running from bitbake.

[YOCTO #10686]

Signed-off-by: Mariano Lopez 
Signed-off-by: Aníbal Limón 
---
 meta/lib/oeqa/utils/__init__.py | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/meta/lib/oeqa/utils/__init__.py b/meta/lib/oeqa/utils/__init__.py
index 8f706f3..485de03 100644
--- a/meta/lib/oeqa/utils/__init__.py
+++ b/meta/lib/oeqa/utils/__init__.py
@@ -36,3 +36,33 @@ def avoid_paths_in_environ(paths):
 
 new_path = new_path[:-1]
 return new_path
+
+def make_logger_bitbake_compatible(logger):
+import logging
+
+""" 
+Bitbake logger redifines debug() in order to
+set a level within debug, this breaks compatibility
+with vainilla logging, so we neeed to redifine debug()
+method again also add info() method with INFO + 1 level.
+"""
+def _bitbake_log_debug(*args, **kwargs):
+lvl = logging.DEBUG
+
+if isinstance(args[0], int):
+lvl = args[0]
+msg = args[1]
+args = args[2:]
+else:
+msg = args[0]
+args = args[1:]
+
+logger.log(lvl, msg, *args, **kwargs)
+
+def _bitbake_log_info(msg, *args, **kwargs):
+logger.log(logging.INFO + 1, msg, *args, **kwargs)
+
+logger.debug = _bitbake_log_debug
+logger.info = _bitbake_log_info
+
+return logger
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 17/55] oeqa: Move common files to oeqa/files instead of runtime only

2017-01-20 Thread Aníbal Limón
Those files are used by runtime and sdk test cases, so move to
base directory of oeqa module.

[YOCTO #10599]

Signed-off-by: Aníbal Limón 
Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/{runtime => }/files/test.c   | 0
 meta/lib/oeqa/{runtime => }/files/test.cpp | 0
 meta/lib/oeqa/{runtime => }/files/test.pl  | 0
 meta/lib/oeqa/{runtime => }/files/test.py  | 0
 4 files changed, 0 insertions(+), 0 deletions(-)
 rename meta/lib/oeqa/{runtime => }/files/test.c (100%)
 rename meta/lib/oeqa/{runtime => }/files/test.cpp (100%)
 rename meta/lib/oeqa/{runtime => }/files/test.pl (100%)
 rename meta/lib/oeqa/{runtime => }/files/test.py (100%)

diff --git a/meta/lib/oeqa/runtime/files/test.c b/meta/lib/oeqa/files/test.c
similarity index 100%
rename from meta/lib/oeqa/runtime/files/test.c
rename to meta/lib/oeqa/files/test.c
diff --git a/meta/lib/oeqa/runtime/files/test.cpp b/meta/lib/oeqa/files/test.cpp
similarity index 100%
rename from meta/lib/oeqa/runtime/files/test.cpp
rename to meta/lib/oeqa/files/test.cpp
diff --git a/meta/lib/oeqa/runtime/files/test.pl b/meta/lib/oeqa/files/test.pl
similarity index 100%
rename from meta/lib/oeqa/runtime/files/test.pl
rename to meta/lib/oeqa/files/test.pl
diff --git a/meta/lib/oeqa/runtime/files/test.py b/meta/lib/oeqa/files/test.py
similarity index 100%
rename from meta/lib/oeqa/runtime/files/test.py
rename to meta/lib/oeqa/files/test.py
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 15/55] classes/populate_sdk_base: Add write_sdk_test_data to postprocess

2017-01-20 Thread Aníbal Limón
This function will generates testdata.json per SDK type.

[YOCTO #10231]

Signed-off-by: Aníbal Limón 
---
 meta/classes/populate_sdk_base.bbclass | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/meta/classes/populate_sdk_base.bbclass 
b/meta/classes/populate_sdk_base.bbclass
index 8d117a9..5ad08c6 100644
--- a/meta/classes/populate_sdk_base.bbclass
+++ b/meta/classes/populate_sdk_base.bbclass
@@ -70,6 +70,13 @@ python write_target_sdk_manifest () {
 output.write(format_pkg_list(pkgs, 'ver'))
 }
 
+python write_sdk_test_data() {
+from oe.data import export2json
+testdata = "%s/%s.testdata.json" % (d.getVar('SDKDEPLOYDIR', True), 
d.getVar('TOOLCHAIN_OUTPUTNAME', True))
+bb.utils.mkdirhier(os.path.dirname(testdata))
+export2json(d, testdata)
+}
+
 python write_host_sdk_manifest () {
 from oe.sdk import sdk_list_installed_packages
 from oe.utils import format_pkg_list
@@ -81,7 +88,7 @@ python write_host_sdk_manifest () {
 output.write(format_pkg_list(pkgs, 'ver'))
 }
 
-POPULATE_SDK_POST_TARGET_COMMAND_append = " write_target_sdk_manifest ; "
+POPULATE_SDK_POST_TARGET_COMMAND_append = " write_target_sdk_manifest ; 
write_sdk_test_data ; "
 POPULATE_SDK_POST_HOST_COMMAND_append = " write_host_sdk_manifest; "
 SDK_PACKAGING_COMMAND = "${@'${SDK_PACKAGING_FUNC};' if 
'${SDK_PACKAGING_FUNC}' else ''}"
 SDK_POSTPROCESS_COMMAND = " create_sdk_files; check_sdk_sysroots; tar_sdk; 
${SDK_PACKAGING_COMMAND} "
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 12/55] oeqa/core: Add README

2017-01-20 Thread Aníbal Limón
The README has an introduction and explains how to run the test suite
and creates a new Test component.

Signed-off-by: Aníbal Limón 
Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/core/README | 38 ++
 1 file changed, 38 insertions(+)
 create mode 100644 meta/lib/oeqa/core/README

diff --git a/meta/lib/oeqa/core/README b/meta/lib/oeqa/core/README
new file mode 100644
index 000..0c859fd
--- /dev/null
+++ b/meta/lib/oeqa/core/README
@@ -0,0 +1,38 @@
+= OEQA Framework =
+
+== Introduction ==
+
+This is the new OEQA framework the base clases of the framework
+are in this module oeqa/core the subsequent components needs to
+extend this classes.
+
+A new/unique runner was created called oe-test and is under scripts/
+oe-test, this new runner scans over oeqa module searching for test
+components that supports OETestContextExecutor implemented in context
+module (i.e. oeqa/core/context.py).
+
+For execute an example:
+
+$ source oe-init-build-env
+$ oe-test core
+
+For list supported components:
+
+$ oe-test -h
+
+== Create new Test component ==
+
+Usally for add a new Test component the developer needs to extend
+OETestContext/OETestContextExecutor in context.py and OETestCase in
+case.py.
+
+== How to run the testing of the OEQA framework ==
+
+Run all tests:
+
+$ PATH=$PATH:../../ python3 -m unittest discover -s tests
+
+Run some test:
+
+$ cd tests/
+$ ./test_data.py
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 14/55] classes/rootfs-postcommands: Add write_image_test_data

2017-01-20 Thread Aníbal Limón
This function will generates testdata.json by image type.

[YOCTO #10231]

Signed-off-by: Aníbal Limón 
---
 meta/classes/rootfs-postcommands.bbclass | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/meta/classes/rootfs-postcommands.bbclass 
b/meta/classes/rootfs-postcommands.bbclass
index 53a4fda..c8f18c6 100644
--- a/meta/classes/rootfs-postcommands.bbclass
+++ b/meta/classes/rootfs-postcommands.bbclass
@@ -14,6 +14,9 @@ ROOTFS_POSTPROCESS_COMMAND += "rootfs_update_timestamp ; "
 # Tweak the mount options for rootfs in /etc/fstab if read-only-rootfs is 
enabled
 ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("IMAGE_FEATURES", 
"read-only-rootfs", "read_only_rootfs_hook; ", "",d)}'
 
+# Generates test data file with data store variables expanded in json format
+ROOTFS_POSTPROCESS_COMMAND += "write_image_test_data ; "
+
 # Write manifest
 IMAGE_MANIFEST = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.manifest"
 ROOTFS_POSTUNINSTALL_COMMAND =+ "write_image_manifest ; "
@@ -300,3 +303,18 @@ rootfs_check_host_user_contaminated () {
 rootfs_sysroot_relativelinks () {
sysroot-relativelinks.py ${SDK_OUTPUT}/${SDKTARGETSYSROOT}
 }
+
+# Generated test data json file
+python write_image_test_data() {
+from oe.data import export2json
+
+testdata = "%s/%s.testdata.json" % (d.getVar('DEPLOY_DIR_IMAGE', True), 
d.getVar('IMAGE_NAME', True))
+testdata_link = "%s/%s.testdata.json" % (d.getVar('DEPLOY_DIR_IMAGE', 
True), d.getVar('IMAGE_LINK_NAME', True))
+
+bb.utils.mkdirhier(os.path.dirname(testdata))
+export2json(d, testdata)
+
+if os.path.lexists(testdata_link):
+   os.remove(testdata_link)
+os.symlink(os.path.basename(testdata), testdata_link)
+}
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 13/55] oe/data: Add export2json function

2017-01-20 Thread Aníbal Limón
The export2json function export the variables contained in
the data store to JSON format, the main usage for now will be
to provide test data to QA framework.

Signed-off-by: Aníbal Limón 
---
 meta/lib/oe/data.py | 28 
 1 file changed, 28 insertions(+)

diff --git a/meta/lib/oe/data.py b/meta/lib/oe/data.py
index 4a67c45..3956733 100644
--- a/meta/lib/oe/data.py
+++ b/meta/lib/oe/data.py
@@ -1,3 +1,4 @@
+import json
 import oe.maketype
 
 def typed_value(key, d):
@@ -15,3 +16,30 @@ def typed_value(key, d):
 return oe.maketype.create(d.getVar(key) or '', var_type, **flags)
 except (TypeError, ValueError) as exc:
 bb.msg.fatal("Data", "%s: %s" % (key, str(exc)))
+
+def export2json(d, json_file, expand=True):
+data2export = {}
+keys2export = []
+
+for key in d.keys():
+if key.startswith("_"):
+continue
+elif key.startswith("BB"):
+continue
+elif key.startswith("B_pn"):
+continue
+elif key.startswith("do_"):
+continue
+elif d.getVarFlag(key, "func", True):
+continue
+
+keys2export.append(key)
+
+for key in keys2export:
+try:
+data2export[key] = d.getVar(key, expand)
+except bb.data_smart.ExpansionError:
+data2export[key] = ''
+
+with open(json_file, "w") as f:
+json.dump(data2export, f, skipkeys=True, indent=4, sort_keys=True)
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 11/55] oeqa/core/cases: Add example test cases

2017-01-20 Thread Aníbal Limón
Serves as an first input of how to the OEQA framework works.

Signed-off-by: Aníbal Limón 
Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/core/cases/__init__.py   |  0
 meta/lib/oeqa/core/cases/example/data.json |  1 +
 meta/lib/oeqa/core/cases/example/test_basic.py | 20 
 3 files changed, 21 insertions(+)
 create mode 100644 meta/lib/oeqa/core/cases/__init__.py
 create mode 100644 meta/lib/oeqa/core/cases/example/data.json
 create mode 100644 meta/lib/oeqa/core/cases/example/test_basic.py

diff --git a/meta/lib/oeqa/core/cases/__init__.py 
b/meta/lib/oeqa/core/cases/__init__.py
new file mode 100644
index 000..e69de29
diff --git a/meta/lib/oeqa/core/cases/example/data.json 
b/meta/lib/oeqa/core/cases/example/data.json
new file mode 100644
index 000..21d6b16
--- /dev/null
+++ b/meta/lib/oeqa/core/cases/example/data.json
@@ -0,0 +1 @@
+{"ARCH": "x86", "IMAGE": "core-image-minimal"}
\ No newline at end of file
diff --git a/meta/lib/oeqa/core/cases/example/test_basic.py 
b/meta/lib/oeqa/core/cases/example/test_basic.py
new file mode 100644
index 000..11cf380
--- /dev/null
+++ b/meta/lib/oeqa/core/cases/example/test_basic.py
@@ -0,0 +1,20 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+from oeqa.core.case import OETestCase
+from oeqa.core.decorator.depends import OETestDepends
+
+class OETestExample(OETestCase):
+def test_example(self):
+self.logger.info('IMAGE: %s' % self.td.get('IMAGE'))
+self.assertEqual('core-image-minimal', self.td.get('IMAGE'))
+self.logger.info('ARCH: %s' % self.td.get('ARCH'))
+self.assertEqual('x86', self.td.get('ARCH'))
+
+class OETestExampleDepend(OETestCase):
+@OETestDepends(['OETestExample.test_example'])
+def test_example_depends(self):
+pass
+
+def test_example_no_depends(self):
+pass
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 10/55] oeqa/core/context: Add support of OETestContextExecutor

2017-01-20 Thread Aníbal Limón
The OETestContextExecutor class supports to use oe-test for run core
test component also is a base class for the other test components
(runtime, sdk, selftest).

Te principal functionality is to support cmdline parsing and execution
of OETestContext, the test components could extend the common options
to provide specific ones. The common options between test components
are test data file, output log and test cases path's to scan.

Also it initializes the logger to be passed to the whole OEQA framework.

[YOCTO #10230]

Signed-off-by: Aníbal Limón 
Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/core/context.py | 85 +++
 1 file changed, 85 insertions(+)

diff --git a/meta/lib/oeqa/core/context.py b/meta/lib/oeqa/core/context.py
index cbab2f8..ba6ccf8 100644
--- a/meta/lib/oeqa/core/context.py
+++ b/meta/lib/oeqa/core/context.py
@@ -146,3 +146,88 @@ class OETestContext(object):
 else:
 self.logger.info("RESULTS - %s - Testcase %s: %s" % (case.id(),
 oeid, 'PASSED'))
+
+class OETestContextExecutor(object):
+_context_class = OETestContext
+
+name = 'core'
+help = 'core test component example'
+description = 'executes core test suite example'
+
+default_cases = [os.path.join(os.path.abspath(os.path.dirname(__file__)),
+'cases/example')]
+default_test_data = os.path.join(default_cases[0], 'data.json')
+
+def register_commands(self, logger, subparsers):
+self.parser = subparsers.add_parser(self.name, help=self.help,
+description=self.description, group='components')
+
+self.default_output_log = '%s-results-%s.log' % (self.name,
+time.strftime("%Y%m%d%H%M%S"))
+self.parser.add_argument('--output-log', action='store',
+default=self.default_output_log,
+help="results output log, default: %s" % 
self.default_output_log)
+
+if self.default_test_data:
+self.parser.add_argument('--test-data-file', action='store',
+default=self.default_test_data,
+help="data file to load, default: %s" % 
self.default_test_data)
+else:
+self.parser.add_argument('--test-data-file', action='store',
+help="data file to load")
+
+if self.default_cases:
+self.parser.add_argument('CASES_PATHS', action='store',
+default=self.default_cases, nargs='*',
+help="paths to directories with test cases, default: %s"\
+% self.default_cases)
+else:
+self.parser.add_argument('CASES_PATHS', action='store',
+nargs='+', help="paths to directories with test cases")
+
+self.parser.set_defaults(func=self.run)
+
+def _setup_logger(self, logger, args):
+formatter = logging.Formatter('%(asctime)s - ' + self.name + \
+' - %(levelname)s - %(message)s')
+sh = logger.handlers[0]
+sh.setFormatter(formatter)
+fh = logging.FileHandler(args.output_log)
+fh.setFormatter(formatter)
+logger.addHandler(fh)
+
+return logger
+
+def _process_args(self, logger, args):
+self.tc_kwargs = {}
+self.tc_kwargs['init'] = {}
+self.tc_kwargs['load'] = {}
+self.tc_kwargs['run'] = {}
+
+self.tc_kwargs['init']['logger'] = self._setup_logger(logger, args)
+if args.test_data_file:
+self.tc_kwargs['init']['td'] = json.load(
+open(args.test_data_file, "r"))
+else:
+self.tc_kwargs['init']['td'] = {}
+
+self.module_paths = args.CASES_PATHS
+
+def run(self, logger, args):
+self._process_args(logger, args)
+
+self.tc = self._context_class(**self.tc_kwargs['init'])
+self.tc.loadTests(self.module_paths, **self.tc_kwargs['load'])
+rc = self.tc.runTests(**self.tc_kwargs['run'])
+self.tc.logSummary(rc, self.name)
+self.tc.logDetails()
+
+output_link = os.path.join(os.path.dirname(args.output_log),
+"%s-results.log" % self.name)
+if os.path.exists(output_link):
+os.remove(output_link)
+os.symlink(args.output_log, output_link)
+
+return rc
+
+_executor_class = OETestContextExecutor
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 07/55] oeqa/core/decorator: Add support for OETestDataDepends and skipIfDataVar

2017-01-20 Thread Aníbal Limón
The OETestDataDepends decorator skips a test case if a variable
isn't into test data (d).

The skipIfDataVar decorator skips a test case if a variable
has certain value.

Signed-off-by: Aníbal Limón 
Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/core/decorator/data.py | 36 
 1 file changed, 36 insertions(+)
 create mode 100644 meta/lib/oeqa/core/decorator/data.py

diff --git a/meta/lib/oeqa/core/decorator/data.py 
b/meta/lib/oeqa/core/decorator/data.py
new file mode 100644
index 000..73cca88
--- /dev/null
+++ b/meta/lib/oeqa/core/decorator/data.py
@@ -0,0 +1,36 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+from oeqa.core.exception import OEQAMissingVariable
+
+from . import OETestDecorator, registerDecorator
+
+@registerDecorator
+class skipIfDataVar(OETestDecorator):
+"""
+Skip test based on value of a data store's variable.
+
+It will get the info of var from the data store and will
+check it against value; if are equal it will skip the test
+with msg as the reason.
+"""
+
+attrs = ('var', 'value', 'msg')
+
+def setUpDecorator(self):
+msg = 'Checking if %r value is %r to skip test' % (self.var, 
self.value)
+self.logger.debug(msg)
+if self.case.td.get(self.var) == self.value:
+self.case.skipTest(self.msg)
+
+@registerDecorator
+class OETestDataDepends(OETestDecorator):
+attrs = ('td_depends',)
+
+def setUpDecorator(self):
+for v in self.td_depends:
+try:
+value = self.case.td[v]
+except KeyError:
+raise OEQAMissingVariable("Test case need %s variable but"\
+" isn't into td" % v)
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 06/55] oeqa/core/decorator: Add support for OETimeout decorator

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

The OETimeout provides support for specify certain timeout
in seconds for a test case, if the timeout is reach the SIGALRM
is sent and an exception is raised to notify the timeout.

[YOCTO #10235]

Signed-off-by: Mariano Lopez 
Signed-off-by: Aníbal Limón 
---
 meta/lib/oeqa/core/decorator/oetimeout.py | 25 +
 1 file changed, 25 insertions(+)
 create mode 100644 meta/lib/oeqa/core/decorator/oetimeout.py

diff --git a/meta/lib/oeqa/core/decorator/oetimeout.py 
b/meta/lib/oeqa/core/decorator/oetimeout.py
new file mode 100644
index 000..a247583
--- /dev/null
+++ b/meta/lib/oeqa/core/decorator/oetimeout.py
@@ -0,0 +1,25 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+import signal
+from . import OETestDecorator, registerDecorator
+from oeqa.core.exception import OEQATimeoutError
+
+@registerDecorator
+class OETimeout(OETestDecorator):
+attrs = ('oetimeout',)
+
+def setUpDecorator(self):
+timeout = self.oetimeout
+def _timeoutHandler(signum, frame):
+raise OEQATimeoutError("Timed out after %s "
+"seconds of execution" % timeout)
+
+self.logger.debug("Setting up a %d second(s) timeout" % self.oetimeout)
+self.alarmSignal = signal.signal(signal.SIGALRM, _timeoutHandler)
+signal.alarm(self.oetimeout)
+
+def tearDownDecorator(self):
+signal.alarm(0)
+signal.signal(signal.SIGALRM, self.alarmSignal)
+self.logger.debug("Removed SIGALRM handler")
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 09/55] scripts/oe-test: Add new oe-test script

2017-01-20 Thread Aníbal Limón
The new oe-test script will be use to run test components with
one single script.

The oe-test script search for test components inside meta/lib/oeqa,
the test components needs to implement OETestContextExecutor inside
context module in order to be supported by oe-test.

[YOCTO #10230]

Signed-off-by: Aníbal Limón 
Signed-off-by: Mariano Lopez 
---
 scripts/oe-test | 99 +
 1 file changed, 99 insertions(+)
 create mode 100755 scripts/oe-test

diff --git a/scripts/oe-test b/scripts/oe-test
new file mode 100755
index 000..5731dff
--- /dev/null
+++ b/scripts/oe-test
@@ -0,0 +1,99 @@
+#!/usr/bin/env python3
+
+# OpenEmbedded test tool
+#
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+import os
+import sys
+import argparse
+import importlib
+import logging
+
+scripts_path = os.path.dirname(os.path.realpath(__file__))
+lib_path = scripts_path + '/lib'
+sys.path = sys.path + [lib_path]
+import argparse_oe
+import scriptutils
+import scriptpath
+scriptpath.add_oe_lib_path()
+
+from oeqa.core.context import OETestContextExecutor
+
+logger = scriptutils.logger_create('oe-test')
+
+def _load_test_components(logger):
+components = {}
+
+for path in sys.path:
+base_dir = os.path.join(path, 'oeqa')
+if os.path.exists(base_dir) and os.path.isdir(base_dir):
+for file in os.listdir(base_dir):
+comp_name = file
+comp_context = os.path.join(base_dir, file, 'context.py')
+if os.path.exists(comp_context):
+comp_plugin = importlib.import_module('oeqa.%s.%s' % \
+(comp_name, 'context'))
+try:
+if not issubclass(comp_plugin._executor_class,
+OETestContextExecutor):
+raise TypeError("Component %s in %s, 
_executor_class "\
+"isn't derived from OETestContextExecutor."\
+% (comp_name, comp_context))
+
+components[comp_name] = comp_plugin._executor_class()
+except AttributeError:
+raise AttributeError("Component %s in %s don't have "\
+"_executor_class defined." % (comp_name, 
comp_context))
+
+return components
+
+def main():
+parser = argparse_oe.ArgumentParser(description="OpenEmbedded test tool",
+add_help=False,
+epilog="Use %(prog)s  
--help to get help on a specific command")
+parser.add_argument('-d', '--debug', help='Enable debug output', 
action='store_true')
+parser.add_argument('-q', '--quiet', help='Print only errors', 
action='store_true')
+global_args, unparsed_args = parser.parse_known_args()
+
+# Help is added here rather than via add_help=True, as we don't want it to
+# be handled by parse_known_args()
+parser.add_argument('-h', '--help', action='help', 
default=argparse.SUPPRESS,
+help='show this help message and exit')
+
+if global_args.debug:
+logger.setLevel(logging.DEBUG)
+elif global_args.quiet:
+logger.setLevel(logging.ERROR)
+
+components = _load_test_components(logger)
+
+subparsers = parser.add_subparsers(dest="subparser_name", 
title='subcommands', metavar='')
+subparsers.add_subparser_group('components', 'Test components')
+subparsers.required = True
+for comp_name in sorted(components.keys()):
+comp = components[comp_name]
+comp.register_commands(logger, subparsers)
+
+try:
+args = parser.parse_args(unparsed_args, namespace=global_args)
+results = args.func(logger, args)
+ret = 0 if results.wasSuccessful() else 1
+except SystemExit as err:
+if err.code != 0:
+raise err
+ret = err.code
+except argparse_oe.ArgumentUsageError as ae:
+parser.error_subcommand(ae.message, ae.subcommand)
+
+return ret
+
+if __name__ == '__main__':
+try:
+ret = main()
+except Exception:
+ret = 1
+import traceback
+traceback.print_exc()
+sys.exit(ret)
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 08/55] oeqa/core: Add tests for the OEQA framework

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

This test suite covers the current functionality for the OEQA
framework.

For run certain test suite,

$ cd meta/lib/oeqa/core/tests
$ ./test_data.py

Signed-off-by: Aníbal Limón 
Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/core/tests/__init__.py   |   0
 meta/lib/oeqa/core/tests/cases/data.py |  20 +++
 meta/lib/oeqa/core/tests/cases/depends.py  |  38 ++
 .../oeqa/core/tests/cases/loader/invalid/oeid.py   |  15 +++
 .../oeqa/core/tests/cases/loader/valid/another.py  |   9 ++
 meta/lib/oeqa/core/tests/cases/oeid.py |  18 +++
 meta/lib/oeqa/core/tests/cases/oetag.py|  18 +++
 meta/lib/oeqa/core/tests/cases/timeout.py  |  18 +++
 meta/lib/oeqa/core/tests/common.py |  35 ++
 meta/lib/oeqa/core/tests/test_data.py  |  51 
 meta/lib/oeqa/core/tests/test_decorators.py| 135 +
 meta/lib/oeqa/core/tests/test_loader.py|  86 +
 meta/lib/oeqa/core/tests/test_runner.py|  38 ++
 13 files changed, 481 insertions(+)
 create mode 100644 meta/lib/oeqa/core/tests/__init__.py
 create mode 100644 meta/lib/oeqa/core/tests/cases/data.py
 create mode 100644 meta/lib/oeqa/core/tests/cases/depends.py
 create mode 100644 meta/lib/oeqa/core/tests/cases/loader/invalid/oeid.py
 create mode 100644 meta/lib/oeqa/core/tests/cases/loader/valid/another.py
 create mode 100644 meta/lib/oeqa/core/tests/cases/oeid.py
 create mode 100644 meta/lib/oeqa/core/tests/cases/oetag.py
 create mode 100644 meta/lib/oeqa/core/tests/cases/timeout.py
 create mode 100644 meta/lib/oeqa/core/tests/common.py
 create mode 100755 meta/lib/oeqa/core/tests/test_data.py
 create mode 100755 meta/lib/oeqa/core/tests/test_decorators.py
 create mode 100755 meta/lib/oeqa/core/tests/test_loader.py
 create mode 100755 meta/lib/oeqa/core/tests/test_runner.py

diff --git a/meta/lib/oeqa/core/tests/__init__.py 
b/meta/lib/oeqa/core/tests/__init__.py
new file mode 100644
index 000..e69de29
diff --git a/meta/lib/oeqa/core/tests/cases/data.py 
b/meta/lib/oeqa/core/tests/cases/data.py
new file mode 100644
index 000..88003a6
--- /dev/null
+++ b/meta/lib/oeqa/core/tests/cases/data.py
@@ -0,0 +1,20 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+from oeqa.core.case import OETestCase
+from oeqa.core.decorator.oetag import OETestTag
+from oeqa.core.decorator.data import OETestDataDepends
+
+class DataTest(OETestCase):
+data_vars = ['IMAGE', 'ARCH']
+
+@OETestDataDepends(['MACHINE',])
+@OETestTag('dataTestOk')
+def testDataOk(self):
+self.assertEqual(self.td.get('IMAGE'), 'core-image-minimal')
+self.assertEqual(self.td.get('ARCH'), 'x86')
+self.assertEqual(self.td.get('MACHINE'), 'qemuarm')
+
+@OETestTag('dataTestFail')
+def testDataFail(self):
+pass
diff --git a/meta/lib/oeqa/core/tests/cases/depends.py 
b/meta/lib/oeqa/core/tests/cases/depends.py
new file mode 100644
index 000..17cdd90
--- /dev/null
+++ b/meta/lib/oeqa/core/tests/cases/depends.py
@@ -0,0 +1,38 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+from oeqa.core.case import OETestCase
+from oeqa.core.decorator.depends import OETestDepends
+
+class DependsTest(OETestCase):
+
+def testDependsFirst(self):
+self.assertTrue(True, msg='How is this possible?')
+
+@OETestDepends(['testDependsFirst'])
+def testDependsSecond(self):
+self.assertTrue(True, msg='How is this possible?')
+
+@OETestDepends(['testDependsSecond'])
+def testDependsThird(self):
+self.assertTrue(True, msg='How is this possible?')
+
+@OETestDepends(['testDependsSecond'])
+def testDependsFourth(self):
+self.assertTrue(True, msg='How is this possible?')
+
+@OETestDepends(['testDependsThird', 'testDependsFourth'])
+def testDependsFifth(self):
+self.assertTrue(True, msg='How is this possible?')
+
+@OETestDepends(['testDependsCircular3'])
+def testDependsCircular1(self):
+self.assertTrue(True, msg='How is this possible?')
+
+@OETestDepends(['testDependsCircular1'])
+def testDependsCircular2(self):
+self.assertTrue(True, msg='How is this possible?')
+
+@OETestDepends(['testDependsCircular2'])
+def testDependsCircular3(self):
+self.assertTrue(True, msg='How is this possible?')
diff --git a/meta/lib/oeqa/core/tests/cases/loader/invalid/oeid.py 
b/meta/lib/oeqa/core/tests/cases/loader/invalid/oeid.py
new file mode 100644
index 000..038d445
--- /dev/null
+++ b/meta/lib/oeqa/core/tests/cases/loader/invalid/oeid.py
@@ -0,0 +1,15 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+from oeqa.core.case import OETestCase
+
+class 

[OE-core] [PATCH 05/55] oeqa/core/decorator: Add support for OETestID and OETestTag

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

These two decorators stores certain TAG or ID for the test case
also provides support for filtering in loading step.

[YOCTO #10236]

Signed-off-by: Mariano Lopez 
Signed-off-by: Aníbal Limón 
---
 meta/lib/oeqa/core/decorator/oeid.py  | 23 +++
 meta/lib/oeqa/core/decorator/oetag.py | 24 
 2 files changed, 47 insertions(+)
 create mode 100644 meta/lib/oeqa/core/decorator/oeid.py
 create mode 100644 meta/lib/oeqa/core/decorator/oetag.py

diff --git a/meta/lib/oeqa/core/decorator/oeid.py 
b/meta/lib/oeqa/core/decorator/oeid.py
new file mode 100644
index 000..ea8017a
--- /dev/null
+++ b/meta/lib/oeqa/core/decorator/oeid.py
@@ -0,0 +1,23 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+from . import OETestFilter, registerDecorator
+from oeqa.core.utils.misc import intToList
+
+def _idFilter(oeid, filters):
+ return False if oeid in filters else True
+
+@registerDecorator
+class OETestID(OETestFilter):
+attrs = ('oeid',)
+
+def bind(self, registry, case):
+super(OETestID, self).bind(registry, case)
+
+def filtrate(self, filters):
+if filters.get('oeid'):
+filterx = intToList(filters['oeid'], 'oeid')
+del filters['oeid']
+if _idFilter(self.oeid, filterx):
+return True
+return False
diff --git a/meta/lib/oeqa/core/decorator/oetag.py 
b/meta/lib/oeqa/core/decorator/oetag.py
new file mode 100644
index 000..ad38ab7
--- /dev/null
+++ b/meta/lib/oeqa/core/decorator/oetag.py
@@ -0,0 +1,24 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+from . import OETestFilter, registerDecorator
+from oeqa.core.utils.misc import strToList
+
+def _tagFilter(tags, filters):
+return False if set(tags) & set(filters) else True
+
+@registerDecorator
+class OETestTag(OETestFilter):
+attrs = ('oetag',)
+
+def bind(self, registry, case):
+super(OETestTag, self).bind(registry, case)
+self.oetag = strToList(self.oetag, 'oetag')
+
+def filtrate(self, filters):
+if filters.get('oetag'):
+filterx = strToList(filters['oetag'], 'oetag')
+del filters['oetag']
+if _tagFilter(self.oetag, filterx):
+return True
+return False
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 03/55] oeqa/core: Add loader, context and decorator modules

2017-01-20 Thread Aníbal Limón
loader: Implements OETestLoader handling OETestDecorator
and filtering support when load tests. The OETestLoader is
responsible to set custom methods, attrs of the OEQA
frameowork.

[YOCTO #10231]
[YOCTO #10317]
[YOCTO #10353]

decorator: Add base class OETestDecorator to provide a common
way to define decorators to be used over OETestCase's, every
decorator has a method to be called when loading tests and
before test execution starts. Special decorators could be
implemented for filter tests on loading phase.

context: Provides HIGH level API for loadTests and runTests
of certain test component (i.e. runtime, sdk, selftest).

[YOCTO #10230]

Signed-off-by: Aníbal Limón 
Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/core/context.py| 148 +++
 meta/lib/oeqa/core/decorator/__init__.py |  71 ++
 meta/lib/oeqa/core/loader.py | 235 +++
 3 files changed, 454 insertions(+)
 create mode 100644 meta/lib/oeqa/core/context.py
 create mode 100644 meta/lib/oeqa/core/decorator/__init__.py
 create mode 100644 meta/lib/oeqa/core/loader.py

diff --git a/meta/lib/oeqa/core/context.py b/meta/lib/oeqa/core/context.py
new file mode 100644
index 000..cbab2f8
--- /dev/null
+++ b/meta/lib/oeqa/core/context.py
@@ -0,0 +1,148 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+import os
+import sys
+import json
+import time
+import logging
+import collections
+import re
+
+from oeqa.core.loader import OETestLoader
+from oeqa.core.runner import OETestRunner, OEStreamLogger, xmlEnabled
+
+class OETestContext(object):
+loaderClass = OETestLoader
+runnerClass = OETestRunner
+streamLoggerClass = OEStreamLogger
+
+files_dir = os.path.abspath(os.path.join(os.path.dirname(
+os.path.abspath(__file__)), "../files"))
+
+def __init__(self, td=None, logger=None):
+if not type(td) is dict:
+raise TypeError("td isn't dictionary type")
+
+self.td = td
+self.logger = logger
+self._registry = {}
+self._registry['cases'] = collections.OrderedDict()
+self._results = {}
+
+def _read_modules_from_manifest(self, manifest):
+if not os.path.exists(manifest):
+raise
+
+modules = []
+for line in open(manifest).readlines():
+line = line.strip()
+if line and not line.startswith("#"):
+modules.append(line)
+
+return modules
+
+def loadTests(self, module_paths, modules=[], tests=[],
+modules_manifest="", modules_required=[], filters={}):
+if modules_manifest:
+modules = self._read_modules_from_manifest(modules_manifest)
+
+self.loader = self.loaderClass(self, module_paths, modules, tests,
+modules_required, filters)
+self.suites = self.loader.discover()
+
+def runTests(self):
+streamLogger = self.streamLoggerClass(self.logger)
+self.runner = self.runnerClass(self, stream=streamLogger, verbosity=2)
+
+self._run_start_time = time.time()
+result = self.runner.run(self.suites)
+self._run_end_time = time.time()
+
+return result
+
+def logSummary(self, result, component, context_msg=''):
+self.logger.info("SUMMARY:")
+self.logger.info("%s (%s) - Ran %d test%s in %.3fs" % (component,
+context_msg, result.testsRun, result.testsRun != 1 and "s" or "",
+(self._run_end_time - self._run_start_time)))
+
+if result.wasSuccessful():
+msg = "%s - OK - All required tests passed" % component
+else:
+msg = "%s - FAIL - Required tests failed" % component
+skipped = len(self._results['skipped'])
+if skipped: 
+msg += " (skipped=%d)" % skipped
+self.logger.info(msg)
+
+def _getDetailsNotPassed(self, case, type, desc):
+found = False
+
+for (scase, msg) in self._results[type]:
+# XXX: When XML reporting is enabled scase is
+# xmlrunner.result._TestInfo instance instead of
+# string.
+if xmlEnabled:
+if case.id() == scase.test_id:
+found = True
+break
+scase_str = scase.test_id
+else:
+if case == scase:
+found = True
+break
+scase_str = str(scase)
+
+# When fails at module or class level the class name is passed as 
string
+# so figure out to see if match
+m = re.search("^setUpModule \((?P.*)\)$", scase_str)
+if m:
+if case.__class__.__module__ == m.group('module_name'):
+found = True
+break
+
+m = re.search("^setUpClass \((?P.*)\)$", scase_str)
+

[OE-core] [PATCH 01/55] oeqa/core: Add base OEQA framework

2017-01-20 Thread Aníbal Limón
case: Defines OETestCase base class that provides custom
methods/attrs defined by the framework.
Every OETestCase instance contains a reference to the test
data (d), the test context (tc) and the logger.
Also implements _oe{SetUp,TearDown}Class for make special
handling of OEQA decorators and validations.

runner: Defines OETestRunner/OETestResult with support for RAW
and XML result logs.

exception: Custom exceptions related to the OEQA framework based
on class OEQAException.

[YOCTO #10230]
[YOCTO #10233]

Signed-off-by: Aníbal Limón 
Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/core/__init__.py  |  0
 meta/lib/oeqa/core/case.py  | 46 +
 meta/lib/oeqa/core/exception.py | 14 
 meta/lib/oeqa/core/runner.py| 76 +
 4 files changed, 136 insertions(+)
 create mode 100644 meta/lib/oeqa/core/__init__.py
 create mode 100644 meta/lib/oeqa/core/case.py
 create mode 100644 meta/lib/oeqa/core/exception.py
 create mode 100644 meta/lib/oeqa/core/runner.py

diff --git a/meta/lib/oeqa/core/__init__.py b/meta/lib/oeqa/core/__init__.py
new file mode 100644
index 000..e69de29
diff --git a/meta/lib/oeqa/core/case.py b/meta/lib/oeqa/core/case.py
new file mode 100644
index 000..d2dbf20
--- /dev/null
+++ b/meta/lib/oeqa/core/case.py
@@ -0,0 +1,46 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+import unittest
+
+from oeqa.core.exception import OEQAMissingVariable
+
+def _validate_td_vars(td, td_vars, type_msg):
+if td_vars:
+for v in td_vars:
+if not v in td:
+raise OEQAMissingVariable("Test %s need %s variable but"\
+" isn't into td" % (type_msg, v))
+
+class OETestCase(unittest.TestCase):
+# TestContext and Logger instance set by OETestLoader.
+tc = None
+logger = None
+
+# td has all the variables needed by the test cases
+# is the same across all the test cases.
+td = None
+
+# td_vars has the variables needed by a test class
+# or test case instance, if some var isn't into td a
+# OEMissingVariable exception is raised
+td_vars = None
+
+@classmethod
+def _oeSetUpClass(clss):
+_validate_td_vars(clss.td, clss.td_vars, "class")
+clss.setUpClassMethod()
+
+@classmethod
+def _oeTearDownClass(clss):
+clss.tearDownClassMethod()
+
+def _oeSetUp(self):
+for d in self.decorators:
+d.setUpDecorator()
+self.setUpMethod()
+
+def _oeTearDown(self):
+for d in self.decorators:
+d.tearDownDecorator()
+self.tearDownMethod()
diff --git a/meta/lib/oeqa/core/exception.py b/meta/lib/oeqa/core/exception.py
new file mode 100644
index 000..2dfd840
--- /dev/null
+++ b/meta/lib/oeqa/core/exception.py
@@ -0,0 +1,14 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+class OEQAException(Exception):
+pass
+
+class OEQATimeoutError(OEQAException):
+pass
+
+class OEQAMissingVariable(OEQAException):
+pass
+
+class OEQADependency(OEQAException):
+pass
diff --git a/meta/lib/oeqa/core/runner.py b/meta/lib/oeqa/core/runner.py
new file mode 100644
index 000..8f5af57
--- /dev/null
+++ b/meta/lib/oeqa/core/runner.py
@@ -0,0 +1,76 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+import os
+import time
+import unittest
+import logging
+
+xmlEnabled = False
+try:
+import xmlrunner
+from xmlrunner.result import _XMLTestResult as _TestResult
+from xmlrunner.runner import XMLTestRunner as _TestRunner
+xmlEnabled = True
+except ImportError:
+# use the base runner instead
+from unittest import TextTestResult as _TestResult
+from unittest import TextTestRunner as _TestRunner
+
+class OEStreamLogger(object):
+def __init__(self, logger):
+self.logger = logger
+self.buffer = ""
+
+def write(self, msg):
+if msg[-1] != '\n':
+self.buffer += msg
+else:
+self.logger.log(logging.INFO, self.buffer.rstrip("\n"))
+self.buffer = ""
+
+def flush(self):
+for handler in self.logger.handlers:
+handler.flush()
+
+class OETestResult(_TestResult):
+def __init__(self, tc, *args, **kwargs):
+super(OETestResult, self).__init__(*args, **kwargs)
+
+self.tc = tc
+
+self.tc._results['failures'] = self.failures
+self.tc._results['errors'] = self.errors
+self.tc._results['skipped'] = self.skipped
+self.tc._results['expectedFailures'] = self.expectedFailures
+
+def startTest(self, test):
+super(OETestResult, self).startTest(test)
+
+class OETestRunner(_TestRunner):
+def __init__(self, tc, *args, **kwargs):
+if xmlEnabled:
+if not 

[OE-core] [PATCH 04/55] oeqa/core/decorator: Add support for OETestDepends

2017-01-20 Thread Aníbal Limón
The OETestDepends decorator could be used over test cases to
define some dependency between them.

At loading time sorting the tests to grauntee that a test case
executes before also raise an exception if found a circular
dependency between test cases.

At before test case run reviews if the dependency if meet, in the
case of don't it skips the test case run.

Signed-off-by: Aníbal Limón 
Signed-off-by: Mariano Lopez 
---
 meta/lib/oeqa/core/decorator/depends.py | 94 +
 1 file changed, 94 insertions(+)
 create mode 100644 meta/lib/oeqa/core/decorator/depends.py

diff --git a/meta/lib/oeqa/core/decorator/depends.py 
b/meta/lib/oeqa/core/decorator/depends.py
new file mode 100644
index 000..195711c
--- /dev/null
+++ b/meta/lib/oeqa/core/decorator/depends.py
@@ -0,0 +1,94 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+from unittest import SkipTest
+
+from oeqa.core.exception import OEQADependency
+
+from . import OETestDiscover, registerDecorator
+
+def _add_depends(registry, case, depends):
+module_name = case.__module__
+class_name = case.__class__.__name__
+
+case_id = case.id()
+
+for depend in depends:
+dparts = depend.split('.')
+
+if len(dparts) == 1:
+depend_id = ".".join((module_name, class_name, dparts[0]))
+elif len(dparts) == 2:
+depend_id = ".".join((module_name, dparts[0], dparts[1]))
+else:
+depend_id = depend
+
+if not case_id in registry:
+registry[case_id] = []
+if not depend_id in registry[case_id]:
+registry[case_id].append(depend_id)
+
+def _validate_test_case_depends(cases, depends):
+for case in depends:
+if not case in cases:
+continue
+for dep in depends[case]:
+if not dep in cases:
+raise OEQADependency("TestCase %s depends on %s and isn't 
available"\
+   ", cases available %s." % (case, dep, 
str(cases.keys(
+
+def _order_test_case_by_depends(cases, depends):
+def _dep_resolve(graph, node, resolved, seen):
+seen.append(node)
+for edge in graph[node]:
+if edge not in resolved:
+if edge in seen:
+raise OEQADependency("Test cases %s and %s have a 
circular" \
+   " dependency." % (node, edge))
+_dep_resolve(graph, edge, resolved, seen)
+resolved.append(node)
+
+dep_graph = {}
+dep_graph['__root__'] = cases.keys()
+for case in cases:
+if case in depends:
+dep_graph[case] = depends[case]
+else:
+dep_graph[case] = []
+
+cases_ordered = []
+_dep_resolve(dep_graph, '__root__', cases_ordered, [])
+cases_ordered.remove('__root__')
+
+return [cases[case_id] for case_id in cases_ordered]
+
+def _skipTestDependency(case, depends):
+results = case.tc._results
+skipReasons = ['errors', 'failures', 'skipped']
+
+for reason in skipReasons:
+for test, _ in results[reason]:
+if test.id() in depends:
+raise SkipTest("Test case %s depends on %s and was in %s." \
+% (case.id(), test.id(), reason))
+
+@registerDecorator
+class OETestDepends(OETestDiscover):
+attrs = ('depends',)
+
+def bind(self, registry, case):
+super(OETestDepends, self).bind(registry, case)
+if not registry.get('depends'):
+registry['depends'] = {}
+_add_depends(registry['depends'], case, self.depends)
+
+@staticmethod
+def discover(registry):
+if registry.get('depends'):
+_validate_test_case_depends(registry['cases'], registry['depends'])
+return _order_test_case_by_depends(registry['cases'], 
registry['depends'])
+else:
+return [registry['cases'][case_id] for case_id in 
registry['cases']]
+
+def setUpDecorator(self):
+_skipTestDependency(self.case, self.depends)
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 02/55] oeqa/core: Add utils module for OEQA framework

2017-01-20 Thread Aníbal Limón
From: Mariano Lopez 

misc: Functions for transform object to other types.
path: Functions for path handling.
test: Functions for operations related to test cases and suites.

[YOCTO #10232]

Signed-off-by: Mariano Lopez 
Signed-off-by: Aníbal Limón 
---
 meta/lib/oeqa/core/utils/__init__.py |  0
 meta/lib/oeqa/core/utils/misc.py | 37 +++
 meta/lib/oeqa/core/utils/path.py | 19 ++
 meta/lib/oeqa/core/utils/test.py | 71 
 4 files changed, 127 insertions(+)
 create mode 100644 meta/lib/oeqa/core/utils/__init__.py
 create mode 100644 meta/lib/oeqa/core/utils/misc.py
 create mode 100644 meta/lib/oeqa/core/utils/path.py
 create mode 100644 meta/lib/oeqa/core/utils/test.py

diff --git a/meta/lib/oeqa/core/utils/__init__.py 
b/meta/lib/oeqa/core/utils/__init__.py
new file mode 100644
index 000..e69de29
diff --git a/meta/lib/oeqa/core/utils/misc.py b/meta/lib/oeqa/core/utils/misc.py
new file mode 100644
index 000..6ae58ad
--- /dev/null
+++ b/meta/lib/oeqa/core/utils/misc.py
@@ -0,0 +1,37 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+def toList(obj, obj_type, obj_name="Object"):
+if isinstance(obj, obj_type):
+return [obj]
+elif isinstance(obj, list):
+return obj
+else:
+raise TypeError("%s must be %s or list" % (obj_name, obj_type))
+
+def toSet(obj, obj_type, obj_name="Object"):
+if isinstance(obj, obj_type):
+return {obj}
+elif isinstance(obj, list):
+return set(obj)
+elif isinstance(obj, set):
+return obj
+else:
+raise TypeError("%s must be %s or set" % (obj_name, obj_type))
+
+def strToList(obj, obj_name="Object"):
+return toList(obj, str, obj_name)
+
+def strToSet(obj, obj_name="Object"):
+return toSet(obj, str, obj_name)
+
+def intToList(obj, obj_name="Object"):
+return toList(obj, int, obj_name)
+
+def dataStoteToDict(d, variables):
+data = {}
+
+for v in variables:
+data[v] = d.getVar(v, True)
+
+return data
diff --git a/meta/lib/oeqa/core/utils/path.py b/meta/lib/oeqa/core/utils/path.py
new file mode 100644
index 000..a21caad
--- /dev/null
+++ b/meta/lib/oeqa/core/utils/path.py
@@ -0,0 +1,19 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+import os
+import sys
+
+def findFile(file_name, directory):
+"""
+Search for a file in directory and returns its complete path.
+"""
+for r, d, f in os.walk(directory):
+if file_name in f:
+return os.path.join(r, file_name)
+return None
+
+def remove_safe(path):
+if os.path.exists(path):
+os.remove(path)
+
diff --git a/meta/lib/oeqa/core/utils/test.py b/meta/lib/oeqa/core/utils/test.py
new file mode 100644
index 000..820b997
--- /dev/null
+++ b/meta/lib/oeqa/core/utils/test.py
@@ -0,0 +1,71 @@
+# Copyright (C) 2016 Intel Corporation
+# Released under the MIT license (see COPYING.MIT)
+
+import os
+import unittest
+
+def getSuiteCases(suite):
+"""
+Returns individual test from a test suite.
+"""
+tests = []
+for item in suite:
+if isinstance(item, unittest.suite.TestSuite):
+tests.extend(getSuiteCases(item))
+elif isinstance(item, unittest.TestCase):
+tests.append(item)
+return tests
+
+def getSuiteModules(suite):
+"""
+Returns modules in a test suite.
+"""
+modules = set()
+for test in getSuiteCases(suite):
+modules.add(getCaseModule(test))
+return modules
+
+def getSuiteCasesInfo(suite, func):
+"""
+Returns test case info from suite. Info is fetched from func.
+"""
+tests = []
+for test in getSuiteCases(suite):
+tests.append(func(test))
+return tests
+
+def getSuiteCasesNames(suite):
+"""
+Returns test case names from suite.
+"""
+return getSuiteCasesInfo(suite, getCaseMethod)
+
+def getSuiteCasesIDs(suite):
+"""
+Returns test case ids from suite.
+"""
+return getSuiteCasesInfo(suite, getCaseID)
+
+def getCaseModule(test_case):
+"""
+Returns test case module name.
+"""
+return test_case.__module__
+
+def getCaseClass(test_case):
+"""
+Returns test case class name.
+"""
+return test_case.__class__.__name__
+
+def getCaseID(test_case):
+"""
+Returns test case complete id.
+"""
+return test_case.id()
+
+def getCaseMethod(test_case):
+"""
+Returns test case method name.
+"""
+return getCaseID(test_case).split('.')[-1]
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 00/55] OEQA Framework Refactor & Improvements

2017-01-20 Thread Aníbal Limón
This patchset is related to OEQA Framework for details read the RFC send to the
Openembedded architecture ML.

http://lists.openembedded.org/pipermail/openembedded-architecture/2016-December/000351.html

Also adds the migration of the runtime testing leaving only selftest remains
to migrate.

The testing was made using GDC Autobuilder building in different archs and 
running selftest.

The following changes since commit b47ecf28775830efab423fa12f0addb68671cc06:

  poky.ent: Added "pip3" as an essential host installation package (2017-01-20 
11:57:25 +)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib alimon/oeqa_runtime_migration
  
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=alimon/oeqa_runtime_migration

Aníbal Limón (31):
  oeqa/core: Add base OEQA framework
  oeqa/core: Add loader, context and decorator modules
  oeqa/core/decorator: Add support for OETestDepends
  oeqa/core/decorator: Add support for OETestDataDepends and
skipIfDataVar
  scripts/oe-test: Add new oe-test script
  oeqa/core/context: Add support of OETestContextExecutor
  oeqa/core/cases: Add example test cases
  oeqa/core: Add README
  oe/data: Add export2json function
  classes/rootfs-postcommands: Add write_image_test_data
  classes/populate_sdk_base: Add write_sdk_test_data to postprocess
  oeqa: Move common files to oeqa/files instead of runtime only
  oeqa/sdk: Move test cases inside cases directory
  oeqa/{runtime,sdk}/files: Move testsdkmakefile from runtime to sdk
module
  oeqa/sdk: Add case and context modules for the SDK component
  classes/testsdk: Migrates testsdk.bbclass to use new OESDKTestContext
  oeqa/utils: Move targetbuild to buildproject module
  oeqa/utils: {Target,SDK,}BuildProject remove dependency of bb
  oeqa/sdk/cases: Migrate tests to the new OEQA framework
  classes/testsdk: Remove the need of TEST_LOG_DIR variable
  oeqa/sdkext: Move test cases inside cases directory
  oeqa/sdkext: Adds case and context modules.
  classes/testsdk: Migrate to use the new OESDKExtTestContext
  oeqa/sdkext/cases: Migrate test case to new OEQA framework
  oeqa/runtime: Fix TargetBuildProject instances
  oeqa: Fix files handling on runtime tests.
  oeqa/runtime: Move to runtime_cases
  oeqa/runtime/context: Add runtime option group and options for target
type and server ip.
  oeqa/runtime/context: Move helper functions for process args to
executor
  oeqa/utils/dump: Move get_host_dumper to OERuntimeTestContextExecutor
class
  oeqa/runtime/context.py: Prepare for qemu

Mariano Lopez (24):
  oeqa/core: Add utils module for OEQA framework
  oeqa/core/decorator: Add support for OETestID and OETestTag
  oeqa/core/decorator: Add support for OETimeout decorator
  oeqa/core: Add tests for the OEQA framework
  oeqa/utils/__init__.py: Adds compatibility with bitbake logger
  oeqa/core/target Add OESSHTarget to sent commands to targets using SSH
  oeqa/runtime: Add case, context and loader classes for runtime testing
  oeqa/runtime: Add OEHasPackage decorator
  oeqa/core/decorator/data.py: Add skipIfNotFeature decorator
  oeqa/runtime/files: Move runtime files from old directory
  oeqa/runtime/utils/targetbuildproject.py: Don't use more than 80
characters per line
  oeqa/core/decorator: Add skipIfNotDataVar and skipIfNotInDataVar
  oeqa/core/context: Add option to select tests to run
  oeqa/runtime/context.py: Add logger to getTarget
  core/target/qemu.py Adds qemu target
  testimage.bbclass: Migrate class to use new runtime framework
  oeqa/runtime/cases: Migrate runtime tests.
  runtime/cases/smart.py: Migrate smart tests
  oeqa/core/utils/test.py: Add functions to get module path
  testimage.bbclass: Add support for package extraction
  testimage.bbclass: Add package install feature
  oeqa/runtime/context.py: Add defaults for runtime context
  testexport.bbclass: Migrate testexport to use new framework
  selftest/runtime-test.py: Adapt test to use new runtime framework

 .../lib/oeqa/runtime/{ => cases}/selftest.json |   0
 .../lib/oeqa/runtime/{ => cases}/selftest.py   |  34 +--
 meta/classes/populate_sdk_base.bbclass |   9 +-
 meta/classes/rootfs-postcommands.bbclass   |  18 ++
 meta/classes/testexport.bbclass| 211 +++-
 meta/classes/testimage.bbclass | 263 
 meta/classes/testsdk.bbclass   | 167 +++--
 meta/lib/oe/data.py|  28 +++
 meta/lib/oeqa/core/README  |  38 +++
 meta/lib/oeqa/core/__init__.py |   0
 meta/lib/oeqa/core/case.py |  46 
 meta/lib/oeqa/core/cases/__init__.py   |   0
 meta/lib/oeqa/core/cases/example/data.json |   1 +
 meta/lib/oeqa/core/cases/example/test_basic.py |  20 ++
 meta/lib/oeqa/core/context.py  | 239 ++
 meta/lib/oeqa/core/decorator/__init__.py  

Re: [OE-core] [PATCH v2 1/3] ccache.bbclass: enable max size setup for ccache dir

2017-01-20 Thread Yannick GICQUEL
Hi,

Some comments inline below (with oe-list this time),

Regards,

2017-01-20 17:23 GMT+01:00 Yannick GICQUEL :
> 2017-01-19 20:02 GMT+01:00 Andre McCurdy :
>> On Thu, Jan 19, 2017 at 7:01 AM, Yannick Gicquel
>>  wrote:
>>> ccache directories are limited to 1G by default.
>>
>> 1G has been the default for a long time, so maybe it's time to propose
>> an upstream change to increase, e.g. to 10G, giving the size of the
>> webkitgtk build as justification?
>
> You are right, 1GB was the default cache size limit in old versions
> and it's up to 5GB since release 3.2 [1].
>
>>
>> Since we build ccache-native within oe-core, any such patch could be
>> applied to our version of ccache right now (ie we don't need to wait
>> for it to be accepted and merged upstream).
>
> Current ccache.bbclass implementation is using the host ccache, so the
> default limit can be different depending on the version deployed on
> host distro. The point is that even if we use ccache-native, their
> still will be a default size limit set.
> Even if 5GB (or 10GB) limit should fit the webkitgtk cache size
> requirements, some other recipes can require more space to gain full
> benefit of the ccache (e.g. chromium from meta-browser) and for those
> it can be useful to tune the size.
>
> Does it make sense?
>
> Yannick
>
> [1]: https://ccache.samba.org/releasenotes.html#_ccache_3_2
>
>>
>>> This patch enables the configuration of their limits, and as default
>>> location is TMPDIR, it proposes a size limit to "0" (unlimited).
>>>
>>> The setup can be overloaded in local.conf by setting
>>> CCACHE_MAX_SIZE to a custom value if needed.
>>>
>>> Signed-off-by: Yannick Gicquel 
>>> ---
>>>  meta/classes/ccache.bbclass | 8 
>>>  1 file changed, 8 insertions(+)
>>>
>>> diff --git a/meta/classes/ccache.bbclass b/meta/classes/ccache.bbclass
>>> index 93fcaca..b6643a1 100644
>>> --- a/meta/classes/ccache.bbclass
>>> +++ b/meta/classes/ccache.bbclass
>>> @@ -1,6 +1,14 @@
>>>  CCACHE = "${@bb.utils.which(d.getVar('PATH'), 'ccache') and 'ccache '}"
>>>  export CCACHE_DIR ?= "${TMPDIR}/ccache/${MULTIMACH_HOST_SYS}/${PN}"
>>>  CCACHE_DISABLE[unexport] = "1"
>>> +CCACHE_MAX_SIZE ?= "0"
>>>
>>>  do_configure[dirs] =+ "${CCACHE_DIR}"
>>>  do_kernel_configme[dirs] =+ "${CCACHE_DIR}"
>>> +
>>> +ccache_init() {
>>> +if [ -n "${CCACHE}" ]; then
>>> +${CCACHE} -M ${CCACHE_MAX_SIZE}
>>> +fi
>>> +}
>>> +do_configure[postfuncs] += "ccache_init"
>>> --
>>> 1.9.1
>>>
>>> --
>>> ___
>>> Openembedded-core mailing list
>>> Openembedded-core@lists.openembedded.org
>>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [morty] backport request: nspr: set correct version in pkg-config file

2017-01-20 Thread akuster808



On 01/20/2017 04:34 AM, Max Krummenacher wrote:

Hi

Can we backport the following commit to morty?

got it.
Thanks,
Armin

http://cgit.openembedded.org/openembedded-core/commit/?id=cb4f5ecf32006192baaf41218a3d7b43ca1c2951

It fixes pkgconfig to no longer report an old version.

Currently this breaks firefox in meta-browser morty branch.

Thanks
Max


--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH v4 02/12] acpica: work around flex 2.6.2 code generation issue

2017-01-20 Thread Patrick Ohly
On Fri, 2017-01-20 at 15:12 +0100, Patrick Ohly wrote:
> Without this patch, linking fails with a missing implementation of
> yy_scan_string. This looks like a regression in flex, because 2.6.0 generated
> different code that called PrParser_scan_string
> resp. DtParser_scan_string.
> 
> Working around that in acpica until this is better understood or fixed
> in flex is the easiest solution for now.

It turned out that flex 2.6.3 has a fix for the problem. But the github
issue tracker for flex has several people who reported issues with 2.6.3
(affecting gdb, binutils, grub) that we probably should wait a bit
before trying to update to that release.

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.



-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] $50 bounty for an OE recipe for libfilesys-smbclient-perl. seriously.

2017-01-20 Thread Tim Orling
On Fri, Jan 20, 2017 at 3:52 AM, Robert P. J. Day 
wrote:

>
>   the earlier note from ross i had totally forgotten about ...
>
> On Tue, 20 Dec 2016, Burton, Ross wrote:
>
> > FWIW I had a quick look at this.  I'm certainly no perl guru and can
> > barely understand it, but it does *so much* wrong that if you really
> > need this then it would be easier to just rewrite the makefile.pl
> > from scratch.  Once you remove the hunting for the headers in the
> > wrong place, it then invokes an autoconf script...  which needs to
> > be passed the right options.
> >
> > Do you really need this module?  It's not been updated for many
> > years, so surely there's something better.
>
>   and that's the question ... is there something better? is there not
> a single person who needs this feature in their OE/YP build? perhaps
> not. maybe i really do need to hire a contractor to take care of this.
>
>
In my mind the question is deeper than that. The question is "is there not
a single person who needs this feature in perl?". The upstream is the
problem. It is just not ready to cross-compile.

--Tim

> rday
>
> --
>
> 
> Robert P. J. Day Ottawa, Ontario, CANADA
> http://crashcourse.ca
>
> Twitter:   http://twitter.com/rpjday
> LinkedIn:   http://ca.linkedin.com/in/rpjday
> 
>
> --
> ___
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 1/2] utils: Factor out common multilib datastore creation function

2017-01-20 Thread Richard Purdie
This code is already used in two places and we need it in others so
turn it into its own function.

Signed-off-by: Richard Purdie 
---
 meta/classes/utils.bbclass | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass
index d834a8a..549e4b8 100644
--- a/meta/classes/utils.bbclass
+++ b/meta/classes/utils.bbclass
@@ -349,6 +349,14 @@ def multilib_pkg_extend(d, pkg):
 pkgs = pkgs + " " + v + "-" + pkg
 return pkgs
 
+def get_multilib_datastore(variant, d):
+localdata = bb.data.createCopy(d)
+overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" 
+ variant
+localdata.setVar("OVERRIDES", overrides)
+localdata.setVar("MLPREFIX", variant + "-")
+bb.data.update_data(localdata)
+return localdata
+
 def all_multilib_tune_values(d, var, unique = True, need_split = True, delim = 
' '):
 """Return a string of all ${var} in all multilib tune configuration"""
 values = []
@@ -361,11 +369,7 @@ def all_multilib_tune_values(d, var, unique = True, 
need_split = True, delim = '
 values.append(value)
 variants = d.getVar("MULTILIB_VARIANTS") or ""
 for item in variants.split():
-localdata = bb.data.createCopy(d)
-overrides = localdata.getVar("OVERRIDES", False) + 
":virtclass-multilib-" + item
-localdata.setVar("OVERRIDES", overrides)
-localdata.setVar("MLPREFIX", item + "-")
-bb.data.update_data(localdata)
+localdata = get_multilib_datastore(item, d)
 value = localdata.getVar(var) or ""
 if value != "":
 if need_split:
@@ -411,11 +415,7 @@ def all_multilib_tune_list(vars, d):
 values[v].append(localdata.getVar(v))
 variants = d.getVar("MULTILIB_VARIANTS") or ""
 for item in variants.split():
-localdata = bb.data.createCopy(d)
-overrides = localdata.getVar("OVERRIDES", False) + 
":virtclass-multilib-" + item
-localdata.setVar("OVERRIDES", overrides)
-localdata.setVar("MLPREFIX", item + "-")
-bb.data.update_data(localdata)
+localdata = get_multilib_datastore(item, d)
 values[v].append(localdata.getVar(v))
 values['ml'].append(item)
 return values
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 2/2] meta-environment: Ensure all multilib dependencies are accounted for

2017-01-20 Thread Richard Purdie
Currently the recipe depends on the mulitlib libcs all being built
but the dependencies don't account for this. Fix the DEPENDS so
that the requires pieces are all built first rather than relying on
luck.

Signed-off-by: Richard Purdie 
---
 meta/recipes-core/meta/meta-environment.bb | 4 
 1 file changed, 4 insertions(+)

diff --git a/meta/recipes-core/meta/meta-environment.bb 
b/meta/recipes-core/meta/meta-environment.bb
index a250cc8..a2ed229 100644
--- a/meta/recipes-core/meta/meta-environment.bb
+++ b/meta/recipes-core/meta/meta-environment.bb
@@ -19,6 +19,10 @@ SDKTARGETSYSROOT = 
"${SDKPATH}/sysroots/${REAL_MULTIMACH_TARGET_SYS}"
 
 inherit cross-canadian
 
+# Need to ensure we have the virtual mappings and site files for all multtilib 
+# variants
+DEPENDS += "${@all_multilib_tune_values(d, 'TOOLCHAIN_NEED_CONFIGSITE_CACHE')}"
+
 do_generate_content[cleandirs] = "${SDK_OUTPUT}"
 do_generate_content[dirs] = "${SDK_OUTPUT}/${SDKPATH}"
 python do_generate_content() {
-- 
2.7.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] ✗ patchtest: failure for UEFI + Secure Boot + qemu (rev5)

2017-01-20 Thread Patchwork
== Series Details ==

Series: UEFI + Secure Boot + qemu (rev5)
Revision: 5
URL   : https://patchwork.openembedded.org/series/4506/
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 failures:



* Issue A patch file has been added, but does not have a 
Signed-off-by tag [test_signed_off_by_presence] 
  Suggested fixSign off the added patch file 
(meta/recipes-extended/acpica/acpitests/aapits-linux.patch)

* Issue Added patch file is missing Upstream-Status in the header 
[test_upstream_status_presence] 
  Suggested fixAdd Upstream-Status:  to the header of 
meta/recipes-extended/acpica/acpitests/aapits-linux.patch (possible values: 
Pending, Submitted, Accepted, Backport, Denied, Inappropriate)



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

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v4 03/12] ovmf: move from meta-luv to OE-core

2017-01-20 Thread Patrick Ohly
From: meta-luv 

This is an unmodified copy of
github.com/01org/luv-yocto/meta-luv/recipes-core/ovmf revision
4be4329.

Signed-off-by: Patrick Ohly 
---
 
meta/recipes-core/ovmf/ovmf/0001-BaseTools-Force-tools-variables-to-host-toolchain.patch
   |  48 +-
 meta/recipes-core/ovmf/ovmf/0001-OvmfPkg-Enable-BGRT-in-OVMF.patch 
| 110 
+-
 meta/recipes-core/ovmf/ovmf/0002-ovmf-update-path-to-native-BaseTools.patch
|  32 +++-
 
meta/recipes-core/ovmf/ovmf/0003-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch
 |  39 +++-
 meta/recipes-core/ovmf/ovmf_git.bb 
| 121 
-
 5 files changed, 350 insertions(+)
 create mode 100644 
meta/recipes-core/ovmf/ovmf/0001-BaseTools-Force-tools-variables-to-host-toolchain.patch
 create mode 100644 
meta/recipes-core/ovmf/ovmf/0001-OvmfPkg-Enable-BGRT-in-OVMF.patch
 create mode 100644 
meta/recipes-core/ovmf/ovmf/0002-ovmf-update-path-to-native-BaseTools.patch
 create mode 100644 
meta/recipes-core/ovmf/ovmf/0003-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch
 create mode 100644 meta/recipes-core/ovmf/ovmf_git.bb

diff --git 
a/meta/recipes-core/ovmf/ovmf/0001-BaseTools-Force-tools-variables-to-host-toolchain.patch
 
b/meta/recipes-core/ovmf/ovmf/0001-BaseTools-Force-tools-variables-to-host-toolchain.patch
new file mode 100644
index 000..644b99d
--- /dev/null
+++ 
b/meta/recipes-core/ovmf/ovmf/0001-BaseTools-Force-tools-variables-to-host-toolchain.patch
@@ -0,0 +1,48 @@
+From 6e24bde1979c2d7149b37d142fb882dfde0e9770 Mon Sep 17 00:00:00 2001
+From: Matt Fleming 
+Date: Fri, 27 Jun 2014 11:12:18 +0100
+Subject: [PATCH] BaseTools: Force tools variables to host toolchain
+
+Signed-off-by: Matt Fleming 
+---
+ BaseTools/Source/C/Makefiles/app.makefile | 7 +++
+ BaseTools/Source/C/VfrCompile/GNUmakefile | 5 +
+ 2 files changed, 12 insertions(+)
+
+diff --git a/BaseTools/Source/C/Makefiles/app.makefile 
b/BaseTools/Source/C/Makefiles/app.makefile
+index 19269a1..62aad0f 100644
+--- a/BaseTools/Source/C/Makefiles/app.makefile
 b/BaseTools/Source/C/Makefiles/app.makefile
+@@ -16,6 +16,13 @@ include $(MAKEROOT)/Makefiles/header.makefile
+ 
+ APPLICATION = $(MAKEROOT)/bin/$(APPNAME)
+ 
++CC = gcc
++CXX = g++
++AS = gcc
++AR = ar
++LD = ld
++LINKER = $(CC)
++
+ .PHONY:all
+ all: $(MAKEROOT)/bin $(APPLICATION) 
+ 
+diff --git a/BaseTools/Source/C/VfrCompile/GNUmakefile 
b/BaseTools/Source/C/VfrCompile/GNUmakefile
+index 82005e1..5ac5f7e 100644
+--- a/BaseTools/Source/C/VfrCompile/GNUmakefile
 b/BaseTools/Source/C/VfrCompile/GNUmakefile
+@@ -26,6 +26,11 @@ OBJECTS = AParser.o DLexerBase.o ATokenBuffer.o 
EfiVfrParser.o VfrLexer.o VfrSyn
+ 
+ VFR_CPPFLAGS = -DPCCTS_USE_NAMESPACE_STD $(CPPFLAGS)
+ 
++CC = gcc
++CXX = g++
++AS = gcc
++AR = ar
++LD = ld
+ LINKER = $(BUILD_CXX)
+ 
+ EXTRA_CLEAN_OBJECTS = EfiVfrParser.cpp EfiVfrParser.h VfrParser.dlg 
VfrTokens.h VfrLexer.cpp VfrLexer.h VfrSyntax.cpp tokens.h
+-- 
+1.9.0
+
diff --git a/meta/recipes-core/ovmf/ovmf/0001-OvmfPkg-Enable-BGRT-in-OVMF.patch 
b/meta/recipes-core/ovmf/ovmf/0001-OvmfPkg-Enable-BGRT-in-OVMF.patch
new file mode 100644
index 000..4531a6d
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf/0001-OvmfPkg-Enable-BGRT-in-OVMF.patch
@@ -0,0 +1,110 @@
+From 66a4020c3c2163aeffc9757851f33c346ecfd870 Mon Sep 17 00:00:00 2001
+From: Sai Praneeth Prakhya 
+Date: Mon, 4 Apr 2016 12:15:12 -0700
+Subject: [PATCH] OvmfPkg: Enable BGRT in OVMF
+
+By default, firmware (OVMF - Open source Virtual Machine Firmware)
+never publishes BGRT (Boot Graphics Resource Table) and in the boot
+process Linux kernel checks for this table and if it fails to find BGRT
+table then corresponding code in Linux kernel is not executed. EDK II
+(EFI Development Kit, thus OVMF) already has BGRT source code packaged
+into it but it is excluded from the build process of OVMF. These changes
+to build system of OVMF enables BGRT in 32-bit and 64-bit OVMF.
+
+There are only two files that need to be modified in order to do this.
+The first one being OvmfPkg*.dsc (this file describes the platform) and
+the second one being OvmfPkg*.fdf (this file describes firmware descriptor
+volume). A *.inf file (here "BootGraphicsResourceTableDxe.inf")
+describes a module (here BGRT). So, include
+"BootGraphicsResourceTableDxe.inf" file in "OvmfPkg*.dsc" so that BGRT
+source code will be compiled and "BootGraphicsResourceTableDxe.efi" file
+is generated and we should also include
+"BootGraphicsResourceTableDxe.inf" file in "OvmfPkg*.fdf" file so that
+"BootGraphicsResourceTableDxe.efi" will be placed in a firmware volume
+and thus gets 

[OE-core] [PATCH v4 09/12] runqemu: also accept -image suffix for rootfs parameter

2017-01-20 Thread Patrick Ohly
The magic detection of the rootfs parameter only worked for image
recipes which embedd the "image" string in the middle, as in
"core-image-minimal".

Sometimes it is more natural to call an image "something-image". To
get such an image detected by runqemu, "-image" at the end of a
parameter must also cause that parameter to be treated as the rootfs
parameter.

Inside the image directory, "something-image" has an - suffix
and thus no change is needed for those usages of
re.search('-image-'). However, while at it also enhance those string
searches a bit (no need for re; any()+map() a bit closer to the
intended logic).

Signed-off-by: Patrick Ohly 
---
 scripts/runqemu | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index 17d79e9..4d7168c 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -218,7 +218,7 @@ class BaseConfig(object):
 if not re.search('.qemuboot.conf$', '\n'.join(os.listdir(p)), 
re.M):
 logger.info("Can't find required *.qemuboot.conf in %s" % p)
 return False
-if not re.search('-image-', '\n'.join(os.listdir(p))):
+if not any(map(lambda name: '-image-' in name, os.listdir(p))):
 logger.info("Can't find *-image-* in %s" % p)
 return False
 return True
@@ -267,7 +267,7 @@ class BaseConfig(object):
  re.search('zImage', p) or re.search('vmlinux', p) or \
  re.search('fitImage', p) or re.search('uImage', p):
 self.kernel =  p
-elif os.path.exists(p) and (not os.path.isdir(p)) and 
re.search('-image-', os.path.basename(p)):
+elif os.path.exists(p) and (not os.path.isdir(p)) and '-image-' in 
os.path.basename(p):
 self.rootfs = p
 # Check filename against self.fstypes can hanlde .cpio.gz,
 # otherwise, its type would be "gz", which is incorrect.
@@ -381,7 +381,7 @@ class BaseConfig(object):
 self.kernel_cmdline_script += ' %s' % arg[len('bootparams='):]
 elif os.path.exists(arg) or (re.search(':', arg) and 
re.search('/', arg)):
 self.check_arg_path(os.path.abspath(arg))
-elif re.search('-image-', arg):
+elif re.search(r'-image-|-image$', arg):
 # Lazy rootfs
 self.rootfs = arg
 else:
-- 
git-series 0.9.1
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH v4 11/12] ovmf: build image which enrolls standard keys

2017-01-20 Thread Patrick Ohly
When booting a qemu virtual machine with ovmf.secboot, it comes up
with no keys installed and thus Secure Boot disabled. To lock down
the machine like a typical PC, one has to enroll the same keys
that PC vendors normally install, i.e. the ones from Microsoft.

This can be done manually (see
https://wiki.ubuntu.com/SecurityTeam/SecureBoot and
https://github.com/tianocore-docs/Docs/raw/master/White_Papers/A_Tour_Beyond_BIOS_into_UEFI_Secure_Boot_White_Paper.pdf)
 or automatically with the EnrollDefaultKeys.efi helper
from the Fedora ovmf rpm.

To use this with qemu:
$ bitbake ovmf-shell-image
...
$ runqemu serial nographic qemux86 ovmf-shell-image wic ovmf.secboot
...
UEFI Interactive Shell v2.1
EDK II
UEFI v2.60 (EDK II, 0x0001)
Mapping table
  FS0: Alias(s):HD2b:;BLK4:
  
PciRoot(0x0)/Pci(0x5,0x0)/HD(1,GPT,06AEF759-3982-4AF6-B517-70BA6304FC1C,0x800,0x566C)
 BLK0: Alias(s):
  PciRoot(0x0)/Pci(0x1,0x0)/Floppy(0x0)
 BLK1: Alias(s):
  PciRoot(0x0)/Pci(0x1,0x0)/Floppy(0x1)
 BLK2: Alias(s):
  PciRoot(0x0)/Pci(0x1,0x1)/Ata(0x0)
 BLK3: Alias(s):
  PciRoot(0x0)/Pci(0x5,0x0)

Press ESC in 1 seconds to skip startup.nsh or any other key to continue.
Shell> fs0:EnrollDefaultKeys.efi
info: SetupMode=1 SecureBoot=0 SecureBootEnable=0 CustomMode=0 VendorKeys=1
info: SetupMode=0 SecureBoot=1 SecureBootEnable=1 CustomMode=0 VendorKeys=0
info: success
Shell> reset

Remember that this will modify
deploy/images/qemux86/ovmf.secboot.qcow2, so make a copy and use the
full path of that copy instead of the "ovmf" argument if needed.

The ovmf-shell-image contains an EFI shell, which is what got started
here directly. After enrolling the keys, Secure Boot is active and the
same image cannot be booted anymore, so the BIOS goes through the
normal boot targets (including network boot, which can take a while to
time out), and ends up in the internal EFI shell. Trying to invoke
bootia32.efi (the shell from the image) or EnrollDefaultKeys.efi then
fails:
Shell> bootia32.efi
Command Error Status: Security Violation

The main purpose at the moment is to test that Secure Boot enforcement
really works. If we had a way to sign generated images, that part could
also be tested by booting in a locked down qemu instance.

0007-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch is
from
https://src.fedoraproject.org/cgit/rpms/edk2.git/tree/0007-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch?id=b1781931894bf2057464e634beed68b1e3218c9e
with one line changed to fix
https://bugzilla.redhat.com/show_bug.cgi?id=132502:
"EFI_STATUS Status = EFI_SUCCESS;" in EnrollListOfX509Certs() lacked
the initializer.

Signed-off-by: Patrick Ohly 
---
 meta/recipes-core/ovmf/ovmf-shell-image.bb 
 |   17 +-
 
meta/recipes-core/ovmf/ovmf/0007-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch
 | 1124 
-
 meta/recipes-core/ovmf/ovmf/ovmf-shell-image.wks   
 |4 +-
 meta/recipes-core/ovmf/ovmf_git.bb 
 |   22 +-
 4 files changed, 1167 insertions(+)
 create mode 100644 meta/recipes-core/ovmf/ovmf-shell-image.bb
 create mode 100644 
meta/recipes-core/ovmf/ovmf/0007-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch
 create mode 100644 meta/recipes-core/ovmf/ovmf/ovmf-shell-image.wks

diff --git a/meta/recipes-core/ovmf/ovmf-shell-image.bb 
b/meta/recipes-core/ovmf/ovmf-shell-image.bb
new file mode 100644
index 000..029547b
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf-shell-image.bb
@@ -0,0 +1,17 @@
+DESCRIPTION = "boot image with UEFI shell and tools"
+
+# For this image recipe, only the wic format with a
+# single vfat partition makes sense.
+IMAGE_FSTYPES_forcevariable = 'wic'
+
+WKS_FILE = "ovmf/ovmf-shell-image.wks"
+inherit image
+
+# We want a minimal image with just ovmf-shell-efi unpacked in it. We
+# avoid installing unnecessary stuff as much as possible, but some
+# things still get through and need to be removed.
+PACKAGE_INSTALL = "ovmf-shell-efi"
+LINGUAS_INSTALL = ""
+do_image () {
+rm -rf `ls -d ${IMAGE_ROOTFS}/* | grep -v efi`
+}
diff --git 
a/meta/recipes-core/ovmf/ovmf/0007-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch
 
b/meta/recipes-core/ovmf/ovmf/0007-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch
new file mode 100644
index 000..3aa6cc4
--- /dev/null
+++ 
b/meta/recipes-core/ovmf/ovmf/0007-OvmfPkg-EnrollDefaultKeys-application-for-enrolling-.patch
@@ -0,0 +1,1124 @@
+From: Laszlo Ersek 
+Date: Mon, 6 Jul 2015 20:22:02 +0200
+Subject: [PATCH] OvmfPkg: EnrollDefaultKeys: application for enrolling default
+ keys
+
+(A port of the  patch
+to Gerd's public RPMs.)
+
+This application is meant to be invoked by 

[OE-core] [PATCH v4 12/12] ovmf: remove BGRT patch

2017-01-20 Thread Patrick Ohly
This patch was added to meta-luv for kernel testing purposes and
probably is not relevant for OE-core.

Signed-off-by: Patrick Ohly 
---
 meta/recipes-core/ovmf/ovmf/0001-OvmfPkg-Enable-BGRT-in-OVMF.patch | 110 
+
 meta/recipes-core/ovmf/ovmf_git.bb |   1 +-
 2 files changed, 111 deletions(-)
 delete mode 100644 
meta/recipes-core/ovmf/ovmf/0001-OvmfPkg-Enable-BGRT-in-OVMF.patch

diff --git a/meta/recipes-core/ovmf/ovmf/0001-OvmfPkg-Enable-BGRT-in-OVMF.patch 
b/meta/recipes-core/ovmf/ovmf/0001-OvmfPkg-Enable-BGRT-in-OVMF.patch
deleted file mode 100644
index 4531a6d..000
--- a/meta/recipes-core/ovmf/ovmf/0001-OvmfPkg-Enable-BGRT-in-OVMF.patch
+++ /dev/null
@@ -1,110 +0,0 @@
-From 66a4020c3c2163aeffc9757851f33c346ecfd870 Mon Sep 17 00:00:00 2001
-From: Sai Praneeth Prakhya 
-Date: Mon, 4 Apr 2016 12:15:12 -0700
-Subject: [PATCH] OvmfPkg: Enable BGRT in OVMF
-
-By default, firmware (OVMF - Open source Virtual Machine Firmware)
-never publishes BGRT (Boot Graphics Resource Table) and in the boot
-process Linux kernel checks for this table and if it fails to find BGRT
-table then corresponding code in Linux kernel is not executed. EDK II
-(EFI Development Kit, thus OVMF) already has BGRT source code packaged
-into it but it is excluded from the build process of OVMF. These changes
-to build system of OVMF enables BGRT in 32-bit and 64-bit OVMF.
-
-There are only two files that need to be modified in order to do this.
-The first one being OvmfPkg*.dsc (this file describes the platform) and
-the second one being OvmfPkg*.fdf (this file describes firmware descriptor
-volume). A *.inf file (here "BootGraphicsResourceTableDxe.inf")
-describes a module (here BGRT). So, include
-"BootGraphicsResourceTableDxe.inf" file in "OvmfPkg*.dsc" so that BGRT
-source code will be compiled and "BootGraphicsResourceTableDxe.efi" file
-is generated and we should also include
-"BootGraphicsResourceTableDxe.inf" file in "OvmfPkg*.fdf" file so that
-"BootGraphicsResourceTableDxe.efi" will be placed in a firmware volume
-and thus gets published.
-
-Signed-off-by: Sai Praneeth Prakhya 

- OvmfPkg/OvmfPkgIa32.dsc| 1 +
- OvmfPkg/OvmfPkgIa32.fdf| 1 +
- OvmfPkg/OvmfPkgIa32X64.dsc | 1 +
- OvmfPkg/OvmfPkgIa32X64.fdf | 1 +
- OvmfPkg/OvmfPkgX64.dsc | 1 +
- OvmfPkg/OvmfPkgX64.fdf | 1 +
- 6 files changed, 6 insertions(+)
-
-diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
-index 9e5b477..0582219 100644
 a/OvmfPkg/OvmfPkgIa32.dsc
-+++ b/OvmfPkg/OvmfPkgIa32.dsc
-@@ -647,6 +647,7 @@
-   OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
-   MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
-   MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
-+  
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
- 
-   #
-   # Network Support
-diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
-index fc203f2..f968cb7 100644
 a/OvmfPkg/OvmfPkgIa32.fdf
-+++ b/OvmfPkg/OvmfPkgIa32.fdf
-@@ -274,6 +274,7 @@ INF  RuleOverride=ACPITABLE 
OvmfPkg/AcpiTables/AcpiTables.inf
- INF  OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
- INF  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
- INF  
MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
-+INF  
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
- 
- INF  RuleOverride = BINARY FatBinPkg/EnhancedFatDxe/Fat.inf
- 
-diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
-index 6e4da4f..8289385 100644
 a/OvmfPkg/OvmfPkgIa32X64.dsc
-+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
-@@ -656,6 +656,7 @@
-   OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
-   MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
-   MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
-+  
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
- 
-   #
-   # Network Support
-diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
-index d3f46f3..282d40b 100644
 a/OvmfPkg/OvmfPkgIa32X64.fdf
-+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
-@@ -274,6 +274,7 @@ INF  RuleOverride=ACPITABLE 
OvmfPkg/AcpiTables/AcpiTables.inf
- INF  OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
- INF  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
- INF  
MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
-+INF  
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
- 
- INF  RuleOverride = BINARY USE = X64 FatBinPkg/EnhancedFatDxe/Fat.inf
- 
-diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
-index 3d6d43e..0f956a7 100644
 a/OvmfPkg/OvmfPkgX64.dsc
-+++ b/OvmfPkg/OvmfPkgX64.dsc
-@@ -654,6 +654,7 @@
-   OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
-   

[OE-core] [PATCH v4 10/12] runqemu: support UEFI with OVMF firmware

2017-01-20 Thread Patrick Ohly
In the simplest case, "runqemu qemux86  qcow2 ovmf" for an
EFI-enabled image in the qcow2 format will locate the ovmf.qcow2
firmware file deployed by the ovmf recipe in the image deploy
directory, override the graphics hardware with "-vga std" because that
is all that OVMF supports, and boot with UEFI enabled.

ovmf is not built by default. Either do it explicitly ("bitbake ovmf")
or make it a part of the normal build
("MACHINE_ESSENTIAL_EXTRA_RDEPENDS_append = ' ovmf'").

The firmware file is activated as a flash drive instead of using the
qemu BIOS parameters, because that is the recommended method
(https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=764918#47) as it
allows storing UEFI variables in the file.

Instead of just "ovmf", a full path to an existing file can also be
used, just as with the rootfs. That may be useful when making a
permanent copy of the virtual machine data files.

It is possible to specify "ovmf*" parameters more than once, then
each parameter creates a separate flash drive. This way it is possible
to use separate flash drives for firmware code and variables:
$ runqemu qemux86  qcow2 ovmf.code ovmf.vars"

Note that rebuilding ovmf will overwrite the ovmf.vars.qcow2 file in
the image deploy directory. So when the goal is to update the firmware
while keeping variables, make a copy of the variable file and use
that:
$ mkdir my-machine
$ cp tmp/deploy/images/qemux86/ovmf.vars.qcow2 my-machine/
$ runqemu qemux86  qcow2 ovmf.code my-machine/ovmf.vars.qcow2

When Secure Boot was enabled in ovmf, one can pick that instead of
the non-Secure-Boot enabled ovmf.code:
$ runqemu qemux86  qcow2 ovmf.secboot.code 
my-machine/ovmf.vars.qcow2

Signed-off-by: Patrick Ohly 
---
 scripts/runqemu | 42 +-
 1 file changed, 41 insertions(+), 1 deletion(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index 4d7168c..10947bb 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -74,6 +74,7 @@ of the following environment variables (in any order):
 kvm-vhost - enable KVM with vhost when running x86/x86_64 (VT-capable CPU 
required)
 publicvnc - enable a VNC server open to all hosts
 audio - enable audio
+[*/]ovmf* - OVMF firmware file or base name for booting with UEFI
   tcpserial= - specify tcp serial port number
   biosdir= - specify custom bios dir
   biosfilename= - specify bios filename
@@ -162,6 +163,13 @@ class BaseConfig(object):
 self.clean_nfs_dir = False
 self.nfs_server = ''
 self.rootfs = ''
+# File name(s) of a OVMF firmware file or variable store,
+# to be added with -drive if=pflash.
+# Found in the same places as the rootfs, with or without one of
+# these suffices: qcow2, bin.
+# Setting one also adds "-vga std" because that is all that
+# OVMF supports.
+self.ovmf_bios = []
 self.qemuboot = ''
 self.qbconfload = False
 self.kernel = ''
@@ -259,6 +267,7 @@ class BaseConfig(object):
 - Check whether is a kernel file
 - Check whether is a image file
 - Check whether it is a nfs dir
+- Check whether it is a OVMF flash file
 """
 if p.endswith('.qemuboot.conf'):
 self.qemuboot = p
@@ -299,6 +308,8 @@ class BaseConfig(object):
 else:
 logger.info("Assuming %s is an nfs rootfs" % p)
 self.check_arg_nfs(p)
+elif os.path.basename(p).startswith('ovmf'):
+self.ovmf_bios.append(p)
 else:
 raise Exception("Unknown path arg %s" % p)
 
@@ -384,6 +395,8 @@ class BaseConfig(object):
 elif re.search(r'-image-|-image$', arg):
 # Lazy rootfs
 self.rootfs = arg
+elif arg.startswith('ovmf'):
+self.ovmf_bios.append(arg)
 else:
 # At last, assume is it the MACHINE
 if (not unknown_arg) or unknown_arg == arg:
@@ -482,6 +495,20 @@ class BaseConfig(object):
 if not os.path.exists(self.rootfs):
 raise Exception("Can't find rootfs: %s" % self.rootfs)
 
+def check_ovmf(self):
+"""Check and set full path for OVMF firmware and variable file(s)."""
+
+for index, ovmf in enumerate(self.ovmf_bios):
+if os.path.exists(ovmf):
+continue
+for suffix in ('qcow2', 'bin'):
+path = '%s/%s.%s' % (self.get('DEPLOY_DIR_IMAGE'), ovmf, 
suffix)
+if os.path.exists(path):
+self.ovmf_bios[index] = path
+break
+else:
+raise Exception("Can't find OVMF firmware: %s" % ovmf)
+
 def check_kernel(self):
 """Check and set kernel, dtb"""
 # The vm image doesn't need a kernel
@@ -576,6 +603,7 @@ class BaseConfig(object):
 self.check_kvm()
 self.check_fstype()
 self.check_rootfs()
+

[OE-core] [PATCH v4 01/12] acpica: move from meta-oe to OE-core

2017-01-20 Thread Patrick Ohly
From: Fathi Boudra 

qemu support for UEFI in OE-core depends on OVMF, which needs the iasl
tools provided by this recipe. There's also an iasl recipe in
meta-luv, but than can and will be replaced by this one, thus reducing
overall maintenance work.

Copied from meta-openembedded rev fa65be9ba (current master).

Signed-off-by: Patrick Ohly 
---
 meta/recipes-extended/acpica/acpica_20150515.bb  |  46 +-
 meta/recipes-extended/acpica/acpitests/aapits-linux.patch| 336 +++-
 meta/recipes-extended/acpica/acpitests/aapits-makefile.patch |  34 +-
 meta/recipes-extended/acpica/acpitests_20140828.bb   |  35 +-
 meta/recipes-extended/acpica/files/no-werror.patch   |  32 +-
 5 files changed, 483 insertions(+)
 create mode 100644 meta/recipes-extended/acpica/acpica_20150515.bb
 create mode 100644 meta/recipes-extended/acpica/acpitests/aapits-linux.patch
 create mode 100644 meta/recipes-extended/acpica/acpitests/aapits-makefile.patch
 create mode 100644 meta/recipes-extended/acpica/acpitests_20140828.bb
 create mode 100644 meta/recipes-extended/acpica/files/no-werror.patch

diff --git a/meta/recipes-extended/acpica/acpica_20150515.bb 
b/meta/recipes-extended/acpica/acpica_20150515.bb
new file mode 100644
index 000..de897e1
--- /dev/null
+++ b/meta/recipes-extended/acpica/acpica_20150515.bb
@@ -0,0 +1,46 @@
+SUMMARY = "ACPICA tools for the development and debug of ACPI tables"
+DESCRIPTION = "The ACPI Component Architecture (ACPICA) project provides an \
+OS-independent reference implementation of the Advanced Configuration and \
+Power Interface Specification (ACPI). ACPICA code contains those portions of \
+ACPI meant to be directly integrated into the host OS as a kernel-resident \
+subsystem, and a small set of tools to assist in developing and debugging \
+ACPI tables."
+
+HOMEPAGE = "http://www.acpica.org/;
+SECTION = "console/tools"
+
+LICENSE = "BSD | GPLv2"
+LIC_FILES_CHKSUM = 
"file://generate/unix/readme.txt;md5=204407e197c1a01154a48f6c6280c3aa"
+
+COMPATIBLE_HOST = "(i.86|x86_64|arm|aarch64).*-linux"
+
+DEPENDS = "bison flex"
+
+SRC_URI = "https://acpica.org/sites/acpica/files/acpica-unix2-${PV}.tar.gz \
+file://no-werror.patch \
+"
+SRC_URI[md5sum] = "2bc4a7ccc82de9df9fa964f784ecb29c"
+SRC_URI[sha256sum] = 
"61204ec56d71bc9bfa2ee2ade4c66f7e8541772ac72ef8ccc20b3f339cc96374"
+
+S = "${WORKDIR}/acpica-unix2-${PV}"
+
+EXTRA_OEMAKE = "CC='${CC}' 'OPT_CFLAGS=-Wall'"
+
+do_install() {
+install -D -p -m0755 generate/unix/bin*/iasl ${D}${bindir}/iasl
+install -D -p -m0755 generate/unix/bin*/acpibin ${D}${bindir}/acpibin
+install -D -p -m0755 generate/unix/bin*/acpiexec ${D}${bindir}/acpiexec
+install -D -p -m0755 generate/unix/bin*/acpihelp ${D}${bindir}/acpihelp
+install -D -p -m0755 generate/unix/bin*/acpinames ${D}${bindir}/acpinames
+install -D -p -m0755 generate/unix/bin*/acpisrc ${D}${bindir}/acpisrc
+install -D -p -m0755 generate/unix/bin*/acpixtract ${D}${bindir}/acpixtract
+}
+
+# iasl*.bb is a subset of this recipe, so RREPLACE it
+PROVIDES = "iasl"
+RPROVIDES_${PN} += "iasl"
+RREPLACES_${PN} += "iasl"
+RCONFLIGHTS_${PN} += "iasl"
+
+NATIVE_INSTALL_WORKS = "1"
+BBCLASSEXTEND = "native"
diff --git a/meta/recipes-extended/acpica/acpitests/aapits-linux.patch 
b/meta/recipes-extended/acpica/acpitests/aapits-linux.patch
new file mode 100644
index 000..7c5d6b0
--- /dev/null
+++ b/meta/recipes-extended/acpica/acpitests/aapits-linux.patch
@@ -0,0 +1,336 @@
+From: Al Stone 
+Date: Mon, 7 Apr 2014 19:09:37 +
+Subject: [PATCH 1/2] Fixup aapits build
+
+From http://git.linaro.org/people/al.stone/acpica-tools.git
+Upstream-status: Unknown
+
+diff -urN acpica-unix2-20130626/tests/aapits/atexec.c 
acpica-unix2-20130626-aapits/tests/aapits/atexec.c
+--- acpica-unix2-20130626/tests/aapits/atexec.c2013-01-17 
12:48:28.0 -0700
 acpica-unix2-20130626-aapits/tests/aapits/atexec.c 2013-07-25 
13:44:23.023894441 -0600
+@@ -639,6 +639,7 @@
+ }
+ 
+ 
++#if ACPI_MACHINE_WIDTH == 32
+ 
/***
+  *
+  * FUNCTION:AtBuildLocalRSDT
+@@ -757,8 +758,9 @@
+ LocalRSDT->Header.Checksum = (UINT8)~LocalRSDT->Header.Checksum;
+ }
+ }
++#endif
+ 
+ 
+ 
/***
+  *
+  * FUNCTION:AtBuildLocalXSDT
+@@ -1424,7 +1426,7 @@
+ ACPI_WARNING ((AE_INFO,
+ "Request on [%4.4s] is beyond region limit Req-%X+%X, Base=%X, 
Len-%X\n",
+ (RegionObject->Region.Node)->Name.Ascii, (UINT32) Address,
+-ByteWidth, (UINT32) BufferAddress, Length));
++ByteWidth, (UINT32) BufferAddress, (UINT32) Length));
+ 
+ return (AE_AML_REGION_LIMIT);
+ }
+@@ -1792,7 +1796,9 @@
+ Path, Obj.Integer.Value, Value);
+ #else
+ printf ("API Error: Value of %s is 0x%llx 

[OE-core] [PATCH v4 05/12] ovmf: deploy firmware in image directory

2017-01-20 Thread Patrick Ohly
When used with '-drive if=pflash', qemu will store UEFI variables
inside the firmware image file. That is unexpected for a file located in
the sysroot, which should be read-only, while it is normal for image
files in the deploy/images directory. Therefore that directory is a
better place for use with runqemu.

The name was chose so that "runqemu ovmf" can be used as shorthand for
"runqemu /ovmf.qcow2" by treating "ovmf" as the base name
of the BIOS file. "ovmf.secboot.qcow2" is meant to be used for the
Secure Boot enabled firmware.

qcow2 is used because it is needed for "savevm" snapshots of a virtual
machine.

With code and variables stored in the same ovmf.qcow2 it is not
possible to update the firmware code without also overwriting the
variables. For users who care about persistent variables, the code and
variables are also provided as separate files, in ovmf.code.qcow2 and
ovmf.vars.qcow2.

The traditional usage of ovmf via the qemu bios parameter is no longer
supported and therefore it is not necessary to create a "bios.bin"
file in the target sysroot.

Signed-off-by: Patrick Ohly 
---
 meta/recipes-core/ovmf/ovmf_git.bb | 42 ++-
 1 file changed, 31 insertions(+), 11 deletions(-)

diff --git a/meta/recipes-core/ovmf/ovmf_git.bb 
b/meta/recipes-core/ovmf/ovmf_git.bb
index 13b583b..895ed6c 100644
--- a/meta/recipes-core/ovmf/ovmf_git.bb
+++ b/meta/recipes-core/ovmf/ovmf_git.bb
@@ -12,11 +12,13 @@ SRC_URI = 
"git://github.com/tianocore/edk2.git;branch=master \
 
 SRCREV="4575a602ca6072ee9d04150b38bfb143cbff8588"
 
+inherit deploy
+
 PARALLEL_MAKE = ""
 
 S = "${WORKDIR}/git"
 
-DEPENDS_class-native="util-linux-native iasl-native ossp-uuid-native"
+DEPENDS_class-native="util-linux-native iasl-native ossp-uuid-native 
qemu-native"
 
 DEPENDS_class-target="ovmf-native"
 
@@ -97,9 +99,22 @@ do_compile_class-target() {
 OVMF_ARCH="IA32"
 fi
 
+# ${WORKDIR}/ovmf is a well-known location where do_install and
+# do_deploy will be able to find the files.
+rm -rf ${WORKDIR}/ovmf
+mkdir ${WORKDIR}/ovmf
+OVMF_DIR_SUFFIX="X64"
+if [ "${TARGET_ARCH}" != "x86_64" ] ; then
+OVMF_DIR_SUFFIX="Ia32" # Note the different capitalization
+fi
 FIXED_GCCVER=$(fixup_target_tools ${GCC_VER})
-echo FIXED_GCCVER is ${FIXED_GCCVER}
+bbnote FIXED_GCCVER is ${FIXED_GCCVER}
+build_dir="${S}/Build/Ovmf$OVMF_DIR_SUFFIX/RELEASE_${FIXED_GCCVER}"
+
 ${S}/OvmfPkg/build.sh -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER}
+ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/ovmf.fd
+ln ${build_dir}/FV/OVMF_CODE.fd ${WORKDIR}/ovmf/ovmf.code.fd
+ln ${build_dir}/FV/OVMF_VARS.fd ${WORKDIR}/ovmf/ovmf.vars.fd
 }
 
 do_install_class-native() {
@@ -108,16 +123,21 @@ do_install_class-native() {
 }
 
 do_install_class-target() {
-OVMF_DIR_SUFFIX="X64"
-if [ "${TARGET_ARCH}" != "x86_64" ] ; then
-OVMF_DIR_SUFFIX="Ia32" # Note the different capitalization
-fi
-install -d ${D}${datadir}/ovmf
+}
 
-FIXED_GCCVER=$(fixup_target_tools ${GCC_VER})
-build_dir="${S}/Build/Ovmf$OVMF_DIR_SUFFIX/RELEASE_${FIXED_GCCVER}"
-install -m 0755 ${build_dir}/FV/OVMF.fd \
-   ${D}${datadir}/ovmf/bios.bin
+do_deploy() {
+}
+do_deploy[cleandirs] = "${DEPLOYDIR}"
+do_deploy_class-target() {
+# For use with "runqemu ovmf".
+for i in \
+ovmf \
+ovmf.code \
+ovmf.vars \
+; do
+qemu-img convert -f raw -O qcow2 ${WORKDIR}/ovmf/$i.fd 
${DEPLOYDIR}/$i.qcow2
+done
 }
+addtask do_deploy after do_compile before do_build
 
 BBCLASSEXTEND = "native"
-- 
git-series 0.9.1
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


  1   2   >