diff mbox

scripts/runtime: Adjust the premature_failure check

Message ID 1464692057-19348-2-git-send-email-ldoktor@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lukáš Doktor May 31, 2016, 10:54 a.m. UTC
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(-)

Comments

Radim Krčmář May 31, 2016, 3:37 p.m. UTC | #1
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.)
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Radim Krčmář May 31, 2016, 3:56 p.m. UTC | #2
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.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Paolo Bonzini May 31, 2016, 4:20 p.m. UTC | #3
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.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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"