All of lore.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH v2] Adjust the premature_failure check
@ 2016-06-01  6:20 Lukáš Doktor
  2016-06-01  6:20 ` [PATCH] scripts/runtime: " Lukáš Doktor
  0 siblings, 1 reply; 10+ messages in thread
From: Lukáš Doktor @ 2016-06-01  6:20 UTC (permalink / raw)
  To: kvm, drjones, pbonzini, lvivier, ldoktor, rkrcmar

Hello guys,

The a51bab13689b8eeeb6d1cc614fd56a4e86718ed4 change is not compatible with qemu-system-ppc64. Please find the fix attached.

Sample outputs are (Czech locale):

    $ qemu-system-x86_64 -kernel  _NO_FILE_4Uhere_
    qemu: could not load kernel '_NO_FILE_4Uhere_': No such file or directory
    $ qemu-system-aarch64 -kernel  _NO_FILE_4Uhere_  -machine virt
    _NO_FILE_4Uhere_: Adres?? nebo soubor neexistuje
    qemu: could not load kernel '_NO_FILE_4Uhere_'
    $ qemu-system-ppc64 -kernel  _NO_FILE_4Uhere_
    _NO_FILE_4Uhere_: No such file or directory
    qemu: error loading _NO_FILE_4Uhere_: Failed to load ELF

Changes:

    v2: Check for line containing one of the failure messages
        and the dummy file name.
    v2: Use the full qemu output, not just the last_line

Kind regards,
Lukáš



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

* [PATCH] scripts/runtime: Adjust the premature_failure check
  2016-06-01  6:20 [kvm-unit-tests PATCH v2] Adjust the premature_failure check Lukáš Doktor
@ 2016-06-01  6:20 ` Lukáš Doktor
  2016-06-13  9:34   ` [kvm-unit-tests PATCH] " Thomas Huth
  0 siblings, 1 reply; 10+ messages in thread
From: Lukáš Doktor @ 2016-06-01  6:20 UTC (permalink / raw)
  To: kvm, drjones, pbonzini, lvivier, ldoktor, rkrcmar

The premature_failure check fails on qemu-system-ppc64 as it uses
different message. This patch modifies the condition so it works
(hopefully) for all archs. (tested on x86_64, ppc64, aarch64)

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
---
 scripts/runtime.bash | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index 6c4c800..0503cf0 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -15,14 +15,14 @@ extract_summary()
 premature_failure()
 {
     local log="$(eval $(get_cmdline _NO_FILE_4Uhere_) 2>&1)"
-    local last_line=$(tail -1 <<< "$log")
 
-    echo "$last_line" | grep -qi "could not load kernel" &&
+    echo "$log" | grep "_NO_FILE_4Uhere_" |
+        grep -q -e "could not load kernel" -e "error loading" &&
         return 1
 
     RUNTIME_log_stderr <<< "$log"
 
-    echo "$last_line"
+    echo "$log"
     return 0
 }
 
-- 
2.5.5


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

* Re: [kvm-unit-tests PATCH] scripts/runtime: Adjust the premature_failure check
  2016-06-01  6:20 ` [PATCH] scripts/runtime: " Lukáš Doktor
@ 2016-06-13  9:34   ` Thomas Huth
  2016-06-13 13:30     ` Paolo Bonzini
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Huth @ 2016-06-13  9:34 UTC (permalink / raw)
  To: Lukáš Doktor, kvm, pbonzini; +Cc: drjones, lvivier, rkrcmar

