All of lore.kernel.org
 help / color / mirror / Atom feed
* [ndctl PATCH 1/2] ndctl, test: fix tests for the array vs object listing fix
@ 2018-07-11 23:56 Vishal Verma
  2018-07-11 23:56 ` [ndctl PATCH 2/2] ndctl, test: convert remaining tests to use test/common Vishal Verma
  2018-07-12 15:43 ` [ndctl PATCH 1/2] ndctl, test: fix tests for the array vs object listing fix Ross Zwisler
  0 siblings, 2 replies; 4+ messages in thread
From: Vishal Verma @ 2018-07-11 23:56 UTC (permalink / raw)
  To: linux-nvdimm; +Cc: Masayoshi Mizuma

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-12 20:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-11 23:56 [ndctl PATCH 1/2] ndctl, test: fix tests for the array vs object listing fix Vishal Verma
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.