nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [ndctl PATCH] ndctl, test: fix stale json in btt-pad-compat.sh
@ 2018-01-17 22:13 Vishal Verma
  0 siblings, 0 replies; only message in thread
From: Vishal Verma @ 2018-01-17 22:13 UTC (permalink / raw)
  To: linux-nvdimm

We weren't using the updated results of any but the first of the ndctl
create-namespace commands. This could potentially result in the test
being unreliable.

Use the json being emitted by the create-namespace commands to get the
device etc. for future operations. Also do a 'reset' before attempting
the old format restoration test.

Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 test/btt-pad-compat.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Dan - If it is easier, I can send a patch for just adding the final
version of this test as a standalone patch. So far there have been three
patches (including this) that touch this test. This one if a minor
bugfix, so it could also be squashed with the first patch where this is
introduced.

diff --git a/test/btt-pad-compat.sh b/test/btt-pad-compat.sh
index d10efe3..129401b 100755
--- a/test/btt-pad-compat.sh
+++ b/test/btt-pad-compat.sh
@@ -144,14 +144,14 @@ copy_xxd_img()
 create_oldfmt_ns()
 {
 	# create null-uuid namespace
-	$ndctl create-namespace -b "$bus" -t pmem -m raw -l 4096 -u 00000000-0000-0000-0000-000000000000
+	json=$($ndctl create-namespace -b "$bus" -t pmem -m raw -l 4096 -u 00000000-0000-0000-0000-000000000000)
 	eval "$(echo "$json" | sed -e "$json2var")"
 	[ -n "$dev" ] || err "$LINENO" 2
 	[ -n "$size" ] || err "$LINENO" 2
 	[ $size -gt 0 ] || err "$LINENO" 2
 
 	# reconfig it to sector mode
-	$ndctl create-namespace -b "$bus" -e $dev -m sector --force
+	json=$($ndctl create-namespace -b "$bus" -e $dev -m sector --force)
 	eval "$(echo "$json" | sed -e "$json2var")"
 	[ -n "$dev" ] || err "$LINENO" 2
 	[ -n "$size" ] || err "$LINENO" 2
@@ -185,6 +185,7 @@ do_tests()
 	verify_idx 0 1
 
 	# do the same with an old format namespace
+	reset
 	create_oldfmt_ns
 	verify_idx 0 2
 
-- 
2.14.3

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-01-17 22:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-17 22:13 [ndctl PATCH] ndctl, test: fix stale json in btt-pad-compat.sh Vishal Verma

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).