All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Test needed to verify postinst script order.
@ 2016-11-16  0:50 Francisco Pedraza
  2016-11-17 12:14 ` Burton, Ross
  0 siblings, 1 reply; 5+ messages in thread
From: Francisco Pedraza @ 2016-11-16  0:50 UTC (permalink / raw)
  To: openembedded-core; +Cc: Francisco Pedraza

Will verify the following:
1. Compile a minimal image.
2. The compiled image will add the created layer with the
recipes postinstz postinsta postinstb postinstd postinstp postinstt
created previously at "meta-selftest/recipes-test"
2. Run qemu
3. Validate the task execution order.
V4

Signed-off-by: Francisco Pedraza <francisco.j.pedraza.gonzalez@intel.com>
---
 .../recipes-test/postinsta/postinsta_1.0.bb        | 20 +++++++++++
 .../recipes-test/postinstb/postinstb_1.0.bb        | 22 ++++++++++++
 .../recipes-test/postinstd/postinstd_1.0.bb        | 22 ++++++++++++
 .../recipes-test/postinstp/postinstp_1.0.bb        | 22 ++++++++++++
 .../recipes-test/postinstt/postinstt_1.0.bb        | 22 ++++++++++++
 .../recipes-test/postinstz/postinstz_1.0.bb        | 12 +++++++
 meta/lib/oeqa/selftest/runtime-test.py             | 40 ++++++++++++++++++++++
 7 files changed, 160 insertions(+)
 create mode 100644 meta-selftest/recipes-test/postinsta/postinsta_1.0.bb
 create mode 100644 meta-selftest/recipes-test/postinstb/postinstb_1.0.bb
 create mode 100644 meta-selftest/recipes-test/postinstd/postinstd_1.0.bb
 create mode 100644 meta-selftest/recipes-test/postinstp/postinstp_1.0.bb
 create mode 100644 meta-selftest/recipes-test/postinstt/postinstt_1.0.bb
 create mode 100644 meta-selftest/recipes-test/postinstz/postinstz_1.0.bb

diff --git a/meta-selftest/recipes-test/postinsta/postinsta_1.0.bb b/meta-selftest/recipes-test/postinsta/postinsta_1.0.bb
new file mode 100644
index 0000000..2e69a85
--- /dev/null
+++ b/meta-selftest/recipes-test/postinsta/postinsta_1.0.bb
@@ -0,0 +1,20 @@
+LICENSE = "MIT"
+
+RDEPENDS_${PN} = "postinstz"
+
+ALLOW_EMPTY_${PN} = "1"
+
+pkg_postinst_${PN} () {
+   if test "x$D" != "x"; then
+      # Need to run on first boot
+      exit 1
+   else
+      if test -e /etc/postinstz-test ; then
+          echo 'success' > /etc/postinsta-test
+      else
+          echo 'fail to install postinstz first!' >&2
+          exit 1
+      fi
+   fi
+}
+
diff --git a/meta-selftest/recipes-test/postinstb/postinstb_1.0.bb b/meta-selftest/recipes-test/postinstb/postinstb_1.0.bb
new file mode 100644
index 0000000..447d777
--- /dev/null
+++ b/meta-selftest/recipes-test/postinstb/postinstb_1.0.bb
@@ -0,0 +1,22 @@
+SUMMARY = "Device formfactor information"
+SECTION = "base"
+LICENSE = "MIT"
+
+RDEPENDS_${PN} = "postinsta"
+
+ALLOW_EMPTY_${PN} = "1"
+
+pkg_postinst_${PN} () {
+   if test "x$D" != "x"; then
+      # Need to run on first boot
+      exit 1
+   else
+      if test -e /etc/postinsta-test ; then
+          echo 'success' > /etc/postinstb-test
+      else
+          echo 'fail to install postinsta first!' >&2
+          exit 1
+      fi
+   fi
+}
+
diff --git a/meta-selftest/recipes-test/postinstd/postinstd_1.0.bb b/meta-selftest/recipes-test/postinstd/postinstd_1.0.bb
new file mode 100644
index 0000000..939f60e
--- /dev/null
+++ b/meta-selftest/recipes-test/postinstd/postinstd_1.0.bb
@@ -0,0 +1,22 @@
+SUMMARY = "Device formfactor information"
+SECTION = "base"
+LICENSE = "MIT"
+
+RDEPENDS_${PN} = "postinstb"
+
+ALLOW_EMPTY_${PN} = "1"
+
+pkg_postinst_${PN} () {
+   if test "x$D" != "x"; then
+      # Need to run on first boot
+      exit 1
+   else
+      if test -e /etc/postinstb-test ; then
+          echo 'success' > /etc/postinstd-test
+      else
+          echo 'fail to install postinstb first!' >&2
+          exit 1
+      fi
+   fi
+}
+
diff --git a/meta-selftest/recipes-test/postinstp/postinstp_1.0.bb b/meta-selftest/recipes-test/postinstp/postinstp_1.0.bb
new file mode 100644
index 0000000..a5210b1
--- /dev/null
+++ b/meta-selftest/recipes-test/postinstp/postinstp_1.0.bb
@@ -0,0 +1,22 @@
+SUMMARY = "Device formfactor information"
+SECTION = "base"
+LICENSE = "MIT"
+
+RDEPENDS_${PN} = "postinstd"
+
+ALLOW_EMPTY_${PN} = "1"
+
+pkg_postinst_${PN} () {
+   if test "x$D" != "x"; then
+      # Need to run on first boot
+      exit 1
+   else
+      if test -e /etc/z-test ; then
+          echo 'success' > /etc/postinstp-test
+      else
+          echo 'fail to install postinstd first!' >&2
+          exit 1
+      fi
+   fi
+}
+
diff --git a/meta-selftest/recipes-test/postinstt/postinstt_1.0.bb b/meta-selftest/recipes-test/postinstt/postinstt_1.0.bb
new file mode 100644
index 0000000..25c279b
--- /dev/null
+++ b/meta-selftest/recipes-test/postinstt/postinstt_1.0.bb
@@ -0,0 +1,22 @@
+SUMMARY = "Device formfactor information"
+SECTION = "base"
+LICENSE = "MIT"
+
+RDEPENDS_${PN} = "postinstp"
+
+ALLOW_EMPTY_${PN} = "1"
+
+pkg_postinst_${PN} () {
+   if test "x$D" != "x"; then
+      # Need to run on first boot
+      exit 1
+   else
+      if test -e /etc/postinstp-test ; then
+          echo 'success' > /etc/postinstt-test
+      else
+          echo 'fail to install postinstp first!' >&2
+          exit 1
+      fi
+   fi
+}
+
diff --git a/meta-selftest/recipes-test/postinstz/postinstz_1.0.bb b/meta-selftest/recipes-test/postinstz/postinstz_1.0.bb
new file mode 100644
index 0000000..79abd74
--- /dev/null
+++ b/meta-selftest/recipes-test/postinstz/postinstz_1.0.bb
@@ -0,0 +1,12 @@
+LICENSE = "MIT"
+
+ALLOW_EMPTY_${PN} = "1"
+pkg_postinst_${PN} (){
+    if test "x$D" != "x"' then
+        # Need to run on first boot
+        exit 1
+    else
+        echo "lets write postinst_z" > /etc/postinstz-test
+    fi
+}
+
diff --git a/meta/lib/oeqa/selftest/runtime-test.py b/meta/lib/oeqa/selftest/runtime-test.py
index c2d5b45..888493b 100644
--- a/meta/lib/oeqa/selftest/runtime-test.py
+++ b/meta/lib/oeqa/selftest/runtime-test.py
@@ -2,6 +2,7 @@ from oeqa.selftest.base import oeSelfTest
 from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu
 from oeqa.utils.decorators import testcase
 import os
+import re
 
 class TestExport(oeSelfTest):
 
@@ -103,3 +104,42 @@ class TestImage(oeSelfTest):
         # Build core-image-sato and testimage
         bitbake('core-image-full-cmdline socat')
         bitbake('-c testimage core-image-full-cmdline')
+
+class Postinst(oeSelfTest):
+    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.
+        1. The compiled image will add the created layer with the recipes a b d p t z
+        2. Run qemux86
+        3. Validate the task execution order
+        """
+        features = 'INHERIT += "testimage"\n'
+        features += 'CORE_IMAGE_EXTRA_INSTALL += "postinstz postinsta postinstb postinstd postinstp postinstt"\n'
+        self.write_config(features)
+
+        bitbake('core-image-minimal -c cleansstate')
+        bitbake('core-image-minimal')
+
+        postinst_list = ['100-postinstz','101-postinsta','102-postinstb','103-postinstd','104-postinstp','105-postinstt']
+        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<postinst>.*)\.\.\.$")
+        with runqemu('core-image-minimal') as qemu:
+            with open(workspacedir) as f:
+                found = False
+                idx = 0 
+                for line in f.readlines():
+                    line = line.strip()
+                    line = line.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
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Test needed to verify postinst script order.
  2016-11-16  0:50 [PATCH] Test needed to verify postinst script order Francisco Pedraza
@ 2016-11-17 12:14 ` Burton, Ross
  2016-11-17 15:33   ` Jose Perez Carranza
  0 siblings, 1 reply; 5+ messages in thread
From: Burton, Ross @ 2016-11-17 12:14 UTC (permalink / raw)
  To: Francisco Pedraza; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 1217 bytes --]

On 16 November 2016 at 00:50, Francisco Pedraza <
francisco.j.pedraza.gonzalez@intel.com> wrote:

> Will verify the following:
> 1. Compile a minimal image.
> 2. The compiled image will add the created layer with the
> recipes postinstz postinsta postinstb postinstd postinstp postinstt
> created previously at "meta-selftest/recipes-test"
> 2. Run qemu
> 3. Validate the task execution order.
> V4
>

This is missing the test that some postinsts should be happening at rootfs
time.

Also, can it permute PACKAGE_CLASSES (rotate through all three options) so
it exercises all backends.

Signed-off-by: Francisco Pedraza <francisco.j.pedraza.gonzalez@intel.com>
> ---
>  .../recipes-test/postinsta/postinsta_1.0.bb        | 20 +++++++++++
>  .../recipes-test/postinstb/postinstb_1.0.bb        | 22 ++++++++++++
>  .../recipes-test/postinstd/postinstd_1.0.bb        | 22 ++++++++++++
>  .../recipes-test/postinstp/postinstp_1.0.bb        | 22 ++++++++++++
>  .../recipes-test/postinstt/postinstt_1.0.bb        | 22 ++++++++++++
>  .../recipes-test/postinstz/postinstz_1.0.bb        | 12 +++++++
>

For clarity can all of these be squashed into a single recipe with clearer
names?

Ross

[-- Attachment #2: Type: text/html, Size: 2458 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Test needed to verify postinst script order.
  2016-11-17 12:14 ` Burton, Ross
