Make test_unmount usable in cleanup subroutines

- Duplicate test_unmount to _test_unmount
- Remove atf_check calls
- Call _test_unmount from test_unmount, checking the exit code
  at the end, and returning it to maintain the test_unmount
  "contract"

MFC after:	1 week
This commit is contained in:
Enji Cooper 2016-12-09 23:42:04 +00:00
parent 40975988cb
commit 5be335bb11

View File

@ -59,12 +59,31 @@ test_mount() {
# Unmounts the file system mounted by test_mount.
#
test_unmount() {
# Begin FreeBSD
_test_unmount
exit_code=$?
atf_check_equal "$exit_code" "0"
return $exit_code
# End FreeBSD
cd - >/dev/null
atf_check -s eq:0 -o empty -e empty umount ${Mount_Point}
atf_check -s eq:0 -o empty -e empty rmdir ${Mount_Point}
Mount_Point=
}
# Begin FreeBSD
_test_unmount() {
if [ -z "${Mount_Point}" -o ! -d "${Mount_Point}" ]; then
return 0
fi
cd - >/dev/null
umount ${Mount_Point}
rmdir ${Mount_Point}
Mount_Point=
}
# End FreeBSD
#
# kqueue_monitor expected_nevents file1 [.. fileN]
#