From patchwork Tue Jun 19 19:36:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masayoshi Mizuma X-Patchwork-Id: 10475279 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 E97B9601D7 for ; Tue, 19 Jun 2018 19:37:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA2F228BCD for ; Tue, 19 Jun 2018 19:37:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC17828BDA; Tue, 19 Jun 2018 19:37:11 +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 817F028BCD for ; Tue, 19 Jun 2018 19:37:11 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6E9C121175029; Tue, 19 Jun 2018 12:37:11 -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:c0d::243; helo=mail-qt0-x243.google.com; envelope-from=msys.mizuma@gmail.com; receiver=linux-nvdimm@lists.01.org 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) 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=TkZZMsRrTcqlo6pcz4r3f+PSPSfLWAd1JW5N9a1XoAO94P0WHdyM4NcHk5F/0hjrAc 4PKW1os6F5GBw+dIB/lPD6mvwwPpH2B5KXNSlHBrzcbQ6yqLg5G7FVXs00tc0SIOhMUc udB7uyECZQTn60Au7IFSefTwlWrRmZC4c8tmLFya+x2JApr0aYeucP3iEPT9uIl7jd8N Xn73ruROkA9LSXZYLzWnfB5HPvwL4S+SqfddeCspDhlj8jUGyzsxl0c5mnX4sI9LP7Hx 9IpChX+G7LX6CzmRpgNStAsT29fAg8lQcvBZQo1/Xz2PvlAQaI/O66GNY+XB6wEV8GBh COJw== 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=QstZg5eMHQA+HbCqrsz+xfO7JbVSsTKu4EZzj0czQjAEf+dkIGfGVilskK8e0GO7pd Z83xRLeR17MrS5L6+ThnAu8HXjn4a0KaH8V+StO06LFM7Ag2apviVJDGh2qv451HQWTZ ZUEeApFRXgWbRHrPUx+z2Lt6sNWhBvchPApGw96VvCWRIRtSiDgmEiFdF3jteCCvjgFf TNdtZaaxOEOLXRX66TzKlIrregACcPzdNRwSBzPvg7X8Iqf1sIbq5K3zsjdn52oDtjaj OX5filLfLPq91m2zc1toLPt+xFsn7YQ7+4SdZOFObmqC6q6fx3zbfHbiaYDpOjthV9P/ jVqQ== X-Gm-Message-State: APt69E3iN5ZgaXwV1KpUsfXWmMMCaZAGNPztYMf/czVYrCnFLvdP0stq gkTUHkBcVm9AE/WTMxynzvfG X-Google-Smtp-Source: ADUXVKKMrWaidYA1yni4+6qaGMVYxAV2QPQ9dSjIqFhGiYE/y6XTEaMQF4NdSIREZTuUUJIRY3Dktg== X-Received: by 2002:ac8:2b4e:: with SMTP id 14-v6mr16466415qtv.412.1529437028966; Tue, 19 Jun 2018 12:37:08 -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 b38-v6sm403372qta.96.2018.06.19.12.37.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Jun 2018 12:37:08 -0700 (PDT) From: Masayoshi Mizuma To: linux-nvdimm@lists.01.org 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> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180619193659.17815-1-msys.mizuma@gmail.com> References: <20180619193659.17815-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" +}