From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-x243.google.com (mail-qt0-x243.google.com [IPv6:2607:f8b0:400d:c0d::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C2BF02116121A for ; Tue, 19 Jun 2018 12:37:09 -0700 (PDT) Received: by mail-qt0-x243.google.com with SMTP id q6-v6so865897qtn.7 for ; Tue, 19 Jun 2018 12:37:09 -0700 (PDT) From: Masayoshi Mizuma Subject: [PATCH v3 1/2] ndctl, test: Add NFIT_TEST_BUS[01] variable and some helper funtions to common Date: Tue, 19 Jun 2018 15:36:58 -0400 Message-Id: <20180619193659.17815-2-msys.mizuma@gmail.com> In-Reply-To: <20180619193659.17815-1-msys.mizuma@gmail.com> References: <20180619193659.17815-1-msys.mizuma@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" To: linux-nvdimm@lists.01.org Cc: Masayoshi Mizuma List-ID: From: Masayoshi Mizuma Add following global variable and functions to test/common file. - NFIT_TEST_BUS[01] (global variable) Buses are created when nfit_test module is loaded. - NDCTL (global variable) ndctl command path (renamed). - _cleanup Helper function cleans up nfit_test module. - json2var Helper function (filter) converts json to var. Signed-off-by: Masayoshi Mizuma --- test/common | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/test/common b/test/common index 8fafa91..fb4e18e 100644 --- a/test/common +++ b/test/common @@ -4,17 +4,23 @@ # Global variables -# ndctl +# NDCTL # if [ -f "../ndctl/ndctl" ] && [ -x "../ndctl/ndctl" ]; then - export ndctl=../ndctl/ndctl + export NDCTL=../ndctl/ndctl elif [ -f "./ndctl/ndctl" ] && [ -x "./ndctl/ndctl" ]; then - export ndctl=./ndctl/ndctl + export NDCTL=./ndctl/ndctl else echo "Couldn't find an ndctl binary" exit 1 fi +# NFIT_TEST_BUS[01] +# +NFIT_TEST_BUS0=nfit_test.0 +NFIT_TEST_BUS1=nfit_test.1 + + # Functions # err @@ -58,3 +64,20 @@ check_prereq() do_skip "missing $1, skipping..." fi } + +# _cleanup +# +_cleanup() +{ + $NDCTL disable-region -b $NFIT_TEST_BUS0 all + $NDCTL disable-region -b $NFIT_TEST_BUS1 all + modprobe -r nfit_test +} + +# json2var +# stdin: json +# +json2var() +{ + sed -e "s/[{}\",]//g; s/:/=/g" +} -- 2.18.0.rc1 _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm