From: Masayoshi Mizuma <msys.mizuma@gmail.com>
To: linux-nvdimm@lists.01.org
Cc: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
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 [thread overview]
Message-ID: <20180619193659.17815-2-msys.mizuma@gmail.com> (raw)
In-Reply-To: <20180619193659.17815-1-msys.mizuma@gmail.com>
From: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
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 <m.mizuma@jp.fujitsu.com>
---
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
next prev parent reply other threads:[~2018-06-19 19:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-19 19:36 [PATCH v3 0/2] ndctl, test: Add some global variables and functions to cleanup Masayoshi Mizuma
2018-06-19 19:36 ` Masayoshi Mizuma [this message]
2018-06-19 19:36 ` [PATCH v3 2/2] ndctl, test: cleanup test scripts Masayoshi Mizuma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180619193659.17815-2-msys.mizuma@gmail.com \
--to=msys.mizuma@gmail.com \
--cc=linux-nvdimm@lists.01.org \
--cc=m.mizuma@jp.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox