From patchwork Wed Apr 1 21:12:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bandan Das X-Patchwork-Id: 6142271 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 995539F350 for ; Wed, 1 Apr 2015 21:12:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C981E202E6 for ; Wed, 1 Apr 2015 21:12:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EBD49202C8 for ; Wed, 1 Apr 2015 21:12:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752696AbbDAVMN (ORCPT ); Wed, 1 Apr 2015 17:12:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49207 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752628AbbDAVML (ORCPT ); Wed, 1 Apr 2015 17:12:11 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t31LCBOF026168 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 1 Apr 2015 17:12:11 -0400 Received: from aqua (ovpn-113-195.phx2.redhat.com [10.3.113.195]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t31LC9OB027067 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 1 Apr 2015 17:12:10 -0400 From: Bandan Das To: kvm@vger.kernel.org Cc: Paolo Bonzini , Marcelo Tosatti Subject: [PATCH] x86-run: Print a meaningful message if the qemu binary isn't found Date: Wed, 01 Apr 2015 17:12:09 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Before: ./x86-run ./x86/msr.flat QEMU binary has no support for test device. Exiting. After: ./x86-run ./x86/msr.flat A QEMU binary was not found, You can set a custom location by using the QEMU= environment variable Signed-off-by: Bandan Das --- x86/run | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/x86/run b/x86/run index af37eb4..d5adf8d 100755 --- a/x86/run +++ b/x86/run @@ -1,20 +1,35 @@ #!/bin/bash +NOTFOUND=1 +TESTDEVNOTSUPP=2 qemukvm="${QEMU:-qemu-kvm}" qemusystem="${QEMU:-qemu-system-x86_64}" -if - ${qemukvm} -device '?' 2>&1 | grep -F -e \"testdev\" -e \"pc-testdev\" > /dev/null; + +if ! [ -z "${QEMU}" ] then - qemu="${qemukvm}" + qemu="${QEMU}" else - if - ${qemusystem} -device '?' 2>&1 | grep -F -e \"testdev\" -e \"pc-testdev\" > /dev/null; - then - qemu="${qemusystem}" - else - echo QEMU binary ${QEMU} has no support for test device. Exiting. - exit 2 - fi + for qemucmds in ${qemukvm} ${qemusystem} + do + unset QEMUFOUND + unset qemu + if ! [ -z "${QEMUFOUND=$(${qemucmds} --help 2>/dev/null | grep "QEMU")}" ] && + ${qemucmds} -device '?' 2>&1 | grep -F -e \"testdev\" -e \"pc-testdev\" > /dev/null; + then + qemu="${qemucmds}" + break + fi + done +fi + +if [ -z "${QEMUFOUND}" ] +then + echo "A QEMU binary was not found, You can set a custom location by using the QEMU= environment variable " + exit ${NOTFOUND} +elif [ -z "${qemu}" ] +then + echo "No Qemu test device support found" + exit ${TESTDEVNOTSUPP} fi if