]> xenbits.xensource.com Git - people/royger/freebsd.git/commitdiff
Make test_unmount usable in cleanup subroutines
authorngie <ngie@FreeBSD.org>
Fri, 9 Dec 2016 23:42:04 +0000 (23:42 +0000)
committerngie <ngie@FreeBSD.org>
Fri, 9 Dec 2016 23:42:04 +0000 (23:42 +0000)
- 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

contrib/netbsd-tests/fs/tmpfs/h_funcs.subr

index 07c1644da66fce84c15c28cd6b6538d1d5d858ba..edab7899ea71a59c77a6bfb2bfc2e1cce098e228 100644 (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]
 #