Message ID | 20220530130811.3006554-3-hch@lst.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [blktests,1/9] nvme: use _have_loop instead of _have_modules loop | expand |
On May 30, 2022 / 15:08, Christoph Hellwig wrote: > Unlike _have_modules this allows allows for a built-in driver. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > common/rc | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/common/rc b/common/rc > index 5e35e21..a93b227 100644 > --- a/common/rc > +++ b/common/rc > @@ -28,6 +28,18 @@ _have_root() { > return 0 > } > > +_have_driver() > +{ > + local modname="${1/-/_}" > + > + if [ ! -d "/sys/module/${modname}" ] && ! modprobe -q ${modname}; then Nit: double quote is required for ${modname} to make shellcheck happy. Other than that, looks good to me. Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
On Tue, May 31, 2022 at 11:12:45AM +0000, Shinichiro Kawasaki wrote: > > +_have_driver() > > +{ > > + local modname="${1/-/_}" > > + > > + if [ ! -d "/sys/module/${modname}" ] && ! modprobe -q ${modname}; then > > Nit: double quote is required for ${modname} to make shellcheck happy. It is aready quote when assigning to modname, so there is no actual need. But I'll add the quotes to make the checker happy.
diff --git a/common/rc b/common/rc index 5e35e21..a93b227 100644 --- a/common/rc +++ b/common/rc @@ -28,6 +28,18 @@ _have_root() { return 0 } +_have_driver() +{ + local modname="${1/-/_}" + + if [ ! -d "/sys/module/${modname}" ] && ! modprobe -q ${modname}; then + SKIP_REASON="driver ${modname} is not available" + return 1 + fi + + return 0 +} + _have_modules() { local missing=() local module
Unlike _have_modules this allows allows for a built-in driver. Signed-off-by: Christoph Hellwig <hch@lst.de> --- common/rc | 12 ++++++++++++ 1 file changed, 12 insertions(+)