diff options
-rw-r--r-- | meta-selftest/recipes-test/postinst/postinst_1.0.bb | 12 | ||||
-rw-r--r-- | meta-selftest/recipes-test/postinst/postinsta_1.0.bb | 19 | ||||
-rw-r--r-- | meta-selftest/recipes-test/postinst/postinstb_1.0.bb | 21 | ||||
-rw-r--r-- | meta-selftest/recipes-test/postinst/postinstd_1.0.bb | 21 | ||||
-rw-r--r-- | meta-selftest/recipes-test/postinst/postinstp_1.0.bb | 21 | ||||
-rw-r--r-- | meta-selftest/recipes-test/postinst/postinstt_1.0.bb | 21 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/runtime-test.py | 15 |
7 files changed, 122 insertions, 8 deletions
diff --git a/meta-selftest/recipes-test/postinst/postinst_1.0.bb b/meta-selftest/recipes-test/postinst/postinst_1.0.bb new file mode 100644 index 00000000000..6e0da7fae11 --- /dev/null +++ b/meta-selftest/recipes-test/postinst/postinst_1.0.bb @@ -0,0 +1,12 @@ +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" > /etc/postinst-test + fi +} diff --git a/meta-selftest/recipes-test/postinst/postinsta_1.0.bb b/meta-selftest/recipes-test/postinst/postinsta_1.0.bb new file mode 100644 index 00000000000..f79dbaa2e28 --- /dev/null +++ b/meta-selftest/recipes-test/postinst/postinsta_1.0.bb @@ -0,0 +1,19 @@ +LICENSE = "MIT" + +RDEPENDS_${PN} = "postinst" + +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/postinst-test ; then + echo 'success' > /etc/postinsta-test + else + echo 'fail to install postinst first!' >&2 + exit 1 + fi + fi +} diff --git a/meta-selftest/recipes-test/postinst/postinstb_1.0.bb b/meta-selftest/recipes-test/postinst/postinstb_1.0.bb new file mode 100644 index 00000000000..eee6d850119 --- /dev/null +++ b/meta-selftest/recipes-test/postinst/postinstb_1.0.bb @@ -0,0 +1,21 @@ +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/postinst/postinstd_1.0.bb b/meta-selftest/recipes-test/postinst/postinstd_1.0.bb new file mode 100644 index 00000000000..e649c0edb16 --- /dev/null +++ b/meta-selftest/recipes-test/postinst/postinstd_1.0.bb @@ -0,0 +1,21 @@ +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/postinst/postinstp_1.0.bb b/meta-selftest/recipes-test/postinst/postinstp_1.0.bb new file mode 100644 index 00000000000..493b92d7ab0 --- /dev/null +++ b/meta-selftest/recipes-test/postinst/postinstp_1.0.bb @@ -0,0 +1,21 @@ +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/postinstd-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/postinst/postinstt_1.0.bb b/meta-selftest/recipes-test/postinst/postinstt_1.0.bb new file mode 100644 index 00000000000..fd0bc4abcbe --- /dev/null +++ b/meta-selftest/recipes-test/postinst/postinstt_1.0.bb @@ -0,0 +1,21 @@ +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/lib/oeqa/selftest/runtime-test.py b/meta/lib/oeqa/selftest/runtime-test.py index 888493b6b96..a9a658be92d 100644 --- a/meta/lib/oeqa/selftest/runtime-test.py +++ b/meta/lib/oeqa/selftest/runtime-test.py @@ -106,22 +106,22 @@ class TestImage(oeSelfTest): bitbake('-c testimage core-image-full-cmdline') class Postinst(oeSelfTest): + @testcase(1540) 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 + 1. The compiled image will add the created layer with the recipes postinst[ abdpt] 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' + features += 'CORE_IMAGE_EXTRA_INSTALL += "postinst postinsta postinstb postinstd postinstp postinstt"\n' self.write_config(features) - bitbake('core-image-minimal -c cleansstate') - bitbake('core-image-minimal') + bitbake('core-image-minimal -f') - postinst_list = ['100-postinstz','101-postinsta','102-postinstb','103-postinstd','104-postinstp','105-postinstt'] + postinst_list = ['100-postinst','101-postinsta','102-postinstb','103-postinstd','104-postinstp','105-postinstt'] path_workdir = get_bb_var('WORKDIR','core-image-minimal') workspacedir = 'testimage/qemu_boot_log' workspacedir = os.path.join(path_workdir, workspacedir) @@ -129,10 +129,9 @@ class Postinst(oeSelfTest): with runqemu('core-image-minimal') as qemu: with open(workspacedir) as f: found = False - idx = 0 + idx = 0 for line in f.readlines(): - line = line.strip() - line = line.replace("^M","") + line = line.strip().replace("^M","") if not line: # To avoid empty lines continue m = rexp.search(line) |