All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "Williams, Dan J" <dan.j.williams@intel.com>
Cc: "Dokupil, Dariusz" <dariusz.dokupil@intel.com>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [ndctl PATCH] ndctl, test: add a unit test for partition rescanning
Date: Tue, 6 Mar 2018 21:41:08 +0000	[thread overview]
Message-ID: <1520372466.24924.82.camel@intel.com> (raw)
In-Reply-To: <CAPcyv4gDVp7pHWRgcBaOgyULT_Z+cohD6qfw5X-YmZ2-dOuthg@mail.gmail.com>


On Tue, 2018-03-06 at 13:34 -0800, Dan Williams wrote:
> On Mon, Mar 5, 2018 at 3:56 PM, Vishal Verma <vishal.l.verma@intel.co
> m> wrote:
> > pre-4.16 kernels had a bug where BTT partitions wouldn't come up on
> > driver probe because we were adding a zero-sized disk. Add a unit
> > test
> > that creates partitions, and cycles the namespace to ensure the
> > partitions are automatically brought up. This performs the test for
> > raw,
> > memory, and sector modes.
> > 
> > Reported-by: Dariusz Dokupil <dariusz.dokupil@intel.com>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> > ---
> >  test/Makefile.am          |   3 +-
> >  test/rescan-partitions.sh | 106
> > ++++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 108 insertions(+), 1 deletion(-)
> >  create mode 100755 test/rescan-partitions.sh
> > 
> > diff --git a/test/Makefile.am b/test/Makefile.am
> > index 749055c..496a663 100644
> > --- a/test/Makefile.am
> > +++ b/test/Makefile.am
> > @@ -20,7 +20,8 @@ TESTS =\
> >         hugetlb \
> >         btt-pad-compat.sh \
> >         firmware-update.sh \
> > -       ack-shutdown-count-set
> > +       ack-shutdown-count-set \
> > +       rescan-partitions.sh
> > 
> >  check_PROGRAMS =\
> >         libndctl \
> > diff --git a/test/rescan-partitions.sh b/test/rescan-partitions.sh
> > new file mode 100755
> > index 0000000..6dd289b
> > --- /dev/null
> > +++ b/test/rescan-partitions.sh
> > @@ -0,0 +1,106 @@
> > +#!/bin/bash -Ex
> > +# SPDX-License-Identifier: GPL-2.0
> > +# Copyright(c) 2018 Intel Corporation. All rights reserved.
> > +
> > +[ -f "../ndctl/ndctl" ] && [ -x "../ndctl/ndctl" ] &&
> > ndctl="../ndctl/ndctl"
> > +[ -f "./ndctl/ndctl" ] && [ -x "./ndctl/ndctl" ] &&
> > ndctl="./ndctl/ndctl"
> > +[ -z "$ndctl" ] && echo "Couldn't find an ndctl binary" && exit 1
> > +bus="nfit_test.0"
> > +json2var="s/[{}\",]//g; s/:/=/g"
> > +dev=""
> > +size=""
> > +blockdev=""
> > +rc=77
> > +
> > +trap 'err $LINENO' ERR
> > +
> > +# sample json:
> > +#{
> > +#  "dev":"namespace5.0",
> > +#  "mode":"sector",
> > +#  "size":"60.00 MiB (62.92 MB)",
> > +#  "uuid":"f1baa71a-d165-4da4-bb6a-083a2b0e6469",
> > +#  "blockdev":"pmem5s",
> > +#}
> > +
> > +# $1: Line number
> > +# $2: exit code
> > +err()
> > +{
> > +       [ -n "$2" ] && rc="$2"
> > +       echo "test/rescan-partitions.sh: failed at line $1"
> > +       exit "$rc"
> > +}
> > +
> > +check_min_kver()
> > +{
> > +       local ver="$1"
> > +       : "${KVER:=$(uname -r)}"
> > +
> > +       [ -n "$ver" ] || return 1
> > +       [[ "$ver" == "$(echo -e "$ver\n$KVER" | sort -V | head -1)"
> > ]]
> > +}
> > +check_min_kver "4.16" || { echo "kernel $KVER may not contain
> > fixes for partition rescanning"; exit "$rc"; }
> 
> I have a proposal for kernel version checks going forward. How about
> tests that fail the kernel version check return SKIP / PASS, and
> kernels that pass the kernel version check return FAIL / PASS for the
> test. This way we don't bail out early on backport kernels that could
> otherwise pass the test.
> 
> Thoughts?

So do you mean, for example, if a kernel version check fails, don't
skip immediately. Instead continue to run the test, and if something
actually fails, then return with a SKIP.

And conversely, for a kernel version that passes the included check, no
other condition can return a SKIP?  (What about something like missing
packages?)
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2018-03-06 21:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-05 23:56 [ndctl PATCH] ndctl, test: add a unit test for partition rescanning Vishal Verma
2018-03-06 21:34 ` Dan Williams
2018-03-06 21:41   ` Verma, Vishal L [this message]
2018-03-06 21:47     ` Dan Williams
2018-03-06 21:49       ` Verma, Vishal L
2018-03-06 22:04         ` Dan Williams
2018-03-06 22:07           ` Verma, Vishal L

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=1520372466.24924.82.camel@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dariusz.dokupil@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.