From patchwork Tue Apr 28 19:59:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bandan Das X-Patchwork-Id: 6291941 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 47038BEEE1 for ; Tue, 28 Apr 2015 19:59:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 662FA202B8 for ; Tue, 28 Apr 2015 19:59:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 868A22028D for ; Tue, 28 Apr 2015 19:59:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030862AbbD1T7j (ORCPT ); Tue, 28 Apr 2015 15:59:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32879 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030737AbbD1T7i (ORCPT ); Tue, 28 Apr 2015 15:59:38 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t3SJxcKY004671 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 28 Apr 2015 15:59:38 -0400 Received: from aqua ([10.3.113.6]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3SJxbR5015099 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 28 Apr 2015 15:59:38 -0400 From: Bandan Das To: kvm@vger.kernel.org Cc: Paolo Bonzini Subject: [PATCH RESEND kvm-unit-tests] x86/run: Rearrange the valid binary and testdev support checks Date: Tue, 28 Apr 2015 15:59:37 -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.27 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 This extends the sanity checks done on known common Qemu binary paths when the user supplies a QEMU= on the command line Fixes: b895b967db94937d5b593c51b95eb32d2889a764 Signed-off-by: Bandan Das --- x86/run | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/x86/run b/x86/run index 219a93b..5281fca 100755 --- a/x86/run +++ b/x86/run @@ -2,33 +2,28 @@ NOTFOUND=1 TESTDEVNOTSUPP=2 -qemukvm="${QEMU:-qemu-kvm}" -qemusystem="${QEMU:-qemu-system-x86_64}" +qemubinarysearch="${QEMU:-qemu-kvm qemu-system-x86_64}" -if ! [ -z "${QEMU}" ] -then - qemu="${QEMU}" -else - 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 - 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}" ] +for qemucmd in ${qemubinarysearch} +do + unset QEMUFOUND + unset qemu + if ! [ -z "${QEMUFOUND=$(${qemucmd} --help 2>/dev/null | grep "QEMU")}" ] && + ${qemucmd} -device '?' 2>&1 | grep -F -e \"testdev\" -e \"pc-testdev\" > /dev/null; then - echo "No Qemu test device support found" - exit ${TESTDEVNOTSUPP} + qemu="${qemucmd}" + break fi +done + +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