diff options
author | Dave Cobbley <david.j.cobbley@linux.intel.com> | 2018-08-14 20:05:37 +0300 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-08-23 04:26:31 +0300 |
commit | eb8dc40360f0cfef56fb6947cc817a547d6d9bc6 (patch) | |
tree | de291a73dc37168da6370e2cf16c347d1eba9df8 /poky/meta-selftest/recipes-test/postinst | |
parent | 9c3cf826d853102535ead04cebc2d6023eff3032 (diff) | |
download | openbmc-eb8dc40360f0cfef56fb6947cc817a547d6d9bc6.tar.xz |
[Subtree] Removing import-layers directory
As part of the move to subtrees, need to bring all the import layers
content to the top level.
Change-Id: I4a163d10898cbc6e11c27f776f60e1a470049d8f
Signed-off-by: Dave Cobbley <david.j.cobbley@linux.intel.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'poky/meta-selftest/recipes-test/postinst')
-rw-r--r-- | poky/meta-selftest/recipes-test/postinst/postinst_1.0.bb | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/poky/meta-selftest/recipes-test/postinst/postinst_1.0.bb b/poky/meta-selftest/recipes-test/postinst/postinst_1.0.bb new file mode 100644 index 000000000..913bfabf8 --- /dev/null +++ b/poky/meta-selftest/recipes-test/postinst/postinst_1.0.bb @@ -0,0 +1,72 @@ +SUMMARY = "Packages to exercise postinstall functions" +LICENSE = "MIT" + +inherit allarch + +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" + +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 () { + set -e + + if [ -z "$D" ]; then + echo "${PN}-rootfs should have finished at rootfs time" + exit 1 + fi + + if [ -e $D${TESTDIR}/rootfs ]; then + echo "$D${TESTDIR}/rootfs exists, but should not" + exit 1 + fi + + mkdir -p $D${TESTDIR} + touch $D${TESTDIR}/rootfs +} + +# Depends on rootfs, delays until first boot, verifies that the rootfs file was +# written. +pkg_postinst_ontarget_${PN}-delayed-a () { + set -e + + if [ ! -e ${TESTDIR}/rootfs ]; then + echo "${PN}-delayed-a: ${TESTDIR}/rootfs not found" + exit 1 + fi + + touch ${TESTDIR}/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_ontarget_${PN}-delayed-b () { + set -e + + if [ ! -e ${TESTDIR}/delayed-a ]; then + echo "${PN}-delayed-b: ${TESTDIR}/delayed-a not found" + exit 1 + fi + + 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 +} |