aboutsummaryrefslogtreecommitdiffstats
path: root/meta-selftest
diff options
context:
space:
mode:
authorFrancisco Pedraza <francisco.j.pedraza.gonzalez@intel.com>2016-11-24 15:54:53 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-16 08:30:01 +0000
commita8ff789a3bfedcbc4358db7907a45270d8b1b76a (patch)
tree58624952613c2690b68e8186157407775b776d66 /meta-selftest
parentfe7fd2cd3a9c4fb5b31bd3cab81c96a3b81cb540 (diff)
downloadopenembedded-core-a8ff789a3bfedcbc4358db7907a45270d8b1b76a.tar.gz
openembedded-core-a8ff789a3bfedcbc4358db7907a45270d8b1b76a.tar.bz2
openembedded-core-a8ff789a3bfedcbc4358db7907a45270d8b1b76a.zip
selftest: Test needed to verify postinst order
It verifies the following: 1. Compile a minimal image. 2. The compiled image will add the layer with the recipe postinst, previously created at: "meta-selftest/recipes-test" 3. Run QEMU. 4. Validate the task execution order. [YOCTO #5319] Signed-off-by: Francisco Pedraza <francisco.j.pedraza.gonzalez@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta-selftest')
-rw-r--r--meta-selftest/recipes-test/postinst/postinst_1.0.bb124
1 files changed, 124 insertions, 0 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 0000000000..97a1987305
--- /dev/null
+++ b/meta-selftest/recipes-test/postinst/postinst_1.0.bb
@@ -0,0 +1,124 @@
+LICENSE = "MIT"
+ALLOW_EMPTY_${PN}-at-rootfs = "1"
+ALLOW_EMPTY_${PN}-delayed-a = "1"
+ALLOW_EMPTY_${PN}-delayed-b = "1"
+ALLOW_EMPTY_${PN}-delayed-d = "1"
+ALLOW_EMPTY_${PN}-delayed-p = "1"
+ALLOW_EMPTY_${PN}-delayed-t = "1"
+
+PACKAGES += "${PN}-at-rootfs ${PN}-delayed-a ${PN}-delayed-b ${PN}-delayed-d ${PN}-delayed-p ${PN}-delayed-t"
+PROVIDES += "${PN}-at-rootfs ${PN}-delayed-a ${PN}-delayed-b ${PN}-delayed-d ${PN}-delayed-p ${PN}-delayed-t"
+FILES_${PN}-delayed-a = ""
+FILES_${PN}-delayed-b = ""
+FILES_${PN}-delayed-d = ""
+FILES_${PN}-delayed-p = ""
+FILES_${PN}-delayed-t = ""
+
+# Runtime dependencies
+RDEPENDS_${PN}-delayed-a = "${PN}-at-rootfs"
+RDEPENDS_${PN}-delayed-b = "${PN}-delayed-a"
+RDEPENDS_${PN}-delayed-d = "${PN}-delayed-b"
+RDEPENDS_${PN}-delayed-p = "${PN}-delayed-d"
+RDEPENDS_${PN}-delayed-t = "${PN}-delayed-p"
+
+# Main recipe post-install
+pkg_postinst_${PN}-at-rootfs () {
+ tfile="/etc/postinsta-test"
+ if test "x$D" != "x" then
+ # Need to run on first boot
+ exit 1
+ else
+ echo "lets write postinst" > $tfile
+ fi
+}
+
+# Dependency recipes post-installs
+pkg_postinst_${PN}-delayed-a () {
+ efile="/etc/postinst-test"
+ tfile="/etc/postinsta-test"
+ rdeps="postinst"
+
+ if test "x$D" != "x"; then
+ # Need to run on first boot
+ exit 1
+ else
+ if test -e $efile ; then
+ echo 'success' > $tfile
+ else
+ echo 'fail to install $rdeps first!' >&2
+ exit 1
+ fi
+ fi
+}
+
+pkg_postinst_${PN}-delayed-b () {
+ efile="/etc/postinsta-test"
+ tfile="/etc/postinstb-test"
+ rdeps="postinsta"
+
+ if test "x$D" != "x"; then
+ # Need to run on first boot
+ exit 1
+ else
+ if test -e $efile ; then
+ echo 'success' > $tfile
+ else
+ echo 'fail to install $rdeps first!' >&2
+ exit 1
+ fi
+ fi
+}
+
+pkg_postinst_${PN}-delayed-d () {
+ efile="/etc/postinstb-test"
+ tfile="/etc/postinstd-test"
+ rdeps="postinstb"
+
+ if test "x$D" != "x"; then
+ # Need to run on first boot
+ exit 1
+ else
+ if test -e $efile ; then
+ echo 'success' > $tfile
+ else
+ echo 'fail to install $rdeps first!' >&2
+ exit 1
+ fi
+ fi
+}
+
+pkg_postinst_${PN}-delayed-p () {
+ efile="/etc/postinstd-test"
+ tfile="/etc/postinstp-test"
+ rdeps="postinstd"
+
+ if test "x$D" != "x"; then
+ # Need to run on first boot
+ exit 1
+ else
+ if test -e $efile ; then
+ echo 'success' > $tfile
+ else
+ echo 'fail to install $rdeps first!' >&2
+ exit 1
+ fi
+ fi
+}
+
+pkg_postinst_${PN}-delayed-t () {
+ efile="/etc/postinstp-test"
+ tfile="/etc/postinstt-test"
+ rdeps="postinstp"
+
+ if test "x$D" != "x"; then
+ # Need to run on first boot
+ exit 1
+ else
+ if test -e $efile ; then
+ echo 'success' > $tfile
+ else
+ echo 'fail to install $rdeps first!' >&2
+ exit 1
+ fi
+ fi
+}