diff mbox series

[6/8] tests/vm: add --boot-console switch

Message ID 20200124165335.422-7-robert.foley@linaro.org
State New
Headers show
Series tests/vm: Add support for aarch64 VMs | expand

Commit Message

Robert Foley Jan. 24, 2020, 4:53 p.m. UTC
Added ability to view console during boot via
--boot-console switch.  This helps debug issues that occur
during the boot sequence.

Signed-off-by: Robert Foley <robert.foley@linaro.org>
Reviewed-by: Peter Puhov <peter.puhov@linaro.org>
---
 tests/vm/basevm.py | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Alex Bennée Jan. 27, 2020, 12:56 p.m. UTC | #1
Robert Foley <robert.foley@linaro.org> writes:

> Added ability to view console during boot via
> --boot-console switch.  This helps debug issues that occur
> during the boot sequence.
>
> Signed-off-by: Robert Foley <robert.foley@linaro.org>
> Reviewed-by: Peter Puhov <peter.puhov@linaro.org>
> ---
>  tests/vm/basevm.py | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
> index 08a8989ac0..aa8b39beb7 100755
> --- a/tests/vm/basevm.py
> +++ b/tests/vm/basevm.py
> @@ -489,6 +489,8 @@ def parse_args(vmcls):
>      parser.add_option("--config", "-c", default=None,
>                        help="Provide config yaml for configuration. "\
>                             "See config_example.yaml for example.")
> +    parser.add_option("--boot-console", action="store_true",
> +                      help="Show console during boot. ")
>      parser.disable_interspersed_args()
>      return parser.parse_args()
>  
> @@ -523,6 +525,10 @@ def main(vmcls, config=None):
>          if args.snapshot:
>              img += ",snapshot=on"
>          vm.boot(img)
> +        wait_boot = getattr(vm, "wait_boot", None)

Didn't we add a __getattr method, so we can do self._config['wait_boot']

> +        if args.boot_console and callable(wait_boot):
> +            vm.console_init()
> +            wait_boot()

isn't wait_boot always callable because it's part of the basevm?

>          vm.wait_ssh()
>      except Exception as e:
>          if isinstance(e, SystemExit) and e.code == 0:
Robert Foley Jan. 27, 2020, 2:13 p.m. UTC | #2
On Mon, 27 Jan 2020 at 07:56, Alex Bennée <alex.bennee@linaro.org> wrote:
> > @@ -523,6 +525,10 @@ def main(vmcls, config=None):
> >          if args.snapshot:
> >              img += ",snapshot=on"
> >          vm.boot(img)
> > +        wait_boot = getattr(vm, "wait_boot", None)
>
> Didn't we add a __getattr method, so we can do self._config['wait_boot']
>
> > +        if args.boot_console and callable(wait_boot):
> > +            vm.console_init()
> > +            wait_boot()
>
> isn't wait_boot always callable because it's part of the basevm?

My bad.  Missed changing this after moving the method into the base class.
Yes, we should change it to something simpler like:
if args.boot_console:
            vm.console_init()
            self.wait_boot()

Thanks & Regards,
-Rob
>
> >          vm.wait_ssh()
> >      except Exception as e:
> >          if isinstance(e, SystemExit) and e.code == 0:
>
>
> --
> Alex Bennée
diff mbox series

Patch

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 08a8989ac0..aa8b39beb7 100755
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -489,6 +489,8 @@  def parse_args(vmcls):
     parser.add_option("--config", "-c", default=None,
                       help="Provide config yaml for configuration. "\
                            "See config_example.yaml for example.")
+    parser.add_option("--boot-console", action="store_true",
+                      help="Show console during boot. ")
     parser.disable_interspersed_args()
     return parser.parse_args()
 
@@ -523,6 +525,10 @@  def main(vmcls, config=None):
         if args.snapshot:
             img += ",snapshot=on"
         vm.boot(img)
+        wait_boot = getattr(vm, "wait_boot", None)
+        if args.boot_console and callable(wait_boot):
+            vm.console_init()
+            wait_boot()
         vm.wait_ssh()
     except Exception as e:
         if isinstance(e, SystemExit) and e.code == 0: