On Wed, Apr 5, 2017 at 12:40 PM, Dave Jiang <dave.jiang(a)intel.com> wrote:
Implementation had static config and made assumption that the region
in
nfit_test will be ndbus0. Adding code to discover the proper bus and also
pass onto daxdev-errors.
Signed-off-by: Dave Jiang <dave.jiang(a)intel.com>
---
test/daxdev-errors.c | 9 +++++----
test/daxdev-errors.sh | 11 ++++++++---
2 files changed, 13 insertions(+), 7 deletions(-)
[..]
diff --git a/test/daxdev-errors.sh b/test/daxdev-errors.sh
index 1777210..ee07f81 100755
--- a/test/daxdev-errors.sh
+++ b/test/daxdev-errors.sh
@@ -5,6 +5,7 @@ NDCTL="../ndctl/ndctl"
DAXCTL="../daxctl/daxctl"
BUS="-b nfit_test.0"
BUS1="-b nfit_test.1"
+json2var="s/[{}\",]//g; s/:/=/g"
rc=77
err() {
@@ -52,15 +53,19 @@ chardev=$(echo $json | jq ". | select(.mode ==
\"dax\") | .daxregion.devices[0].
# ]
# }
-read sector len < /sys/bus/platform/devices/nfit_test.0/ndbus0/region5/badblocks
+json1=$($NDCTL list $BUS)
+eval $(echo $json1 | sed -e "$json2var")
+
+echo "read /sys/bus/platform/devices/nfit_test.0/$dev/region5/badblocks"
+read sector len < /sys/bus/platform/devices/nfit_test.0/$dev/region5/badblocks
echo "sector: $sector len: $len"
# run the daxdev-errors test
test -x ./daxdev-errors
-./daxdev-errors
+./daxdev-errors $dev
# check badblocks, should be empty
-if read sector len < /sys/bus/platform/devices/nfit_test.0/ndbus0/region5/badblocks;
then
+if read sector len < /sys/bus/platform/devices/nfit_test.0/$dev/region5/badblocks;
then
The region numbers are dynamic, so region5 might not be what you
expect depending on the system configuration and what buses get loaded
first. You can use ndctl list to find the expected region explicitly.