@ 2016-11-17 15:33   ` Jose Perez Carranza
  2016-11-17 18:20     ` Pedraza Gonzalez, Francisco J
  0 siblings, 1 reply; 5+ messages in thread
From: Jose Perez Carranza @ 2016-11-17 15:33 UTC (permalink / raw)
  To: Burton, Ross, Francisco Pedraza; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 1890 bytes --]



On 11/17/2016 06:14 AM, Burton, Ross wrote:
>
> On 16 November 2016 at 00:50, Francisco Pedraza 
> <francisco.j.pedraza.gonzalez@intel.com 
> <mailto:francisco.j.pedraza.gonzalez@intel.com>> wrote:
>
>     Will verify the following:
>     1. Compile a minimal image.
>     2. The compiled image will add the created layer with the
>     recipes postinstz postinsta postinstb postinstd postinstp postinstt
>     created previously at "meta-selftest/recipes-test"
>     2. Run qemu
>     3. Validate the task execution order.
>     V4
>
>
> This is missing the test that some postinsts should be happening at 
> rootfs time.
I have assigned the bug 8433 and I will send a different patch to add 
those test cases, I'm just waiting to the final implementation of this  
patch to be accepted to avoid execution and merge conflicts.
>
> Also, can it permute PACKAGE_CLASSES (rotate through all three 
> options) so it exercises all backends.
>
>     Signed-off-by: Francisco Pedraza
>     <francisco.j.pedraza.gonzalez@intel.com
>     <mailto:francisco.j.pedraza.gonzalez@intel.com>>
>     ---
>      .../recipes-test/postinsta/postinsta_1.0.bb
>     <http://postinsta_1.0.bb>        | 20 +++++++++++
>      .../recipes-test/postinstb/postinstb_1.0.bb
>     <http://postinstb_1.0.bb>        | 22 ++++++++++++
>      .../recipes-test/postinstd/postinstd_1.0.bb
>     <http://postinstd_1.0.bb>        | 22 ++++++++++++
>      .../recipes-test/postinstp/postinstp_1.0.bb
>     <http://postinstp_1.0.bb>        | 22 ++++++++++++
>      .../recipes-test/postinstt/postinstt_1.0.bb
>     <http://postinstt_1.0.bb>        | 22 ++++++++++++
>      .../recipes-test/postinstz/postinstz_1.0.bb
>     <http://postinstz_1.0.bb>        | 12 +++++++
>
>
> For clarity can all of these be squashed into a single recipe with 
> clearer names?
>
> Ross
>
>


