On Wed, Dec 18, 2019 at 08:48:21AM +0800, Qu Wenruo wrote:
> >>> +# check if dmsetup and targets passed as arguments are available,
> >> and skip the
> >>> +# test if they aren't.
> >>> check_dm_target_support()
> >>> {
> >>> + which dmsetup &> /dev/null
> >>> + if [ $? -ne 0 ]; then
> >>> + _not_run "This test requires dmsetup tool.";
> >>> + fi
> >>
> >> What about using existing check_global_prereq()?
> >
> > check_global_prereq call _fail when the executable is not found in
> > $PATH, that's why I open coded the implementation and just called
> > _not_run.
>
> Makes sense.
>
> Although it would be even better to change from "_fail" to "_not_run"
> for check_global_prereq().
I'd rather keep it as _fail, the utilities checked by this helper is
mostly some system tool or other filesystem tool, all should be present
for the testing. I don't want the testsuite to skip random tests without
a good reason. We can add a script or make target to make the checks in
advance and not when some test fails after a long time.