diff mbox

[ndctl] ndctl, test: fix stale json in btt-pad-compat.sh

Message ID 20180117221324.16588-1-vishal.l.verma@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Verma, Vishal L Jan. 17, 2018, 10:13 p.m. UTC
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 mbox

Patch

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