From patchwork Tue Jun 19 19:30:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masayoshi Mizuma X-Patchwork-Id: 10475275 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B17016029B for ; Tue, 19 Jun 2018 19:30:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1BC928BCA for ; Tue, 19 Jun 2018 19:30:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 974E928BDA; Tue, 19 Jun 2018 19:30:49 +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=-2.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4A6A528BCD for ; Tue, 19 Jun 2018 19:30:49 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 438FC21173C60; Tue, 19 Jun 2018 12:30:49 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400d:c09::241; helo=mail-qk0-x241.google.com; envelope-from=msys.mizuma@gmail.com; receiver=linux-nvdimm@lists.01.org Received: from mail-qk0-x241.google.com (mail-qk0-x241.google.com [IPv6:2607:f8b0:400d:c09::241]) (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 0BAC72116DFBB for ; Tue, 19 Jun 2018 12:30:47 -0700 (PDT) Received: by mail-qk0-x241.google.com with SMTP id j80-v6so523986qke.9 for ; Tue, 19 Jun 2018 12:30:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/NOIYUMz5FaKW+/z0Ls4NgGVLRxm1xhzFuict7YR8Ug=; b=tlcyqX/b4sNqAdKLlNPztX55vHOw2US3Lbk+if9nN1jDgdGCYjS4WGV3XUEQjS/Smb rgj50lRChTCEKddhBHw99/bqK3t1Sr2NAOdxbF1at0DLN4uNlnGQjU7swqj2NABKwDDf xg981lYS1V0TTYrInA39ICu5y0rx0wXcXOdRmS791dM2eAfEP1l+xq/OPy4BQHEDcjOr QpzWHp2O8SDItea0M9P1j2D9gpSHQOOZosPcjyTcpQZP2zq1JLy5xf37AgFkvVGe7NhK kyemXPBvownvxdJtGphmt6GYtFrS2a4RKFhLwjv9k9iSrCI/7vrPZh66aShvczZ9yZVB I95Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/NOIYUMz5FaKW+/z0Ls4NgGVLRxm1xhzFuict7YR8Ug=; b=LxvipzDY2S8kzxbWfKu160TDYEyXmwDGRCoenKHUvtuIVn203ZlKbC4hBdXRq49xAz kqbBW0x2VcOrO8NeWiweW77yMiQyWbMDRD9Ufrs0iinb7JurIPugrsv+bUHMkEbps2PI 3uR13RfH8NMD5feDWPZkH2/Zcy05SI1qfPWhIPSwRAqU+RkHNHLOhaIctXc9dGJ1vTVJ FqJIlJ+AxKN3FXrFF0kiStOOT1HF0qHlyuoWru+2FtKyKeIxq1YAXXBr6L5NGjdpSUqc qBfRPc58pnrRPEaSLKCEDJjdk30ZoKeTTXLK/ymN1jFZKusdvdGTiWgbVf+bi1usYsYi U8fQ== X-Gm-Message-State: APt69E1iIJ8TOVcVOl04iRxNcR/ToO4goMwxg11ow0xsfaVLzrCFGBk5 UEPlKR56+DbuTlfpm2Zdj1VQ X-Google-Smtp-Source: ADUXVKLQ1CWIDHguB75j5vVRip6lsImeBRoHOqOhLAyGRKPlXncv8Wdm80xiP3QZRgWZaatDWQLSxA== X-Received: by 2002:a37:1416:: with SMTP id e22-v6mr14984371qkh.3.1529436646946; Tue, 19 Jun 2018 12:30:46 -0700 (PDT) Received: from gabell.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id i85-v6sm305122qke.27.2018.06.19.12.30.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Jun 2018 12:30:46 -0700 (PDT) From: Masayoshi Mizuma To: linux-nvdimm@lists.01.org Subject: [PATCH v2 1/2] nfit, test: Add NFIT_TEST_BUS[01] variable and some helper funtions to common Date: Tue, 19 Jun 2018 15:30:30 -0400 Message-Id: <20180619193031.17555-2-msys.mizuma@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180619193031.17555-1-msys.mizuma@gmail.com> References: <20180619193031.17555-1-msys.mizuma@gmail.com> X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masayoshi Mizuma MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP 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" +}