From patchwork Thu Jun 14 19:43:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masayoshi Mizuma X-Patchwork-Id: 10465143 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 EEE3A600D0 for ; Thu, 14 Jun 2018 19:43:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCD6328BA8 for ; Thu, 14 Jun 2018 19:43:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D173D28C22; Thu, 14 Jun 2018 19:43:52 +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 88A2828BA8 for ; Thu, 14 Jun 2018 19:43:52 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6FE582116821E; Thu, 14 Jun 2018 12:43:52 -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::244; helo=mail-qk0-x244.google.com; envelope-from=msys.mizuma@gmail.com; receiver=linux-nvdimm@lists.01.org Received: from mail-qk0-x244.google.com (mail-qk0-x244.google.com [IPv6:2607:f8b0:400d:c09::244]) (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 85BE921164C5B for ; Thu, 14 Jun 2018 12:43:51 -0700 (PDT) Received: by mail-qk0-x244.google.com with SMTP id 185-v6so4337213qkk.11 for ; Thu, 14 Jun 2018 12:43:51 -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=NLo8X2TvicnXoEf4H79XbdANt+4IdD+FMWxHiYGszR34sIjcA/P8DxOYY5a+bKXyv/ WTA/lq6+QqcTbSYF964SEcBnGqGJUqgWDBNIom67ttzYSnvTaZNM8TTr7RXzkILMG9mn tMyo37Y/eEEj3JsXgUr6az7lRgSyQRpwl6pRXbHgnpxKNm7+bHY/VQnP8NY6w34aK108 GSqHFW/3euSMQlo44Dmi8c6ZIkl5CabO8nR85VYhXdCbta5rpKM/ligJ+fXX+/keTqNO tr+NIKRNu0rgzeoyak8JFsammhs45KFpzRIFD+K7KOwtZ05gPu5ymRxYnykR5euuwXrR gJ4Q== 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=OYzi8xuGpU/90SdeG+F5AvM48wPps8Czn4PCQTLDsBEjMQPIXAw4HCd8xHF8LOa70O f9O8nA0seCII0gIzS4gQD8IMVKrRdTOHw25ULBy88lF2c5Rbv9HKQ3Vyu1XMAszzzs5S q12GEumVZI3aHtDffvUrdQL3Dl0Fqjr2HR2U9Kb/4MhX5np4Iol6u/mCO6I04Ad8vtl5 p/ifTO2RAeYTvASIBogb+JgWjaXruYG+2fD6nk+rdSOPIFK/BfeI2vXLGQOpooCcniXV SSNQmQAxyx/nIek6WMGKxHqs7t+jmur5wAev4gUCqx1NrHON1uCRbgGSzPDBXrlVkzD3 ZePw== X-Gm-Message-State: APt69E1DRf0PMV4OxXmG52bkld5CF65P9JzvafjkmqOKe9ci5KYgl1u8 MUNOwPgj23JUpbPN2/jS6NAd X-Google-Smtp-Source: ADUXVKIKw4wHzYxwUrBp8fm1N1okMNMuTExmxP1/O/VpM4lqMO+Ynqr+3GUmS7jXP15Qjhp5fZZcFA== X-Received: by 2002:ae9:ed13:: with SMTP id c19-v6mr3313020qkg.127.1529005430373; Thu, 14 Jun 2018 12:43:50 -0700 (PDT) Received: from gabell.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id z12-v6sm2687502qkf.66.2018.06.14.12.43.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jun 2018 12:43:49 -0700 (PDT) From: Masayoshi Mizuma To: linux-nvdimm@lists.01.org Subject: [PATCH 1/2] nfit, test: Add NFIT_TEST_BUS[01] variable and some helper funtions to common Date: Thu, 14 Jun 2018 15:43:35 -0400 Message-Id: <20180614194336.15341-2-msys.mizuma@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180614194336.15341-1-msys.mizuma@gmail.com> References: <20180614194336.15341-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" +}