From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [kvm-unit-tests PATCH 4/5] scripts/arch-run: fix qemu binary search failure path Date: Wed, 28 Jun 2017 22:46:27 +0200 Message-ID: <95109d90-f139-e292-aff4-bb60c9569407@redhat.com> References: <20170628200857.1718-1-rkrcmar@redhat.com> <20170628200857.1718-5-rkrcmar@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: Drew Jones , Laurent Vivier , Thomas Huth , David Hildenbrand To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:58040 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751501AbdF1Uqc (ORCPT ); Wed, 28 Jun 2017 16:46:32 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1358C80C08 for ; Wed, 28 Jun 2017 20:46:32 +0000 (UTC) In-Reply-To: <20170628200857.1718-5-rkrcmar@redhat.com> Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 28/06/2017 22:08, Radim Krčmář wrote: > Doing exit from a subshell won't exit the main shell, so arch-run will > try to continue without a working QEMU if search_qemu_binary() failed. Should it be "exit $?"? Apart from this looks good. I can do the change. Paolo > Also fix error message from search_qemu_binary(). > > Signed-off-by: Radim Krčmář > --- > I was thinking about using `set -e` instead, so the "return 2" from > search_qemu_binary() would stop the script without the explicit exit. > It required just four changes to make the script work (resulting in > better diffstat), but would likely complicate future development. > > The second alternative would be to call just "search_qemu_binary" and > set the qemu variable from it. This would allow "exit 2" from > search_qemu_binary() to also exit arch/run, but side-effects on > variables seem worse than the first alternative ... > ---