oe-selftest: add a test for failing package post-installation scriptlets

The test runs a scriptlet that has an intentionally failing command in the middle
and checks for two things:
1) that bitbake does warn the user about the failure
2) that scriptlet execution stops at that point.

The test is run for all three package types: rpm, deb, ipk.

(From OE-Core rev: 865fafb0dff19d27bd417c28c95fb8fdf0326a2b)

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alexander Kanavin
2018-03-12 18:49:43 +02:00
committed by Richard Purdie
parent cd005e2d5b
commit 6827053895
2 changed files with 50 additions and 1 deletions

View File

@@ -3,11 +3,12 @@ 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-failing = "1"
RDEPENDS_${PN}-delayed-a = "${PN}-rootfs"
RDEPENDS_${PN}-delayed-b = "${PN}-delayed-a"
@@ -58,3 +59,14 @@ pkg_postinst_ontarget_${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
}