From: Vishal Verma <vishal.l.verma@intel.com>
To: linux-nvdimm@lists.01.org
Cc: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Subject: [ndctl PATCH 1/2] ndctl, test: fix tests for the array vs object listing fix
Date: Wed, 11 Jul 2018 17:56:43 -0600 [thread overview]
Message-ID: <20180711235644.26998-1-vishal.l.verma@intel.com> (raw)
The commit below updated json listings to always be arrays unless,
potentially, --human was specified. As a fallout of the change, some
unit tests that used jq to look for certain elements, or the json2var
conversion broke in certain cases. Fix the jq query in sector-mode.sh,
and fix json2var in test/common. The 'destructive' class of unit tests
still need to be converted to the test/common scheme, and subsequently
have their own local json2var instances. These will be fixed in a future
commit by simply performing the test/common conversion.
Fixes: 72c46ab194d9 ("ndctl list: always output array without --human")
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
test/common | 2 +-
test/sector-mode.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/common b/test/common
index fb4e18e..1b9d3da 100644
--- a/test/common
+++ b/test/common
@@ -79,5 +79,5 @@ _cleanup()
#
json2var()
{
- sed -e "s/[{}\",]//g; s/:/=/g"
+ sed -e "s/[{}\",]//g; s/\[//g; s/\]//g; s/:/=/g"
}
diff --git a/test/sector-mode.sh b/test/sector-mode.sh
index 16c1ddf..4b964c5 100755
--- a/test/sector-mode.sh
+++ b/test/sector-mode.sh
@@ -31,7 +31,7 @@ $NDCTL enable-region -b $NFIT_TEST_BUS1 all
rc=1
query=". | sort_by(.size) | reverse | .[0].dev"
NAMESPACE=$($NDCTL list -b $NFIT_TEST_BUS1 -N | jq -r "$query")
-REGION=$($NDCTL list -R --namespace=$NAMESPACE | jq -r ".dev")
+REGION=$($NDCTL list -R --namespace=$NAMESPACE | jq -r "(.[]) | .dev")
echo 0 > /sys/bus/nd/devices/$REGION/read_only
$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m sector -f -l 4K
$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m dax -f -a 4K
--
2.14.4
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
next reply other threads:[~2018-07-11 23:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-11 23:56 Vishal Verma [this message]
2018-07-11 23:56 ` [ndctl PATCH 2/2] ndctl, test: convert remaining tests to use test/common Vishal Verma
2018-07-12 20:15 ` Masayoshi Mizuma
2018-07-12 15:43 ` [ndctl PATCH 1/2] ndctl, test: fix tests for the array vs object listing fix Ross Zwisler
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=20180711235644.26998-1-vishal.l.verma@intel.com \
--to=vishal.l.verma@intel.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;
as well as URLs for NNTP newsgroup(s).