linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
From: Vishal Verma <vishal.l.verma@intel.com>
To: linux-nvdimm@lists.01.org
Cc: jacek.zloch@intel.com
Subject: [ndctl PATCH] ndctl, test: fix tests that use error injection on older kernels
Date: Wed, 21 Feb 2018 16:20:37 -0700	[thread overview]
Message-ID: <20180221232037.20165-1-vishal.l.verma@intel.com> (raw)

When we updated from using canned badblocks to injected errors in
nfit_test, we ended up breaking the tests for older kernels that didn't
have error injection capabilities.

Fix this by first checking if badblocks already exist. If they do, we
have an older kernel with canned badblocks, and we can simply use those.
If not, then apttempt to inject them as needed.

Reported-by: Jacek Zolch <jacek.zloch@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 test/btt-errors.sh    | 2 +-
 test/clear.sh         | 4 +++-
 test/daxdev-errors.sh | 4 +++-
 test/pmem-errors.sh   | 4 +++-
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/test/btt-errors.sh b/test/btt-errors.sh
index 383abb6..ecc1282 100755
--- a/test/btt-errors.sh
+++ b/test/btt-errors.sh
@@ -59,7 +59,7 @@ force_raw()
 	fi
 }
 
-check_min_kver "4.14" || { echo "kernel $KVER may lack BTT error handling"; exit $rc; }
+check_min_kver "4.15" || { echo "kernel $KVER may lack BTT error handling"; exit $rc; }
 
 set -e
 mkdir -p $MNT
diff --git a/test/clear.sh b/test/clear.sh
index c22ff3b..9f16397 100755
--- a/test/clear.sh
+++ b/test/clear.sh
@@ -57,7 +57,9 @@ eval $(echo $json | sed -e "$json2var")
 # inject errors in the middle of the namespace, verify that reading fails
 err_sector="$(((size/512) / 2))"
 err_count=8
-$NDCTL inject-error --block="$err_sector" --count=$err_count $dev
+if [ ! -e /sys/block/$blockdev/badblocks ]; then
+	$NDCTL inject-error --block="$err_sector" --count=$err_count $dev
+fi
 read sector len < /sys/block/$blockdev/badblocks
 [ $((sector * 2)) -ne $((size /512)) ] && echo "fail: $LINENO" && exit 1
 if dd if=/dev/$blockdev of=/dev/null iflag=direct bs=512 skip=$sector count=$len; then
diff --git a/test/daxdev-errors.sh b/test/daxdev-errors.sh
index d15bd82..4b7373e 100755
--- a/test/daxdev-errors.sh
+++ b/test/daxdev-errors.sh
@@ -81,7 +81,9 @@ busdev=$dev
 # inject errors in the middle of the namespace
 err_sector="$(((size/512) / 2))"
 err_count=8
-$NDCTL inject-error --block="$err_sector" --count=$err_count $nsdev
+if [ ! -e /sys/block/$blockdev/badblocks ]; then
+	$NDCTL inject-error --block="$err_sector" --count=$err_count $nsdev
+fi
 
 read sector len < /sys/bus/nd/devices/$region/badblocks
 echo "sector: $sector len: $len"
diff --git a/test/pmem-errors.sh b/test/pmem-errors.sh
index d3e05b0..7b6775b 100755
--- a/test/pmem-errors.sh
+++ b/test/pmem-errors.sh
@@ -57,7 +57,9 @@ eval $(echo $json | sed -e "$json2var")
 # inject errors in the middle of the namespace, verify that reading fails
 err_sector="$(((size/512) / 2))"
 err_count=8
-$NDCTL inject-error --block="$err_sector" --count=$err_count $dev
+if [ ! -e /sys/block/$blockdev/badblocks ]; then
+	$NDCTL inject-error --block="$err_sector" --count=$err_count $dev
+fi
 read sector len < /sys/block/$blockdev/badblocks
 [ $((sector * 2)) -ne $((size /512)) ] && echo "fail: $LINENO" && false
 if dd if=/dev/$blockdev of=/dev/null iflag=direct bs=512 skip=$sector count=$len; then
-- 
2.14.3

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

             reply	other threads:[~2018-02-21 23:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-21 23:20 Vishal Verma [this message]
2018-02-24  0:29 ` [ndctl PATCH] ndctl, test: fix tests that use error injection on older kernels Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180221232037.20165-1-vishal.l.verma@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=jacek.zloch@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).