Skip to contentSkip to conversation

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

PATCH New Vishal Verma 1 participant 1 message Jan 17, 2018 libnvdimm: non-volatile memory device

lore
Share & tools
lore

Vishal Verma

author maintainer
#0 lore raw

PATCH 1/1 ndctl, test: fix stale json in btt-pad-compat.sh

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.

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

test/btt-pad-compat.sh +3 -2
index d10efe3..129401b 100755
@@ -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
 
Signature · 6 lines
2.14.3

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm