From patchwork Tue Sep 1 08:50:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Bolshakov X-Patchwork-Id: 11747685 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 693FE109B for ; Tue, 1 Sep 2020 08:51:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F4622098B for ; Tue, 1 Sep 2020 08:51:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=yadro.com header.i=@yadro.com header.b="No4UZgH4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728035AbgIAIvS (ORCPT ); Tue, 1 Sep 2020 04:51:18 -0400 Received: from mta-02.yadro.com ([89.207.88.252]:55054 "EHLO mta-01.yadro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727089AbgIAIvL (ORCPT ); Tue, 1 Sep 2020 04:51:11 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id C392652195; Tue, 1 Sep 2020 08:51:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= content-type:content-type:content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:date:subject :subject:from:from:received:received:received; s=mta-01; t= 1598950268; x=1600764669; bh=BNBYuBfEPgv86IqOtJm1CBAiXwwqlis6GlD TxXzfZWs=; b=No4UZgH4vXgdMFVGEy33lZO6AsZ0lvBsDBGqQ4IIi2wrUpdzlBb jZPRc3yU+yTNVQ6TZhYOBwrTyZPlNof2/75BprBRvVgi3YtsaMJjJLREGsHuLL4D BncUoQ2rlZKE1p+E6hQya6cxYtXyChcXTCm1ZGKd2UK5QFNaAVJs/0QQ= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RaOKKxQkWjJO; Tue, 1 Sep 2020 11:51:08 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id 1EE0E574EC; Tue, 1 Sep 2020 11:51:07 +0300 (MSK) Received: from localhost (172.17.204.212) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Tue, 1 Sep 2020 11:51:07 +0300 From: Roman Bolshakov To: CC: Thomas Huth , Paolo Bonzini , Roman Bolshakov , Cameron Esfahani Subject: [kvm-unit-tests PATCH v2 06/10] configure: Add an option to specify getopt Date: Tue, 1 Sep 2020 11:50:52 +0300 Message-ID: <20200901085056.33391-7-r.bolshakov@yadro.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901085056.33391-1-r.bolshakov@yadro.com> References: <20200901085056.33391-1-r.bolshakov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [172.17.204.212] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org macOS is shipped with an old non-enhanced version of getopt and it doesn't support options used by run_tests.sh. Proper version of getopt is available from homebrew but it has to be added to PATH before invoking run_tests.sh. It's not convenient because it has to be done in each shell instance and there could be many if a multiplexor is used. The change provides a way to override getopt and halts ./configure if enhanced getopt can't be found. Cc: Cameron Esfahani Signed-off-by: Roman Bolshakov Reviewed-by: Thomas Huth --- configure | 13 +++++++++++++ run_tests.sh | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 4eb504f..b85420b 100755 --- a/configure +++ b/configure @@ -8,6 +8,7 @@ objcopy=objcopy objdump=objdump ar=ar addr2line=addr2line +getopt=getopt arch=`uname -m | sed -e 's/i.86/i386/;s/arm.*/arm/;s/ppc64.*/ppc64/'` host=$arch cross_prefix= @@ -32,6 +33,7 @@ usage() { --cross-prefix=PREFIX cross compiler prefix --cc=CC c compiler to use ($cc) --ld=LD ld linker to use ($ld) + --getopt=GETOPT enhanced getopt to use ($getopt) --prefix=PREFIX where to install things ($prefix) --endian=ENDIAN endianness to compile for (little or big, ppc64 only) --[enable|disable]-pretty-print-stacks @@ -77,6 +79,9 @@ while [[ "$1" = -* ]]; do --ld) ld="$arg" ;; + --getopt) + getopt="$arg" + ;; --enable-pretty-print-stacks) pretty_print_stacks=yes ;; @@ -167,6 +172,13 @@ EOF rm -f lib-test.{o,S} fi +# require enhanced getopt +$getopt -T > /dev/null +if [ $? -ne 4 ]; then + echo "Enchanced getopt is not available" + exit 1 +fi + # Are we in a separate build tree? If so, link the Makefile # and shared stuff so that 'make' and run_tests.sh work. if test ! -e Makefile; then @@ -209,6 +221,7 @@ OBJCOPY=$cross_prefix$objcopy OBJDUMP=$cross_prefix$objdump AR=$cross_prefix$ar ADDR2LINE=$cross_prefix$addr2line +GETOPT=$getopt TEST_DIR=$testdir FIRMWARE=$firmware ENDIAN=$endian diff --git a/run_tests.sh b/run_tests.sh index 01e36dc..c4f436b 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -35,7 +35,7 @@ RUNTIME_arch_run="./$TEST_DIR/run" source scripts/runtime.bash only_tests="" -args=`getopt -u -o ag:htj:v -l all,group:,help,tap13,parallel:,verbose -- $*` +args=`$GETOPT -u -o ag:htj:v -l all,group:,help,tap13,parallel:,verbose -- $*` [ $? -ne 0 ] && exit 2; set -- $args; while [ $# -gt 0 ]; do