[-- Attachment #2: Type: text/html, Size: 4774 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Test needed to verify postinst script order.
  2016-11-17 15:33   ` Jose Perez Carranza
@ 2016-11-17 18:20     ` Pedraza Gonzalez, Francisco J
  2016-11-18 12:59       ` Burton, Ross
  0 siblings, 1 reply; 5+ messages in thread
From: Pedraza Gonzalez, Francisco J @ 2016-11-17 18:20 UTC (permalink / raw)
  To: Jose Perez Carranza, Burton, Ross; +Cc: OE-core

Hi,
Sure I can send a patch with the updates.
Ross: Could you please give more details about PACKAGE_CLASSES?, I am not very familiar with.
Regards,
Paco
________________________________________
From: Jose Perez Carranza [jose.perez.carranza@linux.intel.com]
Sent: Thursday, November 17, 2016 7:33 AM
To: Burton, Ross; Pedraza Gonzalez, Francisco J
Cc: OE-core
Subject: Re: [OE-core] [PATCH] Test needed to verify postinst script order.

On 11/17/2016 06:14 AM, Burton, Ross wrote:

On 16 November 2016 at 00:50, Francisco Pedraza <francisco.j.pedraza.gonzalez@intel.com<mailto:francisco.j.pedraza.gonzalez@intel.com>> wrote:
Will verify the following:
1. Compile a minimal image.
2. The compiled image will add the created layer with the
recipes postinstz postinsta postinstb postinstd postinstp postinstt
created previously at "meta-selftest/recipes-test"
2. Run qemu
3. Validate the task execution order.
V4

This is missing the test that some postinsts should be happening at rootfs time.
I have assigned the bug 8433 and I will send a different patch to add those test cases, I'm just waiting to the final implementation of this  patch to be accepted to avoid execution and merge conflicts.

Also, can it permute PACKAGE_CLASSES (rotate through all three options) so it exercises all backends.

Signed-off-by: Francisco Pedraza <francisco.j.pedraza.gonzalez@intel.com<mailto:francisco.j.pedraza.gonzalez@intel.com>>
---
 .../recipes-test/postinsta/postinsta_1.0.bb<http://postinsta_1.0.bb>        | 20 +++++++++++
 .../recipes-test/postinstb/postinstb_1.0.bb<http://postinstb_1.0.bb>        | 22 ++++++++++++
 .../recipes-test/postinstd/postinstd_1.0.bb<http://postinstd_1.0.bb>        | 22 ++++++++++++
 .../recipes-test/postinstp/postinstp_1.0.bb<http://postinstp_1.0.bb>        | 22 ++++++++++++
 .../recipes-test/postinstt/postinstt_1.0.bb<http://postinstt_1.0.bb>        | 22 ++++++++++++
 .../recipes-test/postinstz/postinstz_1.0.bb<http://postinstz_1.0.bb>        | 12 +++++++

For clarity can all of these be squashed into a single recipe with clearer names?

Ross





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Test needed to verify postinst script order.
  2016-11-17 18:20     ` Pedraza Gonzalez, Francisco J
@ 2016-11-18 12:59       ` Burton, Ross
  0 siblings, 0 replies; 5+ messages in thread
From: Burton, Ross @ 2016-11-18 12:59 UTC (permalink / raw)
  To: Pedraza Gonzalez, Francisco J; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 788 bytes --]

On 17 November 2016 at 18:20, Pedraza Gonzalez, Francisco J <
francisco.j.pedraza.gonzalez@intel.com> wrote:

> Ross: Could you please give more details about PACKAGE_CLASSES?, I am not
> very familiar with.
>

See
http://www.yoctoproject.org/docs/2.2/ref-manual/ref-manual.html#var-PACKAGE_CLASSES

By setting it to "package_rpm package_ipk package_deb" you'll be build
packages for all formats, and then rotating the value so each format is
first when you build an image it will be built with each type of package.

For example:

for classes in ("package_rpm package_deb package_ipk",
                      "package_deb package_rpm package_ipk",
                       "package_ipk package_deb package_rpm"):
  PACKAGE_CLASSES=classes
  bitbake()
  qemu()

Ross

[-- Attachment #2: Type: text/html, Size: 1788 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-11-18 13:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-16  0:50 [PATCH] Test needed to verify postinst script order Francisco Pedraza
2016-11-17 12:14 ` Burton, Ross
2016-11-17 15:33   ` Jose Perez Carranza
2016-11-17 18:20     ` Pedraza Gonzalez, Francisco J
2016-11-18 12:59       ` Burton, Ross

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.