Skip to contentSkip to conversation

ndctl, tests: firmware-update.sh post-test cleanup

PATCH In review Ross Zwisler 2 participants 2 messages Feb 23, 2018 libnvdimm: non-volatile memory device

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ndctl, tests: firmware-update.sh post-test cleanup

When firmware-update.sh is run multiple times by itself, all runs but the first fail with this:

+ ../ndctl/ndctl update-firmware -d nmem1 -f update-fw.img
Error: START FIRMWARE UPDATE failed: 0x9

Error: Another firmware upload in progress or finished.

Fix this by having the test properly clean up and disable all the nfit_test regions and unloading the nfit_test module, as we do in test/pmem-errors.sh et al.

---
 test/firmware-update.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
test/firmware-update.sh +9 -2
index 1736472..44c1412 100755
@@ -6,6 +6,7 @@
 [ -f "./ndctl/ndctl" ] && [ -x "./ndctl/ndctl" ] && ndctl="./ndctl/ndctl"
 [ -z "$ndctl" ] && echo "Couldn't find an ndctl binary" && exit 1
 bus="nfit_test.0"
+bus1="nfit_test.1"
 json2var="s/[{}\",]//g; s/:/=/g"
 rc=77
 dev=""
@@ -41,6 +42,13 @@ reset()
 	fi
 }
 
+cleanup()
+{
+	$ndctl disable-region -b "$bus" all
+	$ndctl disable-region -b "$bus1" all
+	modprobe -r nfit_test
+}
+
 detect()
 {
 	dev=$($ndctl list -b "$bus" -D | jq .[0].dev | tr -d '"')
@@ -59,6 +67,5 @@ rc=1
 reset
 detect
 do_tests
-reset
+cleanup
 exit 0
-
Signature · 6 lines
2.14.3

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Ross Zwisler

When firmware-update.sh is run multiple times by itself, all runs but the first fail with this:

+ ../ndctl/ndctl update-firmware -d nmem1 -f update-fw.img
Error: START FIRMWARE UPDATE failed: 0x9

Error: Another firmware upload in progress or finished.

Fix this by having the test properly clean up and disable all the nfit_test regions and unloading the nfit_test module, as we do in test/pmem-errors.sh et al.

Looks good to me:

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