Message ID | 20191218011925.19428-2-marcos.souza.org@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | tests: do not fail if dm-thin is missing | expand |
Forget this patch, I understood it wrong. I will add setup_root_helper before the $SUDO_HELPER from v1 in a different patch. On Tue, 2019-12-17 at 22:19 -0300, Marcos Paulo de Souza wrote: > From: Marcos Paulo de Souza <mpdesouza@suse.com> > > This function will be used later to test if dm-thin is supported. > Inspired by fstests. > > Suggested-by: Qu Wenruo <wqu@suse.com> > Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com> > --- > Changes from v1: > Removed the $SUDO_HELPER variable when executing modprobe and > dmsetup (Qu > Wenruo) > > tests/common | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/tests/common b/tests/common > index ca098444..20ad7fd9 100644 > --- a/tests/common > +++ b/tests/common > @@ -322,6 +322,19 @@ check_global_prereq() > fi > } > > +# check if the targets passed as arguments are available, and if not > just skip > +# the test > +check_dm_target_support() > +{ > + for target in "$@"; do > + modprobe dm-$target >/dev/null 2>&1 > + dmsetup targets 2>&1 | grep -q ^$target > + if [ $? -ne 0 ]; then > + _not_run "This test requires dm $target > support." > + fi > + done > +} > + > check_image() > { > local image
diff --git a/tests/common b/tests/common index ca098444..20ad7fd9 100644 --- a/tests/common +++ b/tests/common @@ -322,6 +322,19 @@ check_global_prereq() fi } +# check if the targets passed as arguments are available, and if not just skip +# the test +check_dm_target_support() +{ + for target in "$@"; do + modprobe dm-$target >/dev/null 2>&1 + dmsetup targets 2>&1 | grep -q ^$target + if [ $? -ne 0 ]; then + _not_run "This test requires dm $target support." + fi + done +} + check_image() { local image