On 01.06.2016 08:20, Lukáš Doktor wrote:
> The premature_failure check fails on qemu-system-ppc64 as it uses
> different message. This patch modifies the condition so it works
> (hopefully) for all archs. (tested on x86_64, ppc64, aarch64)
> 
> Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
> ---
>  scripts/runtime.bash | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/runtime.bash b/scripts/runtime.bash
> index 6c4c800..0503cf0 100644
> --- a/scripts/runtime.bash
> +++ b/scripts/runtime.bash
> @@ -15,14 +15,14 @@ extract_summary()
>  premature_failure()
>  {
>      local log="$(eval $(get_cmdline _NO_FILE_4Uhere_) 2>&1)"
> -    local last_line=$(tail -1 <<< "$log")
>  
> -    echo "$last_line" | grep -qi "could not load kernel" &&
> +    echo "$log" | grep "_NO_FILE_4Uhere_" |
> +        grep -q -e "could not load kernel" -e "error loading" &&
>          return 1
>  
>      RUNTIME_log_stderr <<< "$log"
>  
> -    echo "$last_line"
> +    echo "$log"
>      return 0
>  }
>  

Reviewed-by: Thomas Huth <thuth@redhat.com>


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

* Re: [kvm-unit-tests PATCH] scripts/runtime: Adjust the premature_failure check
  2016-06-13  9:34   ` [kvm-unit-tests PATCH] " Thomas Huth
@ 2016-06-13 13:30     ` Paolo Bonzini
  0 siblings, 0 replies; 10+ messages in thread
From: Paolo Bonzini @ 2016-06-13 13:30 UTC (permalink / raw)
  To: Thomas Huth, Lukáš Doktor, kvm; +Cc: drjones, lvivier, rkrcmar



On 13/06/2016 11:34, Thomas Huth wrote:
> Reviewed-by: Thomas Huth <thuth@redhat.com>


Applied, thanks.

paolo

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

* Re: [PATCH] scripts/runtime: Adjust the premature_failure check
  2016-05-31 18:13       ` Lukáš Doktor
@ 2016-05-31 19:00         ` Radim Krčmář
  0 siblings, 0 replies; 10+ messages in thread
From: Radim Krčmář @ 2016-05-31 19:00 UTC (permalink / raw)
  To: Lukáš Doktor; +Cc: kvm, drjones, pbonzini, lvivier

2016-05-31 20:13+0200, Lukáš Doktor:
> Dne 31.5.2016 v 17:56 Radim Krčmář napsal(a):
> > 2016-05-31 17:37+0200, Radim Krčmář:
> > > 2016-05-31 12:54+0200, Lukáš Doktor:
> > > > The premature_failure check fails on qemu-system-ppc64 as it uses
> > > > different message. This patch modifies the condition so it works
> > > > (hopefully) for all archs.
> > > > ---
> > > > diff --git a/scripts/runtime.bash b/scripts/runtime.bash
> > > > -    echo "$last_line" | grep -qi "could not load kernel" &&
> > > > +    echo "$last_line" | grep "_NO_FILE_4Uhere_" | grep -qi "no such file" &&
> > > 
> > > PPC uses "Could not open '_NO_FILE_4Uhere_': No such file [...]".
> > > The problem is that "No such file [...]" might be localized, so what
> > > about
> > >   grep -qi "could not \(load kernel\|open\) '_NO_FILE_4Uhere_'"
> > > ?
> > 
> > My tested local repo has a different line there:
> > (no idea how the posted version came around ...)
> > 
> >   echo "$last_line" | grep -qi "_NO_FILE_4Uhere_" &&
> Oups, I sent a wrong version. I didn't use the `last_line`, but full output to check for the result to be more lenient:
> 
> ```
> diff --git a/scripts/runtime.bash b/scripts/runtime.bash
> index 886814b..96c82c6 100644
> --- a/scripts/runtime.bash
> +++ b/scripts/runtime.bash
> @@ -15,9 +15,8 @@ extract_summary()
>  premature_failure()
>  {
>      local log="$(eval $(get_cmdline _NO_FILE_4Uhere_) 2>&1)"
> -    local last_line=$(tail -1 <<< "$log")
> -    echo "$last_line" | grep "_NO_FILE_4Uhere_" | grep -qi "no such file" &&
> +    echo "$log" | grep "_NO_FILE_4Uhere_" | grep -qi "no such file" &&
>          return 1
>      RUNTIME_log_stderr <<< "$log"
> ```
> 
> Which works for me on ppc64 and x86_64. Anyway it fails on aarch64 as indeed the message is localized. I'm wondering how strict this check needs to be. I'd be fine with checking the exit_code + `grep -q "_NO_FILE_4Uhere_"` anywhere in the output.

