From patchwork Thu May 3 08:52:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Yang X-Patchwork-Id: 907898 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cn.fujitsu.com Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40c8Mj2ppsz9s3G for ; Thu, 3 May 2018 19:04:01 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 76EAB3E75D4 for ; Thu, 3 May 2018 11:03:58 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [IPv6:2001:4b78:1:20::6]) by picard.linux.it (Postfix) with ESMTP id CA5F43E708F for ; Thu, 3 May 2018 11:03:55 +0200 (CEST) Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by in-6.smtp.seeweb.it (Postfix) with ESMTP id 571C514013A4 for ; Thu, 3 May 2018 11:03:53 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="39520522" Received: from bogon (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 03 May 2018 17:03:50 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id AAD624B32DB9; Thu, 3 May 2018 17:03:48 +0800 (CST) Received: from RHEL7U5Alpha_SERVER.g08.fujitsu.local (10.167.220.185) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 3 May 2018 17:03:47 +0800 From: Xiao Yang To: Date: Thu, 3 May 2018 16:52:45 +0800 Message-ID: <1525337565-10101-1-git-send-email-yangx.jy@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.167.220.185] X-yoursite-MailScanner-ID: AAD624B32DB9.AB040 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: yangx.jy@cn.fujitsu.com X-Spam-Status: No, score=0.0 required=7.0 tests=none autolearn=disabled version=3.4.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-6.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-6.smtp.seeweb.it Cc: ltp@lists.linux.it Subject: [LTP] [PATCH] nfs/nfs_lib.sh: Fix wrong getopts parameter handling X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" If nfs_lib.sh didn't use TST_OPTS and passed getopts parameter to tst_net.sh which could only handle -6, it caused getopts error: ---------------------------------------------------------------- /opt/ltp/testcases/bin/nfs01: illegal option -- v /opt/ltp/testcases/bin/tst_net.sh: line 37: ?: command not found ---------------------------------------------------------------- We use TST_OPTS and TST_PARSE_ARGS to fix this issue. Signed-off-by: Xiao Yang --- testcases/network/nfs/nfs_stress/nfs_lib.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh index 0abf39d..28c43ba 100644 --- a/testcases/network/nfs/nfs_stress/nfs_lib.sh +++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh @@ -20,8 +20,12 @@ NFILES=${NFILES:=1000} SOCKET_TYPE="${SOCKET_TYPE:-udp}" NFS_TYPE=${NFS_TYPE:=nfs} -while getopts :ht:v:6 opt; do - case "$opt" in +TST_OPTS=":hv:t:" +TST_PARSE_ARGS=nfs_parse_args + +nfs_parse_args() +{ + case "$1" in h) echo "Usage:" echo "h help" @@ -30,15 +34,11 @@ while getopts :ht:v:6 opt; do echo "6 run over IPv6" exit 0 ;; - v) VERSION=$OPTARG ;; - t) SOCKET_TYPE=$OPTARG ;; - 6) # skip, test_net library already processed it - ;; - *) - tst_brkm TBROK "unknown option: $opt" - ;; + v) VERSION=$OPTARG;; + t) SOCKET_TYPE=$OPTARG;; + *) tst_brkm TBROK "unknown option: $1" esac -done +} get_socket_type() {