[v2,4/4] CI: expect a message about filesystem resize vom expand script

Message ID 20221114174053.13258-5-henning.schild@siemens.com
State Superseded, archived
Headers show
Series [v2,1/4] CI: improve cibuilder readability | expand

Commit Message

Henning Schild Nov. 14, 2022, 5:40 p.m. UTC
We have added the expand-on-first-boot recipe and some space to grow to
our example images. So now any image using wic should "expand" on its
first boot. And the kernel actually leaves a message for us to read, at
least on debian but not on ubuntu.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 testsuite/cibuilder.py | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

Comments

Henning Schild Nov. 16, 2022, 7:58 a.m. UTC | #1
Am Mon, 14 Nov 2022 18:40:53 +0100
schrieb Henning Schild <henning.schild@siemens.com>:

> We have added the expand-on-first-boot recipe and some space to grow
> to our example images. So now any image using wic should "expand" on
> its first boot. And the kernel actually leaves a message for us to
> read, at least on debian but not on ubuntu.
> 
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>  testsuite/cibuilder.py | 21 ++++++++++++++++++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
> index 07a9edc56d9c..ec44b5756b15 100755
> --- a/testsuite/cibuilder.py
> +++ b/testsuite/cibuilder.py
> @@ -231,6 +231,18 @@ class CIBuilder(Test):
>          login_prompt = b'isar login:'
>          # the printk of recipes-kernel/example-module
>          module_output = b'Just an example'
> +        # output we see when expand-on-first-boot runs on ext4
> +        resize_output = b'resized filesystem to'
> +        expecting_resize = False
> +
> +        bb_output = get_bitbake_env(arch, distro).decode()

the get_bitbake calls need a start_vm. prefix

Henning

> +        wks_file = get_bitbake_var(bb_output, 'WKS_FILE')
> +        if wks_file and "sdimage-efi" in wks_file:
> +            bbdistro = get_bitbake_var(bb_output, 'DISTRO')
> +            # ubuntu is less verbose so we do not see the message
> +            # /etc/sysctl.d/10-console-messages.conf
> +            if bbdistro and "ubuntu" not in bbdistro:
> +                expecting_resize = True
>  
>          timeout = time.time() + int(time_to_wait)
>  
> @@ -265,8 +277,11 @@ class CIBuilder(Test):
>              with open(output_file, "rb") as f1:
>                  data = f1.read()
>                  if module_output in data and login_prompt in data:
> -                    return
> -                else:
> -                    app_log.error(data.decode(errors='replace'))
> +                    if expecting_resize:
> +                        if resize_output in data:
> +                            return
> +                    else:
> +                        return
> +                app_log.error(data.decode(errors='replace'))
>  
>          self.fail('Log ' + output_file)

Patch

diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index 07a9edc56d9c..ec44b5756b15 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -231,6 +231,18 @@  class CIBuilder(Test):
         login_prompt = b'isar login:'
         # the printk of recipes-kernel/example-module
         module_output = b'Just an example'
+        # output we see when expand-on-first-boot runs on ext4
+        resize_output = b'resized filesystem to'
+        expecting_resize = False
+
+        bb_output = get_bitbake_env(arch, distro).decode()
+        wks_file = get_bitbake_var(bb_output, 'WKS_FILE')
+        if wks_file and "sdimage-efi" in wks_file:
+            bbdistro = get_bitbake_var(bb_output, 'DISTRO')
+            # ubuntu is less verbose so we do not see the message
+            # /etc/sysctl.d/10-console-messages.conf
+            if bbdistro and "ubuntu" not in bbdistro:
+                expecting_resize = True
 
         timeout = time.time() + int(time_to_wait)
 
@@ -265,8 +277,11 @@  class CIBuilder(Test):
             with open(output_file, "rb") as f1:
                 data = f1.read()
                 if module_output in data and login_prompt in data:
-                    return
-                else:
-                    app_log.error(data.decode(errors='replace'))
+                    if expecting_resize:
+                        if resize_output in data:
+                            return
+                    else:
+                        return
+                app_log.error(data.decode(errors='replace'))
 
         self.fail('Log ' + output_file)