From patchwork Fri Aug 31 13:40:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10583755 X-Patchwork-Delegate: geert@linux-m68k.org 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 CC41213AC for ; Fri, 31 Aug 2018 13:41:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B65122BE78 for ; Fri, 31 Aug 2018 13:41:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B451D2BE61; Fri, 31 Aug 2018 13:41:04 +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 33E632BE9E for ; Fri, 31 Aug 2018 13:41:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728340AbeHaRsg (ORCPT ); Fri, 31 Aug 2018 13:48:36 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:44248 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727448AbeHaRsg (ORCPT ); Fri, 31 Aug 2018 13:48:36 -0400 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 4CE9AB8E; Fri, 31 Aug 2018 15:41:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1535722862; bh=lM0AEfP4ImV8cNDYiN+S5ed5c8DC28ouPQdvRNLHQQY=; h=From:To:Cc:Subject:Date:From; b=K8oYoBwyfYGuRtWVoL8sowX+OCYOAKYE3LzZwywEo0mCmIaS+AeAHL/6YFex9HTBy 74ZBHZPsD1wm85p3NJftYj6mFhxGQxi9W1EWTG9FTKzopm/pXzF6PeGGBHGOvgzpns b2V0+AYB1zJ02D1M3JYWHgsNhX1oT+YlA8ZirfiI= From: Kieran Bingham To: Laurent Pinchart Cc: linux-renesas-soc@vger.kernel.org, Kieran Bingham Subject: [VSP-Tests: PATCH] vsp-lib: Provide command line argument parsing Date: Fri, 31 Aug 2018 14:40:58 +0100 Message-Id: <20180831134058.27454-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.17.1 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..6a0f4af5eaf5 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 arguements 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