Port contrib/netbsd-tests/fs/h_funcs.subr to FreeBSD

Use kldstat -m to determine whether or not a filesystem is loaded. This works
well with tmpfs, ufs, and zfs

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
This commit is contained in:
ngie 2016-09-20 16:28:57 +00:00
parent 857d7c1572
commit e1fde73d57

View File

@ -45,6 +45,15 @@ require_fs() {
# if we have autoloadable modules, just assume the file system
atf_require_prog sysctl
# Begin FreeBSD
if true; then
if kldstat -m ${name}; then
found=yes
else
found=no
fi
else
# End FreeBSD
autoload=$(sysctl -n kern.module.autoload)
[ "${autoload}" = "1" ] && return 0
@ -57,6 +66,9 @@ require_fs() {
fi
shift
done
# Begin FreeBSD
fi
# End FreeBSD
[ ${found} = yes ] || \
atf_skip "The kernel does not include support the " \
"\`${name}' file system"