All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCHv2] support/scripts/boot-qemu-image.py: handle when pexpect.spawn() exit early
@ 2020-04-18 16:10 Romain Naour
  2020-04-18 16:47 ` Thomas Petazzoni
  0 siblings, 1 reply; 3+ messages in thread
From: Romain Naour @ 2020-04-18 16:10 UTC (permalink / raw)
  To: buildroot

As reported by a gitlab runtime test [1] and on the mailing list
[2], some runtime tests are failing on slow host machines when
the qemu-system-<arch> is missing on the host.

On such host machines, the "exitstatus:" can be "None" instead of
the qemu-system-<arch> return code value.

This can be reproduced more easily by adding "exit 1" in the
first line of start-qemu.sh (after the shebang).

Add a new condition in the exception handling to check
if exitstatus is not "None" before retrieving the exit code.
If exitstatus is "None", return 127 (command not found) as exit code.

Thanks to Yann for the help while investigating the issue.

Tested:
https://gitlab.com/kubu93/buildroot/pipelines/137465454

[1] https://gitlab.com/kubu93/buildroot/pipelines/135487475
[2] http://lists.busybox.net/pipermail/buildroot/2020-April/280037.html

Fixes:
https://gitlab.com/kubu93/buildroot/-/jobs/509053135

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Yann E. MORIN <yann.morin.1998@free.fr>
---
v2: Don't sleep(5) (ThomasP)
---
 support/scripts/boot-qemu-image.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/scripts/boot-qemu-image.py b/support/scripts/boot-qemu-image.py
index 2c1afba398..f2abaf83ed 100755
--- a/support/scripts/boot-qemu-image.py
+++ b/support/scripts/boot-qemu-image.py
@@ -34,7 +34,7 @@ def main():
         # In this case, spawn above will succeed at starting the wrapper
         # start-qemu.sh, but that one will fail (exit with 127) in such
         # a situation.
-        exit = [int(l.split(' ')[1])
+        exit = [int(l.split(' ')[1] if l is None else int(127))
                 for l in e.value.splitlines()
                 if l.startswith('exitstatus: ')]
         if len(exit) and exit[0] == 127:
-- 
2.25.2

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

* [Buildroot] [PATCHv2] support/scripts/boot-qemu-image.py: handle when pexpect.spawn() exit early
  2020-04-18 16:10 [Buildroot] [PATCHv2] support/scripts/boot-qemu-image.py: handle when pexpect.spawn() exit early Romain Naour
@ 2020-04-18 16:47 ` Thomas Petazzoni
  2020-04-18 17:23   ` Yann E. MORIN
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni @ 2020-04-18 16:47 UTC (permalink / raw)
  To: buildroot

On Sat, 18 Apr 2020 18:10:23 +0200
Romain Naour <romain.naour@gmail.com> wrote:

> diff --git a/support/scripts/boot-qemu-image.py b/support/scripts/boot-qemu-image.py
> index 2c1afba398..f2abaf83ed 100755
> --- a/support/scripts/boot-qemu-image.py
> +++ b/support/scripts/boot-qemu-image.py
> @@ -34,7 +34,7 @@ def main():
>          # In this case, spawn above will succeed at starting the wrapper
>          # start-qemu.sh, but that one will fail (exit with 127) in such
>          # a situation.
> -        exit = [int(l.split(' ')[1])
> +        exit = [int(l.split(' ')[1] if l is None else int(127))

I know I'm not very good with Python, but if I read this correctly you
are doing l.split() if l is None here, so you're trying to do a
l.split() precisely when is None... Are you sure this is working ?

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCHv2] support/scripts/boot-qemu-image.py: handle when pexpect.spawn() exit early
  2020-04-18 16:47 ` Thomas Petazzoni
@ 2020-04-18 17:23   ` Yann E. MORIN
  0 siblings, 0 replies; 3+ messages in thread
From: Yann E. MORIN @ 2020-04-18 17:23 UTC (permalink / raw)
  To: buildroot

On 2020-04-18 18:47 +0200, Thomas Petazzoni spake thusly:
> On Sat, 18 Apr 2020 18:10:23 +0200
> Romain Naour <romain.naour@gmail.com> wrote:
> 
> > diff --git a/support/scripts/boot-qemu-image.py b/support/scripts/boot-qemu-image.py
> > index 2c1afba398..f2abaf83ed 100755
> > --- a/support/scripts/boot-qemu-image.py
> > +++ b/support/scripts/boot-qemu-image.py
> > @@ -34,7 +34,7 @@ def main():
> >          # In this case, spawn above will succeed at starting the wrapper
> >          # start-qemu.sh, but that one will fail (exit with 127) in such
> >          # a situation.
> > -        exit = [int(l.split(' ')[1])
> > +        exit = [int(l.split(' ')[1] if l is None else int(127))
> 
> I know I'm not very good with Python, but if I read this correctly you
> are doing l.split() if l is None here, so you're trying to do a
> l.split() precisely when is None... Are you sure this is working ?

Besides, it is not None we should test against, but 'None"  (the string
'None', not the object None).

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

end of thread, other threads:[~2020-04-18 17:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-18 16:10 [Buildroot] [PATCHv2] support/scripts/boot-qemu-image.py: handle when pexpect.spawn() exit early Romain Naour
2020-04-18 16:47 ` Thomas Petazzoni
2020-04-18 17:23   ` Yann E. MORIN

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.