diff mbox series

[ndctl] daxctl/test: Skip daxctl-devices.sh on older kernels

Message ID 156531368648.2136155.13013612862545053331.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State New, archived
Headers show
Series [ndctl] daxctl/test: Skip daxctl-devices.sh on older kernels | expand

Commit Message

Dan Williams Aug. 9, 2019, 1:21 a.m. UTC
If the 'kmem' module is missing skip the test to support running the
unit tests on older -stable kernels pre-v5.1.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/daxctl-devices.sh |    7 +++++++
 1 file changed, 7 insertions(+)

Comments

Jeff Moyer Aug. 12, 2019, 8:45 p.m. UTC | #1
Dan Williams <dan.j.williams@intel.com> writes:

> If the 'kmem' module is missing skip the test to support running the
> unit tests on older -stable kernels pre-v5.1.
>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

Note that the kernel module could also just not be configured.

> ---
>  test/daxctl-devices.sh |    7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/test/daxctl-devices.sh b/test/daxctl-devices.sh
> index 04f53f7b13ab..4102fb6990ae 100755
> --- a/test/daxctl-devices.sh
> +++ b/test/daxctl-devices.sh
> @@ -18,6 +18,13 @@ find_testdev()
>  {
>  	local rc=77
>  
> +	# The kmem driver is needed to change the device mode, only
> +	# kernels >= v5.1 might have it available. Skip if not.
> +	if ! modinfo kmem; then
> +		"Unable to find kmem module"

I think you need a printf, there.  Also, do you want the modinfo output
in the test log?

-Jeff

> +		exit $rc
> +	fi
> +
>  	# find a victim device
>  	testbus="$ACPI_BUS"
>  	testdev=$("$NDCTL" list -b "$testbus" -Ni | jq -er '.[0].dev | .//""')
>
> _______________________________________________
> Linux-nvdimm mailing list
> Linux-nvdimm@lists.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm
Dan Williams Aug. 12, 2019, 9:28 p.m. UTC | #2
On Mon, Aug 12, 2019 at 1:45 PM Jeff Moyer <jmoyer@redhat.com> wrote:
>
> Dan Williams <dan.j.williams@intel.com> writes:
>
> > If the 'kmem' module is missing skip the test to support running the
> > unit tests on older -stable kernels pre-v5.1.
> >
> > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
>
> Note that the kernel module could also just not be configured.

Yes, but then the test would still report "SKIP" and the developer
could take a deeper look if they expected to see all "PASS".

>
> > ---
> >  test/daxctl-devices.sh |    7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/test/daxctl-devices.sh b/test/daxctl-devices.sh
> > index 04f53f7b13ab..4102fb6990ae 100755
> > --- a/test/daxctl-devices.sh
> > +++ b/test/daxctl-devices.sh
> > @@ -18,6 +18,13 @@ find_testdev()
> >  {
> >       local rc=77
> >
> > +     # The kmem driver is needed to change the device mode, only
> > +     # kernels >= v5.1 might have it available. Skip if not.
> > +     if ! modinfo kmem; then
> > +             "Unable to find kmem module"
>
> I think you need a printf, there.

Whoops, yes.

> Also, do you want the modinfo output in the test log?

Don't think it matters either way since it all ends up in the log.
Jeff Moyer Aug. 12, 2019, 9:31 p.m. UTC | #3
Dan Williams <dan.j.williams@intel.com> writes:

> On Mon, Aug 12, 2019 at 1:45 PM Jeff Moyer <jmoyer@redhat.com> wrote:
>>
>> Dan Williams <dan.j.williams@intel.com> writes:
>>
>> > If the 'kmem' module is missing skip the test to support running the
>> > unit tests on older -stable kernels pre-v5.1.
>> >
>> > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
>>
>> Note that the kernel module could also just not be configured.
>
> Yes, but then the test would still report "SKIP" and the developer
> could take a deeper look if they expected to see all "PASS".

Right, I see this as a good thing.  I meant to point out that your
commit message was a bit misleading.

>> > ---
>> >  test/daxctl-devices.sh |    7 +++++++
>> >  1 file changed, 7 insertions(+)
>> >
>> > diff --git a/test/daxctl-devices.sh b/test/daxctl-devices.sh
>> > index 04f53f7b13ab..4102fb6990ae 100755
>> > --- a/test/daxctl-devices.sh
>> > +++ b/test/daxctl-devices.sh
>> > @@ -18,6 +18,13 @@ find_testdev()
>> >  {
>> >       local rc=77
>> >
>> > +     # The kmem driver is needed to change the device mode, only
>> > +     # kernels >= v5.1 might have it available. Skip if not.
>> > +     if ! modinfo kmem; then
>> > +             "Unable to find kmem module"
>>
>> I think you need a printf, there.
>
> Whoops, yes.
>
>> Also, do you want the modinfo output in the test log?
>
> Don't think it matters either way since it all ends up in the log.

It's tough to say whether it adds value, so sure, leave it in.

Cheers,
Jeff
diff mbox series

Patch

diff --git a/test/daxctl-devices.sh b/test/daxctl-devices.sh
index 04f53f7b13ab..4102fb6990ae 100755
--- a/test/daxctl-devices.sh
+++ b/test/daxctl-devices.sh
@@ -18,6 +18,13 @@  find_testdev()
 {
 	local rc=77
 
+	# The kmem driver is needed to change the device mode, only
+	# kernels >= v5.1 might have it available. Skip if not.
+	if ! modinfo kmem; then
+		"Unable to find kmem module"
+		exit $rc
+	fi
+
 	# find a victim device
 	testbus="$ACPI_BUS"
 	testdev=$("$NDCTL" list -b "$testbus" -Ni | jq -er '.[0].dev | .//""')