Author: ngie
Date: Fri Dec  9 23:42:04 2016
New Revision: 309778
URL: https://svnweb.freebsd.org/changeset/base/309778

Log:
  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

Modified:
  head/contrib/netbsd-tests/fs/tmpfs/h_funcs.subr

Modified: head/contrib/netbsd-tests/fs/tmpfs/h_funcs.subr
==============================================================================
--- head/contrib/netbsd-tests/fs/tmpfs/h_funcs.subr     Fri Dec  9 23:37:14 
2016        (r309777)
+++ head/contrib/netbsd-tests/fs/tmpfs/h_funcs.subr     Fri Dec  9 23:42:04 
2016        (r309778)
@@ -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]
 #
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to