Exit code is going to be 1 pretty much every time, so I wouldn't bother
with it.

I used $last_line, because grep only checked for _NO_FILE_4Uhere_ and
qemu could have printed it for some other reasons too.
Parsing the whole log sounds good.

> Alternatively how about stronger version could check the last line in this way `echo "$last_line" | grep "_NO_FILE_4Uhere_" | grep -q -e "could not load kernel" -e "error loading" which works on my qemu-system-{x86_64,aarch64,ppc64}.

Ah, true, PPC says something different ... (too many mistakes these
days, I'll be taking another vacation soon)
QEMU's exit messages (on rawhide fedora):

  # qemu-system-aarch64 -kernel _NO_FILE_4Uhere_ -M virt
  qemu: could not load kernel '_NO_FILE_4Uhere_'

  # qemu-system-ppc64   -kernel _NO_FILE_4Uhere_
  qemu-system-ppc64: error loading _NO_FILE_4Uhere_: Failed to load ELF

  # qemu-system-x86_64  -kernel _NO_FILE_4Uhere_
  qemu: could not load kernel '_NO_FILE_4Uhere_': No such file or directory

> Any preferences?

Checking that "_NO_FILE_4Uhere_" occurs on line with/after "could not
load kernel" or "error loading" seems best to me.

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

* Re: [PATCH] scripts/runtime: Adjust the premature_failure check
  2016-05-31 15:56     ` Radim Krčmář
  2016-05-31 16:20       ` Paolo Bonzini
@ 2016-05-31 18:13       ` Lukáš Doktor
  2016-05-31 19:00         ` Radim Krčmář
  1 sibling, 1 reply; 10+ messages in thread
From: Lukáš Doktor @ 2016-05-31 18:13 UTC (permalink / raw)
  To: Radim Krčmář; +Cc: kvm, drjones, pbonzini, lvivier


[-- Attachment #1.1: Type: text/plain, Size: 2190 bytes --]

Dne 31.5.2016 v 17:56 Radim Krčmář napsal(a):
> 2016-05-31 17:37+0200, Radim Krčmář:
>> 2016-05-31 12:54+0200, Lukáš Doktor:
>>> The premature_failure check fails on qemu-system-ppc64 as it uses
>>> different message. This patch modifies the condition so it works
>>> (hopefully) for all archs.
>>> ---
>>> diff --git a/scripts/runtime.bash b/scripts/runtime.bash
>>> -    echo "$last_line" | grep -qi "could not load kernel" &&
>>> +    echo "$last_line" | grep "_NO_FILE_4Uhere_" | grep -qi "no such file" &&
>>
>> PPC uses "Could not open '_NO_FILE_4Uhere_': No such file [...]".
>> The problem is that "No such file [...]" might be localized, so what
>> about
>>   grep -qi "could not \(load kernel\|open\) '_NO_FILE_4Uhere_'"
>> ?
>
> My tested local repo has a different line there:
> (no idea how the posted version came around ...)
>
>   echo "$last_line" | grep -qi "_NO_FILE_4Uhere_" &&
Oups, I sent a wrong version. I didn't use the `last_line`, but full output to check for the result to be more lenient:

```
diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index 886814b..96c82c6 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -15,9 +15,8 @@ extract_summary()
  premature_failure()
  {
      local log="$(eval $(get_cmdline _NO_FILE_4Uhere_) 2>&1)"
-    local last_line=$(tail -1 <<< "$log")
  
-    echo "$last_line" | grep "_NO_FILE_4Uhere_" | grep -qi "no such file" &&
+    echo "$log" | grep "_NO_FILE_4Uhere_" | grep -qi "no such file" &&
          return 1
  
      RUNTIME_log_stderr <<< "$log"
```

Which works for me on ppc64 and x86_64. Anyway it fails on aarch64 as indeed the message is localized. I'm wondering how strict this check needs to be. I'd be fine with checking the exit_code + `grep -q "_NO_FILE_4Uhere_"` anywhere in the output.

Alternatively how about stronger version could check the last line in this way `echo "$last_line" | grep "_NO_FILE_4Uhere_" | grep -q -e "could not load kernel" -e "error loading" which works on my qemu-system-{x86_64,aarch64,ppc64}.

Any preferences?

Lukáš

>
> so we might be fine with it too, but I like the context check.
>



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [PATCH] scripts/runtime: Adjust the premature_failure check
  2016-05-31 15:56     ` Radim Krčmář
@ 2016-05-31 16:20       ` Paolo Bonzini
  2016-05-31 18:13       ` Lukáš Doktor
  1 sibling, 0 replies; 10+ messages in thread
From: Paolo Bonzini @ 2016-05-31 16:20 UTC (permalink / raw)
  To: Radim Krčmář, Lukáš Doktor; +Cc: kvm, drjones, lvivier



On 31/05/2016 17:56, Radim Krčmář wrote:
> 2016-05-31 17:37+0200, Radim Krčmář:
>> 2016-05-31 12:54+0200, Lukáš Doktor:
>>> The premature_failure check fails on qemu-system-ppc64 as it uses
>>> different message. This patch modifies the condition so it works
>>> (hopefully) for all archs.
>>> ---
>>> diff --git a/scripts/runtime.bash b/scripts/runtime.bash
>>> -    echo "$last_line" | grep -qi "could not load kernel" &&
>>> +    echo "$last_line" | grep "_NO_FILE_4Uhere_" | grep -qi "no such file" &&
>>
>> PPC uses "Could not open '_NO_FILE_4Uhere_': No such file [...]".
>> The problem is that "No such file [...]" might be localized, so what
>> about
>>   grep -qi "could not \(load kernel\|open\) '_NO_FILE_4Uhere_'"
>> ?
> 
> My tested local repo has a different line there:
> (no idea how the posted version came around ...)
> 
>   echo "$last_line" | grep -qi "_NO_FILE_4Uhere_" &&

"-i" is not needed here, though.

Paolo

> so we might be fine with it too, but I like the context check.

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

* Re: [PATCH] scripts/runtime: Adjust the premature_failure check
  2016-05-31 15:37   ` Radim Krčmář
@ 2016-05-31 15:56     ` Radim Krčmář
  2016-05-31 16:20       ` Paolo Bonzini
  2016-05-31 18:13       ` Lukáš Doktor
  0 siblings, 2 replies; 10+ messages in thread
From: Radim Krčmář @ 2016-05-31 15:56 UTC (permalink / raw)
  To: Lukáš Doktor; +Cc: kvm, drjones, pbonzini, lvivier

2016-05-31 17:37+0200, Radim Krčmář:
> 2016-05-31 12:54+0200, Lukáš Doktor:
>> The premature_failure check fails on qemu-system-ppc64 as it uses
>> different message. This patch modifies the condition so it works
>> (hopefully) for all archs.
>> ---
>> diff --git a/scripts/runtime.bash b/scripts/runtime.bash
>> -    echo "$last_line" | grep -qi "could not load kernel" &&
>> +    echo "$last_line" | grep "_NO_FILE_4Uhere_" | grep -qi "no such file" &&
> 
> PPC uses "Could not open '_NO_FILE_4Uhere_': No such file [...]".
> The problem is that "No such file [...]" might be localized, so what
> about
>   grep -qi "could not \(load kernel\|open\) '_NO_FILE_4Uhere_'"
> ?

My tested local repo has a different line there:
(no idea how the posted version came around ...)

  echo "$last_line" | grep -qi "_NO_FILE_4Uhere_" &&

so we might be fine with it too, but I like the context check.

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

* Re: [PATCH] scripts/runtime: Adjust the premature_failure check
  2016-05-31 10:54 ` [PATCH] scripts/runtime: " Lukáš Doktor
@ 2016-05-31 15:37   ` Radim Krčmář
  2016-05-31 15:56     ` Radim Krčmář
  0 siblings, 1 reply; 10+ messages in thread
From: Radim Krčmář @ 2016-05-31 15:37 UTC (permalink / raw)
  To: Lukáš Doktor; +Cc: kvm, drjones, pbonzini, lvivier

2016-05-31 12:54+0200, Lukáš Doktor:
> The premature_failure check fails on qemu-system-ppc64 as it uses
> different message. This patch modifies the condition so it works
> (hopefully) for all archs.
> 
> Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
> ---
>  scripts/runtime.bash | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/runtime.bash b/scripts/runtime.bash
> index 6c4c800..886814b 100644
> --- a/scripts/runtime.bash
> +++ b/scripts/runtime.bash
> @@ -17,7 +17,7 @@ premature_failure()
>      local log="$(eval $(get_cmdline _NO_FILE_4Uhere_) 2>&1)"
>      local last_line=$(tail -1 <<< "$log")
>  
> -    echo "$last_line" | grep -qi "could not load kernel" &&
> +    echo "$last_line" | grep "_NO_FILE_4Uhere_" | grep -qi "no such file" &&

PPC uses "Could not open '_NO_FILE_4Uhere_': No such file [...]".
The problem is that "No such file [...]" might be localized, so what
about
  grep -qi "could not \(load kernel\|open\) '_NO_FILE_4Uhere_'"
?

(A nicer, yet more complicated option would be to query the localized
 string that stands for "No such file or directory" with file, stat, or
 a dedicated utility for localized error messages.)

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

* [PATCH] scripts/runtime: Adjust the premature_failure check
  2016-05-31 10:54 [kvm-unit-tests PATCH] " Lukáš Doktor
@ 2016-05-31 10:54 ` Lukáš Doktor
  2016-05-31 15:37   ` Radim Krčmář
  0 siblings, 1 reply; 10+ messages in thread
From: Lukáš Doktor @ 2016-05-31 10:54 UTC (permalink / raw)
  To: kvm, drjones, pbonzini, lvivier, ldoktor

The premature_failure check fails on qemu-system-ppc64 as it uses
different message. This patch modifies the condition so it works
(hopefully) for all archs.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
---
 scripts/runtime.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index 6c4c800..886814b 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -17,7 +17,7 @@ premature_failure()
     local log="$(eval $(get_cmdline _NO_FILE_4Uhere_) 2>&1)"
     local last_line=$(tail -1 <<< "$log")
 
-    echo "$last_line" | grep -qi "could not load kernel" &&
+    echo "$last_line" | grep "_NO_FILE_4Uhere_" | grep -qi "no such file" &&
         return 1
 
     RUNTIME_log_stderr <<< "$log"
-- 
2.5.5


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

end of thread, other threads:[~2016-06-13 13:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-01  6:20 [kvm-unit-tests PATCH v2] Adjust the premature_failure check Lukáš Doktor
2016-06-01  6:20 ` [PATCH] scripts/runtime: " Lukáš Doktor
2016-06-13  9:34   ` [kvm-unit-tests PATCH] " Thomas Huth
2016-06-13 13:30     ` Paolo Bonzini
  -- strict thread matches above, loose matches on Subject: below --
2016-05-31 10:54 [kvm-unit-tests PATCH] " Lukáš Doktor
2016-05-31 10:54 ` [PATCH] scripts/runtime: " Lukáš Doktor
2016-05-31 15:37   ` Radim Krčmář
2016-05-31 15:56     ` Radim Krčmář
2016-05-31 16:20       ` Paolo Bonzini
2016-05-31 18:13       ` Lukáš Doktor
2016-05-31 19:00         ` Radim Krčmář

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.