diff options
| author | Alexander Kanavin <alexander.kanavin@linux.intel.com> | 2018-03-12 18:49:43 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-03-15 06:27:18 -0700 |
| commit | 682705389526fba41ef8763d290ea4cab8787e43 (patch) | |
| tree | 95ec95f772e6f04cd8d792e7ef0dfb54695ba75e /meta-selftest | |
| parent | cd005e2d5bab8bc7cf4fd8b66c0bcc0328a0decd (diff) | |
| download | poky-682705389526fba41ef8763d290ea4cab8787e43.tar.gz | |
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>
Diffstat (limited to 'meta-selftest')
| -rw-r--r-- | meta-selftest/recipes-test/postinst/postinst_1.0.bb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/meta-selftest/recipes-test/postinst/postinst_1.0.bb b/meta-selftest/recipes-test/postinst/postinst_1.0.bb index d4bab6dcc2..913bfabf89 100644 --- a/meta-selftest/recipes-test/postinst/postinst_1.0.bb +++ b/meta-selftest/recipes-test/postinst/postinst_1.0.bb | |||
| @@ -3,11 +3,12 @@ LICENSE = "MIT" | |||
| 3 | 3 | ||
| 4 | inherit allarch | 4 | inherit allarch |
| 5 | 5 | ||
| 6 | PACKAGES = "${PN}-rootfs ${PN}-delayed-a ${PN}-delayed-b" | 6 | PACKAGES = "${PN}-rootfs ${PN}-delayed-a ${PN}-delayed-b ${PN}-rootfs-failing" |
| 7 | 7 | ||
| 8 | ALLOW_EMPTY_${PN}-rootfs = "1" | 8 | ALLOW_EMPTY_${PN}-rootfs = "1" |
| 9 | ALLOW_EMPTY_${PN}-delayed-a = "1" | 9 | ALLOW_EMPTY_${PN}-delayed-a = "1" |
| 10 | ALLOW_EMPTY_${PN}-delayed-b = "1" | 10 | ALLOW_EMPTY_${PN}-delayed-b = "1" |
| 11 | ALLOW_EMPTY_${PN}-rootfs-failing = "1" | ||
| 11 | 12 | ||
| 12 | RDEPENDS_${PN}-delayed-a = "${PN}-rootfs" | 13 | RDEPENDS_${PN}-delayed-a = "${PN}-rootfs" |
| 13 | RDEPENDS_${PN}-delayed-b = "${PN}-delayed-a" | 14 | RDEPENDS_${PN}-delayed-b = "${PN}-delayed-a" |
| @@ -58,3 +59,14 @@ pkg_postinst_ontarget_${PN}-delayed-b () { | |||
| 58 | 59 | ||
| 59 | touch ${TESTDIR}/delayed-b | 60 | touch ${TESTDIR}/delayed-b |
| 60 | } | 61 | } |
| 62 | |||
| 63 | # This scriptlet intentionally includes a bogus command in the middle to test | ||
| 64 | # that we catch and report such errors properly. | ||
| 65 | pkg_postinst_${PN}-rootfs-failing () { | ||
| 66 | mkdir -p $D${TESTDIR} | ||
| 67 | touch $D${TESTDIR}/rootfs-before-failure | ||
| 68 | run_a_really_broken_command | ||
| 69 | # Scriptlet execution should stop here; the following commands are NOT supposed to run. | ||
| 70 | # (oe-selftest checks for it). | ||
| 71 | touch $D${TESTDIR}/rootfs-after-failure | ||
| 72 | } | ||
