From patchwork Wed Nov 22 16:04:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 119496 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp355266qgn; Wed, 22 Nov 2017 08:04:23 -0800 (PST) X-Google-Smtp-Source: AGs4zMbtWOuxmf8Grxv+BTN73MtBhofvgOvUJTWSSMgUdaudSWr+MrddtPliVELR61CzCKEOuLKw X-Received: by 10.98.91.194 with SMTP id p185mr19579971pfb.136.1511366663873; Wed, 22 Nov 2017 08:04:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511366663; cv=none; d=google.com; s=arc-20160816; b=ZmMQtR2FWzAEuPvPdW0NpTNevE9YNhv+Mx9Dwj9Q6dNoZC0Awy9HOuJQmCjALHxAGs qNmdBNvWZe+UbY/LQzzCaxuz5pXAaNJSaFKBzc9zHD0d7/OfNHUFglzoqSSyePuT1nSi O9lNGRXtJJoo6+ukEGj7GWmCblDx6g2hQk/BIUZ3fqjXB27MCnxhdon08EJXG2CgDb9o NTfnkFxMBQV7Ow81EAb3RJ88bEMi0G9oa79I6DJ1FhSF2hC6bOJ88ciBX6Eqa1tlBiIh tWMi5AZvycYaPGFuQLVObSL0EHLemIPwACi+w2uTjW3PCVHZ7l5vkXnUHoGexF7nEXv6 ffUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=wWDVad4oJmOUjq/6W4c+Z8aeE3zibQaTN43wZmyJG4U=; b=vKuf8IcuQ9DnsLkO2zNwitEP+soDSdIZQdM14ic34g9K0xVuvSp6jpv1XRTNmvI3N7 XD3fEwYMeSjByGGdt5KnopGGCI7e6YmdT7ffNGV/OLepWS5l0U1a4W0Elk+4i0xPeKIf PUUEadMecK+md4J07sB4NExy34FQDkcJrz+P2kVhl98u0nNK/kbr5gpE/9NV/j4mttqT sxPArUuq6SVsGOMoQ7rLpgSFPQUOxzxs/xS5NOV6bf2iLUhSd3VktYkosk61yHTtuVxL XhpVei07gFdFypFD6kaYnrEQBpdk56fBkhcf4AHvtD6Jt0vt3ikXV2/c6XGHw3oVM8Ej zVEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=IwsocCbd; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id r10si15264905pfd.157.2017.11.22.08.04.23; Wed, 22 Nov 2017 08:04:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=IwsocCbd; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org Received: from review.yoctoproject.org (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id 1F7047875B; Wed, 22 Nov 2017 16:04:19 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by mail.openembedded.org (Postfix) with ESMTP id ABD8D78650 for ; Wed, 22 Nov 2017 16:04:17 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id u83so11448467wmb.5 for ; Wed, 22 Nov 2017 08:04:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=JHM5K9Di1+ACRfo35mLMVIS8wabsImta+0RLVTzDDQ4=; b=IwsocCbdmlHiIfzvrOvBY8WNrB83HmKVPRraCyMyads2qaH9XFgLYnitWVbAzDAs+x 6Cc2KXEuCKdkM9jKf4baSqZ1W2HbJXrtMYOIn3PfNwENjWZC7ftSI3zzfZvN9/kAJGPK rcidY7jJlFKzsbAqoqD6WZDq056tCMPt+3iXBq0nfPFxLvOJo2E4WvjNqJnK0AQrRyQG aJKVQkbw0Ju1ck6a3v99WNf0Jk0ZQgbsuvB3Z2mPv4dokCuxcvtsBxcRXrOVtobQwUQc FsS6AQBDxgYnw8c4HH6r2mFOqtBg3Z/Y2WrdM6El8bpLisWoNihwKkb/AIvQzNACF6Iv uMxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=JHM5K9Di1+ACRfo35mLMVIS8wabsImta+0RLVTzDDQ4=; b=hkJ2FFYyaF3Qz8lOMBRD4D0DakbF3qxZUMTNPGrd+e0bFlqFrXEWtx0Yk7nzbV6qio 6j0pVOcwQq1pj8ibr9FVJ0IKlzq88u1r0lJCTu41tDpZy/RF3An/aanXEPfcGX6w0ppY P8zglnVNQbAfC24EHe1hS/2fgQfzCSNEhzCed2/iOgFWU+MEdz7Dd3LcbwOfwWNqqnBO sOSoOGzM7s1XXKX6/FC0VIbQRq1OVXgf25NUindvMVFYRh5qiRF44auvHg6EXfyr6Zxf nIrvICas1UvI/4Fu4zAJZWS2oBQ5U20yhgrzPjjoSK3/onFPaN4raHrr6yt4/9BRuwIN IzZw== X-Gm-Message-State: AJaThX7kl+chDDcSv5tdmEeL+CwqzqPv6Pw3AwITJfw+FmDY4GP6g0gx vZDnfU7Rm7IxGPSDKs79zgGCWqnQ X-Received: by 10.28.158.212 with SMTP id h203mr4579741wme.157.1511366657929; Wed, 22 Nov 2017 08:04:17 -0800 (PST) Received: from flashheart.burtonini.com (home.burtonini.com. [81.2.106.35]) by smtp.gmail.com with ESMTPSA id k30sm28923728wrf.63.2017.11.22.08.04.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 08:04:17 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Date: Wed, 22 Nov 2017 16:04:12 +0000 Message-Id: <20171122160414.14093-1-ross.burton@intel.com> X-Mailer: git-send-email 2.11.0 Subject: [OE-core] [PATCH 1/3] oeqa/commands: don't break if get_bb_vars is passed a tuple X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: openembedded-core-bounces@lists.openembedded.org Errors-To: openembedded-core-bounces@lists.openembedded.org get_bb_vars was using variables.copy() to duplicate the list of variables passed but this function only exists in lists [1,2] and not tuples (1,2). Instead of throwing an exception if the variables are in a tuple, simply construct a new list using the passed sequence-like object. Signed-off-by: Ross Burton --- meta/lib/oeqa/utils/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.11.0 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py index 0bb90028dc6..cad0bea0be9 100644 --- a/meta/lib/oeqa/utils/commands.py +++ b/meta/lib/oeqa/utils/commands.py @@ -227,7 +227,7 @@ def get_bb_vars(variables=None, target=None, postconfig=None): bbenv = get_bb_env(target, postconfig=postconfig) if variables is not None: - variables = variables.copy() + variables = list(variables) var_re = re.compile(r'^(export )?(?P\w+(_.*)?)="(?P.*)"$') unset_re = re.compile(r'^unset (?P\w+)$') lastline = None From patchwork Wed Nov 22 16:04:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 119497 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp355510qgn; Wed, 22 Nov 2017 08:04:33 -0800 (PST) X-Google-Smtp-Source: AGs4zMZJ5EbmJF74zS1uTBARg9dFffg0rAjwurS3N3GU2H7THA1AkFA6o/t6BPzBoa857MIDnDSC X-Received: by 10.159.216.131 with SMTP id s3mr21598410plp.432.1511366672908; Wed, 22 Nov 2017 08:04:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511366672; cv=none; d=google.com; s=arc-20160816; b=sjV8pttY/rCCkthJpXazVzZm5YfNUPC2Le1G8Pz9eedqMTO1NoOdptbj55SzXBmOAe zRauKZ6lDulGfyQ9FmbOvHgFoP90N+9PnCTN1OQLX/PU/cJT8R2ky4b6tYdKIMv7lUOD RqUNML7PAyzlAOA+vH7Uq8ZO3fyh71EPczQhiVeG8ad4lvl4Y2fq0v3qN876gAbh3BZI 9auIDfVylXtTAKjEKqlUjh0z1sHMbQr08zbayoljACtXeu5iL2REmMxodMPwW/NSG/LV YyOIc4syaDyPcK64xtDhwhz9A+1+qkCQYIbq2LLf5yaa3mgl/smqu/poUmgH3iv+9yz/ 4owQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=0GT6vwiDLExKeRrwDhrUjvZIh/wGszoEkhaRcf7rCr4=; b=oXr3RyMCiE1MtkX0CDih6vqaafz+OBwl3fgwAm1GMdBOdMdlmKCYT/A/P8dUcWRB/l VrWgG3zVlmS6Gy+vZKZF1UXma2BvX4DRBZtowgGuwK/hpwKV60fe6Jg4p0jTpO/YYpc4 pLyhpVoK+igaJwWItdd1C0dV3lKihAK0/Bgee8WTkk7TLnWmoG7grffiNvfmAlUoortu 78S4NKd+NGTQrUMtz5CFsiGqBriQlxWM3Clljf8MXTU08hFnjQAZmAtek/92ITz2kw9i 2X2pp77gV/dK4ZZ+1m/xB3I1oYupvtUnN6xg4sNu/RRRZ+9slhFd7bAeXQrwLHLGkT90 4csw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=gFoNH55q; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id r22si4940563pgo.706.2017.11.22.08.04.32; Wed, 22 Nov 2017 08:04:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=gFoNH55q; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org Received: from review.yoctoproject.org (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id C85E37872A; Wed, 22 Nov 2017 16:04:29 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by mail.openembedded.org (Postfix) with ESMTP id 88F9378650 for ; Wed, 22 Nov 2017 16:04:18 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id r68so11309629wmr.1 for ; Wed, 22 Nov 2017 08:04:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=8sh5QGQfUJ4BwKz1TS2kb4UsFvJeJJ6se0J9LfxieFs=; b=gFoNH55qK/SVrgA5sWDgbcz1EFIZXxgu8XYYHjocn6BPZUYQj0DNjCFhVkHSOyzZw4 CPtF8iX8/PJxRXz8/c3ffu+sY0viQrjQCfstq3Ragmmwiq2CTR/CJsqHnEh0qbcswYVM HgW4bGHwuJuKYn1GH+5LS8IBcDJ3ZdDZ8AFQEteWds6Zfg3CbfJWts3c9pxKe878Fr1c HxWss8HdadygFh/cQLFP0h3ZJx0AhFgmxYl+GmJNGsZFIfkIIkTGoQRVR7avqLcDP8Mu U9E94LWpVESjvw/yq5DHV2i7mMPAlb+H4ifQ4puh6ccq4yARUsps5osMxwuZLoOR53EI CO6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=8sh5QGQfUJ4BwKz1TS2kb4UsFvJeJJ6se0J9LfxieFs=; b=gUSHqDEw+xdqn8w8mMtky5bE3JzTuUOmxfFjcNeEIMy/dXOQ27TUliP3UU5p6BW6rP gWX5K66ZIDhcvty1tcAg5Fu8MYRa37ionsJQ7EcvzcNrQjaIH6ucAyGtFL4Mjvf05+Rw viB/7YuRp1+yryDAC/aJIrobffU1cAwdPw7YIGYsY9WUKSZyscyIBSPTNnt7bFRLyUik p/6eI/vhDYIvrzeNTPmCTwBTVN3EhLvpTAu9xKwjYHhWiVDkecHthKsoc7WnjQNiKcL5 JdKwbpxcfpUXrxTLuHnx6KEGW2PQKAt5sioCDVmFNc0KquCbWJNaf5QfDTTrLlEmWyYi VAEw== X-Gm-Message-State: AJaThX726kz9SNEQBo6a/oMQkGAGQ0Dpa9R+CEuU9AMS8z+9Kl2C913b 325Lob4d3vriIn8K7oylpRlyafa6 X-Received: by 10.28.157.7 with SMTP id g7mr4132444wme.99.1511366658985; Wed, 22 Nov 2017 08:04:18 -0800 (PST) Received: from flashheart.burtonini.com (home.burtonini.com. [81.2.106.35]) by smtp.gmail.com with ESMTPSA id k30sm28923728wrf.63.2017.11.22.08.04.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 08:04:18 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Date: Wed, 22 Nov 2017 16:04:13 +0000 Message-Id: <20171122160414.14093-2-ross.burton@intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171122160414.14093-1-ross.burton@intel.com> References: <20171122160414.14093-1-ross.burton@intel.com> Subject: [OE-core] [PATCH 2/3] postinst: fix and simplify the postinst test recipe X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: openembedded-core-bounces@lists.openembedded.org Errors-To: openembedded-core-bounces@lists.openembedded.org Reduce the number of packages, and fix some syntax and logic errors in the scripts. Signed-off-by: Ross Burton --- .../recipes-test/postinst/postinst_1.0.bb | 158 +++++++-------------- 1 file changed, 51 insertions(+), 107 deletions(-) -- 2.11.0 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core diff --git a/meta-selftest/recipes-test/postinst/postinst_1.0.bb b/meta-selftest/recipes-test/postinst/postinst_1.0.bb index 6d497342779..112aa08c80f 100644 --- a/meta-selftest/recipes-test/postinst/postinst_1.0.bb +++ b/meta-selftest/recipes-test/postinst/postinst_1.0.bb @@ -1,126 +1,70 @@ +SUMMARY = "Packages to exercise postinstall functions" LICENSE = "MIT" -ALLOW_EMPTY_${PN}-at-rootfs = "1" + +inherit allarch + +PACKAGES = "${PN}-rootfs ${PN}-delayed-a ${PN}-delayed-b" + +ALLOW_EMPTY_${PN}-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-a = "${PN}-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" - touch "$D"/this-was-created-at-rootfstime - if test "x$D" != "x" then - # Need to run on first boot + +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 - else - echo "lets write postinst" > $tfile fi + + mkdir -p $D${TESTDIR} + touch $D${TESTDIR}/rootfs } -# Dependency recipes post-installs +# Depends on rootfs, delays until first boot, verifies that the rootfs file was +# written. 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 - touch /etc/this-was-created-at-first-boot - if test -e $efile ; then - echo 'success' > $tfile - else - echo 'fail to install $rdeps first!' >&2 + set -e + + if [ -n "$D" ]; then + echo "Delaying ${PN}-delayed-a until first boot" exit 1 - fi - 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 + if [ ! -e ${TESTDIR}/rootfs ]; then + echo "${PN}-delayed-a: ${TESTDIR}/rootfs not found" exit 1 - fi - fi + fi + + touch ${TESTDIR}/delayed-a } -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 +# 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 () { + set -e + + if [ -n "$D" ]; then + echo "Delaying ${PN}-delayed-b until first boot" exit 1 - fi - 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 + if [ ! -e ${TESTDIR}/delayed-a ]; then + echo "${PN}-delayed-b: ${TESTDIR}/delayed-a not found" exit 1 - fi - 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 + touch ${TESTDIR}/delayed-b } From patchwork Wed Nov 22 16:04:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 119498 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp355671qgn; Wed, 22 Nov 2017 08:04:39 -0800 (PST) X-Google-Smtp-Source: AGs4zMY9CUGrZ2A9l2gcyPO7ZWyvogytqFQopK2hlRrT742iGEOQ4qkTISVuu43ImkdAN0GBRDMN X-Received: by 10.98.12.212 with SMTP id 81mr19660826pfm.88.1511366679074; Wed, 22 Nov 2017 08:04:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511366679; cv=none; d=google.com; s=arc-20160816; b=q/c5Dc0Ws1uocVU/Ya//6M8f6OEk1mbN3KjDFsCKm81/TzWmkl8HoEfHl6xABxaipp NTbSRw5qPZDXLK9UNm7rHPkl+cmDl5ETu83oXmzSMOeSVJMTQ1feo56TuVWVoEXgGao5 4MU5C0mKJC6TM8tyt4qyNc+6eiYiS1Kd/4NHToEGpzZPvhfgeaHuY6UoS73qgbU3IwmY VUkHVHp+e0nHMd7y5iT+8QeXb+9pCghbhlxKznkTISjedj9iofmGwkRA9qzLhN5IpP+W pAvnytMiH8jL45sc2X5Sv2ZAs32Zs2ATwEWSfRqK6gziJDUU2v9aq4zcXHInw+0Amb6s 5scA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=GOOdo6yon7hh8x5nUKoRahwj0WMPrrn1eBXQMwfp058=; b=haFJdHd+ZlpSqtrm4Ko/TTuh8CCHZBdC2e91zzBmI7PjN8R9/ouqR1lR9ur/gt+xdS rauMh57T2u9bUlbiX/Y7s02kODUkdO/JuqoVinCPxE3jMhNSFAN7+aCLe0ineu21LRls sehwvQlY/BGllchi098HeIc1p2xIo/aiLY0ndeJp5yB1xVLyrBLBEczwD8G+Vns2fjM4 iKRhYdNfyPaY8BUpK2khdRkG6Zwe39Xq15sBE29caytwpLiylkxkuxStvTjgZVvqz7eo 81PLFp6+IVc25dUaXXhsJMDOjceQQoIMSuFQ/7OaxVJtvFYfMqdJClnYs2aMIXjO71mw sQAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=agrPAZgC; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id r19si9575139pgv.315.2017.11.22.08.04.38; Wed, 22 Nov 2017 08:04:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=agrPAZgC; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org Received: from review.yoctoproject.org (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id 00626787BE; Wed, 22 Nov 2017 16:04:34 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-wr0-f179.google.com (mail-wr0-f179.google.com [209.85.128.179]) by mail.openembedded.org (Postfix) with ESMTP id B9EBE78702 for ; Wed, 22 Nov 2017 16:04:19 +0000 (UTC) Received: by mail-wr0-f179.google.com with SMTP id u40so14966202wrf.10 for ; Wed, 22 Nov 2017 08:04:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=Q3EwFlWk0KN5ppym7kgRH+4C74A1826pw4Z9VX4Uyu4=; b=agrPAZgCefsZl6u/iM8Azi7VsD6mm5Ms6E9PwLD6jpA3FQJKOsY7VcvlLxEJyPekfr zlY5k15D7JTQy5Gr+7QJCO4bX3XJYlrnlmOt0S4LyhLUzTjXk4JnstfOTMhOOG2vkjvD gk6rcwa0QtQ4O2udjg9D4OQvxj1LWf4XU2MDgeqj5KrsL3Ulkmxi/sL5cdYpIW/TJl/n W0xqbhTTCZpQOr3H+YE31YXl3kHRNxj0Dyz0XHjvrMbYnoCNV+Wspj9WNkTW6lndb4VR 8PhVOTlmQeg4R8aRZYBjp4n74HzYfEV9BnFC0jzOPllu0bkJcyWdyztgOjH49/t6snbG FZUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Q3EwFlWk0KN5ppym7kgRH+4C74A1826pw4Z9VX4Uyu4=; b=g7e4oeyzbm2qbKo49+wlJnwdbOAeT6B/I7yNGa5a88H3dqg/0xf8K7eA/1TnOHSqP8 VJNTdMWBqZslcj65BnTIoUEfVPWZLVkJt8rxgFFqUvXKdS2Q7K1oxmmTvEcZ5AA2AHTc PIK3+5mFKeP96pTrW2BKAlCW8u9b21+GvE0s2Kp5lB0yCeHkk49UGxkPAx0+iIyUY1xj LiQHZ3ipyQZsur8o89/s2NC87GSl/lBnOgwNpL4EqbllhBJBS6R3tpY6l5/WeY4EAZ1B YQo2ZWieSGIhLU6rkHCBH5+6/rCoXh4VB9CCMcG5HY0BXcv4SZ9D2cWXNYbSjpcnSg+S Rtgw== X-Gm-Message-State: AJaThX4RbErX+hB5h14L3jDPG/rVs1G9cqhzWd/gwkKi9iZt/+jcQYBj k0ELI1en8oh6Lfl0kWMt6Pw+snBn X-Received: by 10.223.150.2 with SMTP id b2mr19694668wra.185.1511366660133; Wed, 22 Nov 2017 08:04:20 -0800 (PST) Received: from flashheart.burtonini.com (home.burtonini.com. [81.2.106.35]) by smtp.gmail.com with ESMTPSA id k30sm28923728wrf.63.2017.11.22.08.04.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Nov 2017 08:04:19 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Date: Wed, 22 Nov 2017 16:04:14 +0000 Message-Id: <20171122160414.14093-3-ross.burton@intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171122160414.14093-1-ross.burton@intel.com> References: <20171122160414.14093-1-ross.burton@intel.com> Subject: [OE-core] [PATCH 3/3] oeqa/selftest/runtime_test: simplify postinst testing X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: openembedded-core-bounces@lists.openembedded.org Errors-To: openembedded-core-bounces@lists.openembedded.org Update the packages and file names to reflect the new postinst recipe. Fix a sh syntax error in the run_serial file exists test which was hidden by a logic problem in the status code. Remove the older test_verify_postinst as it's effectively a subset of test_postinst_rootfs_and_boot, and doesn't work: when booting under systemd the strings it searches for are not output to the console, but the test still passes. Signed-off-by: Ross Burton --- meta/lib/oeqa/selftest/cases/runtime_test.py | 82 +++++++--------------------- 1 file changed, 19 insertions(+), 63 deletions(-) -- 2.11.0 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py index 25270b7535b..1c69255b568 100644 --- a/meta/lib/oeqa/selftest/cases/runtime_test.py +++ b/meta/lib/oeqa/selftest/cases/runtime_test.py @@ -167,55 +167,6 @@ class TestImage(OESelftestTestCase): class Postinst(OESelftestTestCase): @OETestID(1540) - def test_verify_postinst(self): - """ - Summary: The purpose of this test is to verify the execution order of postinst Bugzilla ID: [5319] - Expected : - 1. Compile a minimal image. - 2. The compiled image will add the created layer with the recipes postinst[ abdpt] - 3. Run qemux86 - 4. Validate the task execution order - Author: Francisco Pedraza - """ - features = 'INHERIT += "testimage"\n' - features += 'CORE_IMAGE_EXTRA_INSTALL += "postinst-at-rootfs \ -postinst-delayed-a \ -postinst-delayed-b \ -postinst-delayed-d \ -postinst-delayed-p \ -postinst-delayed-t \ -"\n' - self.write_config(features) - - bitbake('core-image-minimal -f ') - - postinst_list = ['100-postinst-at-rootfs', - '101-postinst-delayed-a', - '102-postinst-delayed-b', - '103-postinst-delayed-d', - '104-postinst-delayed-p', - '105-postinst-delayed-t'] - path_workdir = get_bb_var('WORKDIR','core-image-minimal') - workspacedir = 'testimage/qemu_boot_log' - workspacedir = os.path.join(path_workdir, workspacedir) - rexp = re.compile("^Running postinst .*/(?P.*)\.\.\.$") - with runqemu('core-image-minimal') as qemu: - with open(workspacedir) as f: - found = False - idx = 0 - for line in f.readlines(): - line = line.strip().replace("^M","") - if not line: # To avoid empty lines - continue - m = rexp.search(line) - if m: - self.assertEqual(postinst_list[idx], m.group('postinst'), "Fail") - idx = idx+1 - found = True - elif found: - self.assertEqual(idx, len(postinst_list), "Not found all postinsts") - break - @OETestID(1545) def test_postinst_rootfs_and_boot(self): """ @@ -234,16 +185,22 @@ postinst-delayed-t \ for initialization managers: sysvinit and systemd. """ - file_rootfs_name = "this-was-created-at-rootfstime" - fileboot_name = "this-was-created-at-first-boot" - rootfs_pkg = 'postinst-at-rootfs' - boot_pkg = 'postinst-delayed-a' + + import oe.path + + vars = get_bb_vars(("IMAGE_ROOTFS", "sysconfdir"), "core-image-minimal") + rootfs = vars["IMAGE_ROOTFS"] + self.assertIsNotNone(rootfs) + sysconfdir = vars["sysconfdir"] + self.assertIsNotNone(sysconfdir) + # Need to use oe.path here as sysconfdir starts with / + hosttestdir = oe.path.join(rootfs, sysconfdir, "postinst-test") + targettestdir = os.path.join(sysconfdir, "postinst-test") for init_manager in ("sysvinit", "systemd"): for classes in ("package_rpm", "package_deb", "package_ipk"): with self.subTest(init_manager=init_manager, package_class=classes): - features = 'MACHINE = "qemux86"\n' - features += 'CORE_IMAGE_EXTRA_INSTALL += "%s %s "\n'% (rootfs_pkg, boot_pkg) + features = 'CORE_IMAGE_EXTRA_INSTALL = "postinst-delayed-b"\n' features += 'IMAGE_FEATURES += "package-management empty-root-password"\n' features += 'PACKAGE_CLASSES = "%s"\n' % classes if init_manager == "systemd": @@ -255,13 +212,12 @@ postinst-delayed-t \ bitbake('core-image-minimal') - file_rootfs_created = os.path.join(get_bb_var('IMAGE_ROOTFS', "core-image-minimal"), - file_rootfs_name) - found = os.path.isfile(file_rootfs_created) - self.assertTrue(found, "File %s was not created at rootfs time by %s" % \ - (file_rootfs_name, rootfs_pkg)) + self.assertTrue(os.path.isfile(os.path.join(hosttestdir, "rootfs")), + "rootfs state file was not created") - testcommand = 'ls /etc/' + fileboot_name with runqemu('core-image-minimal') as qemu: - status, output = qemu.run_serial("-f /etc/" + fileboot_name) - self.assertEqual(status, 0, 'File %s was not created at first boot (%s)' % (fileboot_name, output)) + # Make the test echo a string and search for that as + # run_serial()'s status code is useless.' + for filename in ("rootfs", "delayed-a", "delayed-b"): + status, output = qemu.run_serial("test -f %s && echo found" % os.path.join(targettestdir, filename)) + self.assertEqual(output, "found", "%s was not present on boot" % filename)