diff options
-rw-r--r-- | meta-selftest/recipes-test/a/a_1.0.bb | 22 | ||||
-rw-r--r-- | meta-selftest/recipes-test/postinsta/postinsta_1.0.bb | 20 | ||||
-rw-r--r-- | meta-selftest/recipes-test/postinstb/postinstb_1.0.bb | 22 | ||||
-rw-r--r-- | meta-selftest/recipes-test/postinstd/postinstd_1.0.bb | 22 | ||||
-rw-r--r-- | meta-selftest/recipes-test/postinstp/postinstp_1.0.bb | 22 | ||||
-rw-r--r-- | meta-selftest/recipes-test/postinstt/postinstt_1.0.bb | 22 | ||||
-rw-r--r-- | meta-selftest/recipes-test/postinstz/postinstz_1.0.bb | 11 | ||||
-rw-r--r-- | meta-selftest/recipes-test/z/z_1.0.bb | 15 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/runtime-test.py | 33 |
9 files changed, 189 insertions, 0 deletions
diff --git a/meta-selftest/recipes-test/a/a_1.0.bb b/meta-selftest/recipes-test/a/a_1.0.bb new file mode 100644 index 00000000000..5eb0322bcec --- /dev/null +++ b/meta-selftest/recipes-test/a/a_1.0.bb @@ -0,0 +1,22 @@ +LICENSE = "MIT" + +LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +RDEPENDS_${PN} = "z" + +ALLOW_EMPTY_${PN} = "1" + +pkg_postinst_${PN} () { + if test "x$D" != "x"; then + # Need to run on first boot + exit 1 + else + if test -e /etc/z-test ; then + echo 'success' > /etc/a-test + else + echo 'fail to install z first!' >&2 + exit 1 + fi + fi +} diff --git a/meta-selftest/recipes-test/postinsta/postinsta_1.0.bb b/meta-selftest/recipes-test/postinsta/postinsta_1.0.bb new file mode 100644 index 00000000000..2e69a8513ef --- /dev/null +++ b/meta-selftest/recipes-test/postinsta/postinsta_1.0.bb @@ -0,0 +1,20 @@ +LICENSE = "MIT" + +RDEPENDS_${PN} = "postinstz" + +ALLOW_EMPTY_${PN} = "1" + +pkg_postinst_${PN} () { + if test "x$D" != "x"; then + # Need to run on first boot + exit 1 + else + if test -e /etc/postinstz-test ; then + echo 'success' > /etc/postinsta-test + else + echo 'fail to install postinstz first!' >&2 + exit 1 + fi + fi +} + diff --git a/meta-selftest/recipes-test/postinstb/postinstb_1.0.bb b/meta-selftest/recipes-test/postinstb/postinstb_1.0.bb new file mode 100644 index 00000000000..447d77797db --- /dev/null +++ b/meta-selftest/recipes-test/postinstb/postinstb_1.0.bb @@ -0,0 +1,22 @@ +SUMMARY = "Device formfactor information" +SECTION = "base" +LICENSE = "MIT" + +RDEPENDS_${PN} = "postinsta" + +ALLOW_EMPTY_${PN} = "1" + +pkg_postinst_${PN} () { + if test "x$D" != "x"; then + # Need to run on first boot + exit 1 + else + if test -e /etc/postinsta-test ; then + echo 'success' > /etc/postinstb-test + else + echo 'fail to install postinsta first!' >&2 + exit 1 + fi + fi +} + diff --git a/meta-selftest/recipes-test/postinstd/postinstd_1.0.bb b/meta-selftest/recipes-test/postinstd/postinstd_1.0.bb new file mode 100644 index 00000000000..939f60ebadf --- /dev/null +++ b/meta-selftest/recipes-test/postinstd/postinstd_1.0.bb @@ -0,0 +1,22 @@ +SUMMARY = "Device formfactor information" +SECTION = "base" +LICENSE = "MIT" + +RDEPENDS_${PN} = "postinstb" + +ALLOW_EMPTY_${PN} = "1" + +pkg_postinst_${PN} () { + if test "x$D" != "x"; then + # Need to run on first boot + exit 1 + else + if test -e /etc/postinstb-test ; then + echo 'success' > /etc/postinstd-test + else + echo 'fail to install postinstb first!' >&2 + exit 1 + fi + fi +} + diff --git a/meta-selftest/recipes-test/postinstp/postinstp_1.0.bb b/meta-selftest/recipes-test/postinstp/postinstp_1.0.bb new file mode 100644 index 00000000000..a5210b10a02 --- /dev/null +++ b/meta-selftest/recipes-test/postinstp/postinstp_1.0.bb @@ -0,0 +1,22 @@ +SUMMARY = "Device formfactor information" +SECTION = "base" +LICENSE = "MIT" + +RDEPENDS_${PN} = "postinstd" + +ALLOW_EMPTY_${PN} = "1" + +pkg_postinst_${PN} () { + if test "x$D" != "x"; then + # Need to run on first boot + exit 1 + else + if test -e /etc/z-test ; then + echo 'success' > /etc/postinstp-test + else + echo 'fail to install postinstd first!' >&2 + exit 1 + fi + fi +} + diff --git a/meta-selftest/recipes-test/postinstt/postinstt_1.0.bb b/meta-selftest/recipes-test/postinstt/postinstt_1.0.bb new file mode 100644 index 00000000000..25c279b6e2a --- /dev/null +++ b/meta-selftest/recipes-test/postinstt/postinstt_1.0.bb @@ -0,0 +1,22 @@ +SUMMARY = "Device formfactor information" +SECTION = "base" +LICENSE = "MIT" + +RDEPENDS_${PN} = "postinstp" + +ALLOW_EMPTY_${PN} = "1" + +pkg_postinst_${PN} () { + if test "x$D" != "x"; then + # Need to run on first boot + exit 1 + else + if test -e /etc/postinstp-test ; then + echo 'success' > /etc/postinstt-test + else + echo 'fail to install postinstp first!' >&2 + exit 1 + fi + fi +} + diff --git a/meta-selftest/recipes-test/postinstz/postinstz_1.0.bb b/meta-selftest/recipes-test/postinstz/postinstz_1.0.bb new file mode 100644 index 00000000000..50445aff5b5 --- /dev/null +++ b/meta-selftest/recipes-test/postinstz/postinstz_1.0.bb @@ -0,0 +1,11 @@ +LICENSE = "MIT" + +ALLOW_EMPTY_${PN} = "1" +pkg_postinst_${PN} (){ + if test "x$D" != "x"' then + # Need to run on first boot + exit 1 + else + echo "lets write postinst_z" > /etc/postinstz-test + fi +} diff --git a/meta-selftest/recipes-test/z/z_1.0.bb b/meta-selftest/recipes-test/z/z_1.0.bb new file mode 100644 index 00000000000..c91ece94fd0 --- /dev/null +++ b/meta-selftest/recipes-test/z/z_1.0.bb @@ -0,0 +1,15 @@ +LICENSE = "MIT" + +LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \ + file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +ALLOW_EMPTY_${PN} = "1" + +pkg_postinst_${PN} () { + if test "x$D" != "x"; then + # Need to run on first boot + exit 1 + else + echo "lets write z!" > /etc/z-test + fi +} diff --git a/meta/lib/oeqa/selftest/runtime-test.py b/meta/lib/oeqa/selftest/runtime-test.py index c2d5b45a4b1..00c3cd27d6a 100644 --- a/meta/lib/oeqa/selftest/runtime-test.py +++ b/meta/lib/oeqa/selftest/runtime-test.py @@ -2,6 +2,7 @@ from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu from oeqa.utils.decorators import testcase import os +import re class TestExport(oeSelfTest): @@ -103,3 +104,35 @@ class TestImage(oeSelfTest): # Build core-image-sato and testimage bitbake('core-image-full-cmdline socat') bitbake('-c testimage core-image-full-cmdline') + +class Postinst(oeSelfTest): + + + def test_verify_postinst(self): + """ + Summary: The purpose of this test is to verify the execution order of postinst Bugzilla ID: [5319] + Expected 1. Compile a minimal image. + 1. The compiled image will add the created layer with the recipes a b d p t z + 2. Run qemux86 + 3. Validate the task execution order + """ + features = 'INHERIT += "testimage"\n' + features += 'CORE_IMAGE_EXTRA_INSTALL += "postinstz postinsta postinstb postinstd postinstp postinstt"\n' + self.write_config(features) + + bitbake('core-image-minimal -c cleansstate') + bitbake('core-image-minimal') + + # I need to declare a list with all the elements for qmeu_boot_log + list_words = ['100-postinstz','101-postinsta','102-postinstb','103-postinstd','104-postinstp','105-postinstt'] + logfile = '/home/fjpedraz/Debugging/poky/build-firstboot/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/testimage/qemu_boot_log' + with runqemu('core-image-minimal') as qemu: + with open(logfile) as f: + found = False + for line in f: + if re.search("\b{0}\b".format(list_words),line): + print line + found = True + if not found: + print('Error, the recipes were not run in the required order z,a,b,d,p,t !'') + |