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.
Signed-off-by: Ross Zwisler <ross.zwisler(a)linux.intel.com>
---
test/firmware-update.sh | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/test/firmware-update.sh b/test/firmware-update.sh
index 1736472..44c1412 100755
--- a/test/firmware-update.sh
+++ b/test/firmware-update.sh
@@ -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
-
--
2.14.3