From patchwork Tue Dec 4 15:51:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10712131 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F262C109C for ; Tue, 4 Dec 2018 15:51:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D945F2C1ED for ; Tue, 4 Dec 2018 15:51:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5F7E2C184; Tue, 4 Dec 2018 15:51:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 361212C1DC for ; Tue, 4 Dec 2018 15:51:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726381AbeLDPv4 (ORCPT ); Tue, 4 Dec 2018 10:51:56 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:33640 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726367AbeLDPvz (ORCPT ); Tue, 4 Dec 2018 10:51:55 -0500 Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3FA3DBC7; Tue, 4 Dec 2018 16:51:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1543938712; bh=TxQTr3TX1HyetLm5wi6ylo+409oRogYrRBWkBZbhL8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=max0UqNbkJgmnTeUvl56l11wthGHKTzysrX2bz4jvIV56vCpXPRXAHUNVOaX2qqoB 0a3M3dK5Wec6TzIYJ3iJ911ALPK6lAYSXJCXR+eJT/9KAww8LLeKT3alM2LyD10T0g j5IpFMC7DKETi7vcDHmHxLtenW8x1+rxY1Jkc7es= From: Kieran Bingham To: Laurent Pinchart Cc: Kieran Bingham , linux-renesas-soc@vger.kernel.org, Kieran Bingham Subject: [VSP-Tests PATCH 3/7] vsp-lib: Provide command line argument parsing Date: Tue, 4 Dec 2018 15:51:42 +0000 Message-Id: <20181204155146.9726-4-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181204155146.9726-1-kieran.bingham@ideasonboard.com> References: <20181204155146.9726-1-kieran.bingham@ideasonboard.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Extend the vsp-lib to support command line parsing for all tests. The arguments parsed here should be common to all tests, and initially provide shell level verbose debug output, and the option to easily keep frames output by the VSP1. Signed-off-by: Kieran Bingham --- scripts/vsp-lib.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/scripts/vsp-lib.sh b/scripts/vsp-lib.sh index 0f3992a7827e..56969606382f 100755 --- a/scripts/vsp-lib.sh +++ b/scripts/vsp-lib.sh @@ -1094,3 +1094,37 @@ test_complete() { test_run() { test_main | ./logger.sh error >> $logfile } + +# ------------------------------------------------------------------------------ +# Common argument parsing +# +# non-recognised arguments are restored, to allow tests to implement their own +# parsing if necessary. + +POSITIONAL=() +while [[ $# -gt 0 ]] +do +case $1 in + -x|--debug) + set -x; + shift + ;; + -k|--keep-frames) + export VSP_KEEP_FRAMES=1 + shift + ;; + -h|--help) + echo "$(basename $0): VSP Test library" + echo " -x|--debug enable shell debug" + echo " -k|--keep-frames keep generated and captured frames" + echo " -h|--help this help" + exit + shift + ;; + *) # unknown option + POSITIONAL+=("$1") # save it in an array for later + shift # past argument + ;; +esac +done +set -- "${POSITIONAL[@]}" # restore positional parameters