diff mbox

[ndctl] test/clear.sh: test to making sure cleared badblocks don't reappear

Message ID 1475266232-18680-1-git-send-email-vishal.l.verma@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Verma, Vishal L Sept. 30, 2016, 8:10 p.m. UTC
From v4.9 onwards, cleared badblocks won't reappear on an ARS or simply
after disabling/re-enabling a namespace. Add a test to make sure this
doesn't regress.

Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 test/clear.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Dan Williams Sept. 30, 2016, 10:53 p.m. UTC | #1
On Fri, Sep 30, 2016 at 1:10 PM, Vishal Verma <vishal.l.verma@intel.com> wrote:
> From v4.9 onwards, cleared badblocks won't reappear on an ARS or simply
> after disabling/re-enabling a namespace. Add a test to make sure this
> doesn't regress.
>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> ---
>  test/clear.sh | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/test/clear.sh b/test/clear.sh
> index 7765c10..336ee44 100755
> --- a/test/clear.sh
> +++ b/test/clear.sh
> @@ -69,6 +69,16 @@ if read sector len < /sys/block/$blockdev/badblocks; then
>         echo "fail: $LINENO" && exit 1
>  fi
>
> +# check for re-appearance of stale badblocks from poison_list
> +$NDCTL disable-region $BUS all
> +$NDCTL enable-region $BUS all
> +
> +# since we have cleared the errors, a disable/reenable shouldn't bring them back
> +if read sector len < /sys/block/$blockdev/badblocks; then
> +       # fail if reading badblocks returns data
> +       echo "fail: $LINENO" && exit 1
> +fi
> +

Hmm, can you gate this test by kernel version? I want to allow the
unit test suite be run with expectations set to a specific kernel
version.  We have ndctl_test_attempt() for C tests, but for shell
tests we'd want to use get_system_kver() which honors a "KVER"
environment variable.
diff mbox

Patch

diff --git a/test/clear.sh b/test/clear.sh
index 7765c10..336ee44 100755
--- a/test/clear.sh
+++ b/test/clear.sh
@@ -69,6 +69,16 @@  if read sector len < /sys/block/$blockdev/badblocks; then
 	echo "fail: $LINENO" && exit 1
 fi
 
+# check for re-appearance of stale badblocks from poison_list
+$NDCTL disable-region $BUS all
+$NDCTL enable-region $BUS all
+
+# since we have cleared the errors, a disable/reenable shouldn't bring them back
+if read sector len < /sys/block/$blockdev/badblocks; then
+	# fail if reading badblocks returns data
+	echo "fail: $LINENO" && exit 1
+fi
+
 $NDCTL disable-region $BUS all
 $NDCTL disable-region $BUS1 all
 modprobe -r nfit_test