From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH] scripts/runtime: Adjust the premature_failure check Date: Tue, 31 May 2016 21:00:24 +0200 Message-ID: <20160531190023.GC30930@potion> References: <1464692057-19348-1-git-send-email-ldoktor@redhat.com> <1464692057-19348-2-git-send-email-ldoktor@redhat.com> <20160531153747.GB30930@potion> <20160531155617.GA11111@potion> <4e9c147c-dfbf-4985-1869-3f3712bfa579@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org, drjones@redhat.com, pbonzini@redhat.com, lvivier@redhat.com To: =?utf-8?B?THVrw6HFoQ==?= Doktor Return-path: Received: from mx1.redhat.com ([209.132.183.28]:44284 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750744AbcEaTA1 (ORCPT ); Tue, 31 May 2016 15:00:27 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 756C785367 for ; Tue, 31 May 2016 19:00:27 +0000 (UTC) Content-Disposition: inline In-Reply-To: <4e9c147c-dfbf-4985-1869-3f3712bfa579@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 2016-05-31 20:13+0200, Luk=C3=A1=C5=A1 Doktor: > Dne 31.5.2016 v 17:56 Radim Kr=C4=8Dm=C3=A1=C5=99 napsal(a): > > 2016-05-31 17:37+0200, Radim Kr=C4=8Dm=C3=A1=C5=99: > > > 2016-05-31 12:54+0200, Luk=C3=A1=C5=A1 Doktor: > > > > The premature_failure check fails on qemu-system-ppc64 as it us= es > > > > different message. This patch modifies the condition so it work= s > > > > (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" && > > >=20 > > > PPC uses "Could not open '_NO_FILE_4Uhere_': No such file [...]". > > > The problem is that "No such file [...]" might be localized, so w= hat > > > about > > > grep -qi "could not \(load kernel\|open\) '_NO_FILE_4Uhere_'" > > > ? > >=20 > > My tested local repo has a different line there: > > (no idea how the posted version came around ...) > >=20 > > 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: >=20 > ``` > 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=3D"$(eval $(get_cmdline _NO_FILE_4Uhere_) 2>&1)" > - local last_line=3D$(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" > ``` >=20 > 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 n= eeds to be. I'd be fine with checking the exit_code + `grep -q "_NO_FIL= E_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 "co= uld 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 direc= tory > Any preferences? Checking that "_NO_FILE_4Uhere_" occurs on line with/after "could not load kernel" or "error loading" seems best to me.