From: Paul Eggleton Date: Thu, 19 Sep 2013 10:10:34 +0000 (+0100) Subject: classes/testimage-auto: add class to allow automatically running image tests X-Git-Tag: rev_ivi_2015_02_04~10941 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd17d968b8722902c2e3e596d073882d4a2cebf8;p=scm%2Fbb%2Ftizen-distro.git classes/testimage-auto: add class to allow automatically running image tests Setting TEST_IMAGE = "1" alone will now automatically run tests on the image immediately after the image is built instead of having to add INHERIT += "testimage" and run bitbake -c testimage manually (but that will still work). This restores functionality that was present in the older imagetest-qemu class with IMAGETEST. (From OE-Core rev: 72269a8fbec35c39af30fbabb1fa9ca7c5ee8d69) Signed-off-by: Paul Eggleton Signed-off-by: Richard Purdie --- diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 889547a..246a4db 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -16,6 +16,9 @@ RRECOMMENDS += "${PACKAGE_INSTALL_ATTEMPTONLY}" INHIBIT_DEFAULT_DEPS = "1" +TESTIMAGECLASS = "${@base_conditional('TEST_IMAGE', '1', 'testimage-auto', '', d)}" +inherit ${TESTIMAGECLASS} + # IMAGE_FEATURES may contain any available package group IMAGE_FEATURES ?= "" IMAGE_FEATURES[type] = "list" diff --git a/meta/classes/testimage-auto.bbclass b/meta/classes/testimage-auto.bbclass new file mode 100644 index 0000000..3d0e289 --- /dev/null +++ b/meta/classes/testimage-auto.bbclass @@ -0,0 +1,23 @@ +# Copyright (C) 2013 Intel Corporation +# +# Released under the MIT license (see COPYING.MIT) + + +# Run tests automatically on an image after the image is constructed +# (as opposed to testimage.bbclass alone where tests must be called +# manually using bitbake -c testimage ). +# +# NOTE: to use this class, simply set TEST_IMAGE = "1" - no need to +# inherit it since that will be done in image.bbclass when this variable +# has been set. +# +# See testimage.bbclass for the test implementation. + +inherit testimage + +python do_testimage_auto() { + testimage_main(d) +} +addtask testimage_auto before do_build after do_rootfs +do_testimage_auto[depends] += "qemu-native:do_populate_sysroot" +do_testimage_auto[depends] += "qemu-helper-native:do_populate_sysroot"