diff options
Diffstat (limited to 'meta-selftest/recipes-test/postinst/postinst_1.0.bb')
-rw-r--r-- | meta-selftest/recipes-test/postinst/postinst_1.0.bb | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/meta-selftest/recipes-test/postinst/postinst_1.0.bb b/meta-selftest/recipes-test/postinst/postinst_1.0.bb index 112aa08c80..b936c4f44b 100644 --- a/meta-selftest/recipes-test/postinst/postinst_1.0.bb +++ b/meta-selftest/recipes-test/postinst/postinst_1.0.bb @@ -3,20 +3,21 @@ LICENSE = "MIT" inherit allarch -PACKAGES = "${PN}-rootfs ${PN}-delayed-a ${PN}-delayed-b" +PACKAGES = "${PN}-rootfs ${PN}-delayed-a ${PN}-delayed-b ${PN}-rootfs-failing" -ALLOW_EMPTY_${PN}-rootfs = "1" -ALLOW_EMPTY_${PN}-delayed-a = "1" -ALLOW_EMPTY_${PN}-delayed-b = "1" +ALLOW_EMPTY:${PN}-rootfs = "1" +ALLOW_EMPTY:${PN}-delayed-a = "1" +ALLOW_EMPTY:${PN}-delayed-b = "1" +ALLOW_EMPTY:${PN}-rootfs-failing = "1" -RDEPENDS_${PN}-delayed-a = "${PN}-rootfs" -RDEPENDS_${PN}-delayed-b = "${PN}-delayed-a" +RDEPENDS:${PN}-delayed-a = "${PN}-rootfs" +RDEPENDS:${PN}-delayed-b = "${PN}-delayed-a" TESTDIR = "${sysconfdir}/postinst-test" # At rootfs time touch $TESTDIR/rootfs. Errors if the file already exists, or # if the function runs on first boot. -pkg_postinst_${PN}-rootfs () { +pkg_postinst:${PN}-rootfs () { set -e if [ -z "$D" ]; then @@ -35,14 +36,9 @@ pkg_postinst_${PN}-rootfs () { # Depends on rootfs, delays until first boot, verifies that the rootfs file was # written. -pkg_postinst_${PN}-delayed-a () { +pkg_postinst_ontarget:${PN}-delayed-a () { set -e - if [ -n "$D" ]; then - echo "Delaying ${PN}-delayed-a until first boot" - exit 1 - fi - if [ ! -e ${TESTDIR}/rootfs ]; then echo "${PN}-delayed-a: ${TESTDIR}/rootfs not found" exit 1 @@ -53,14 +49,9 @@ pkg_postinst_${PN}-delayed-a () { # Depends on delayed-a, delays until first boot, verifies that the delayed-a file was # written. This verifies the ordering between delayed postinsts. -pkg_postinst_${PN}-delayed-b () { +pkg_postinst_ontarget:${PN}-delayed-b () { set -e - if [ -n "$D" ]; then - echo "Delaying ${PN}-delayed-b until first boot" - exit 1 - fi - if [ ! -e ${TESTDIR}/delayed-a ]; then echo "${PN}-delayed-b: ${TESTDIR}/delayed-a not found" exit 1 @@ -68,3 +59,14 @@ pkg_postinst_${PN}-delayed-b () { touch ${TESTDIR}/delayed-b } + +# This scriptlet intentionally includes a bogus command in the middle to test +# that we catch and report such errors properly. +pkg_postinst:${PN}-rootfs-failing () { + mkdir -p $D${TESTDIR} + touch $D${TESTDIR}/rootfs-before-failure + run_a_really_broken_command + # Scriptlet execution should stop here; the following commands are NOT supposed to run. + # (oe-selftest checks for it). + touch $D${TESTDIR}/rootfs-after-failure +} |