Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F162965413
D57160.id178363.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D57160.id178363.diff
View Options
diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist
--- a/etc/mtree/BSD.tests.dist
+++ b/etc/mtree/BSD.tests.dist
@@ -1281,6 +1281,8 @@
..
..
usr.sbin
+ autofs
+ ..
certctl
..
chown
diff --git a/usr.sbin/autofs/Makefile b/usr.sbin/autofs/Makefile
--- a/usr.sbin/autofs/Makefile
+++ b/usr.sbin/autofs/Makefile
@@ -1,3 +1,5 @@
+.include <src.opts.mk>
+
CONFS= auto_master
PACKAGE=autofs
PROG= automountd
@@ -22,4 +24,7 @@
SUBDIR= autofs
+HAS_TESTS= yes
+SUBDIR.${MK_TESTS}+= tests
+
.include <bsd.prog.mk>
diff --git a/usr.sbin/autofs/tests/Makefile b/usr.sbin/autofs/tests/Makefile
new file mode 100644
--- /dev/null
+++ b/usr.sbin/autofs/tests/Makefile
@@ -0,0 +1,5 @@
+PACKAGE= tests
+
+ATF_TESTS_SH+= autofs_rmdir_test
+
+.include <bsd.test.mk>
diff --git a/usr.sbin/autofs/tests/autofs_rmdir_test.sh b/usr.sbin/autofs/tests/autofs_rmdir_test.sh
new file mode 100755
--- /dev/null
+++ b/usr.sbin/autofs/tests/autofs_rmdir_test.sh
@@ -0,0 +1,78 @@
+#
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright (c) 2025 Rob Wing <rew@FreeBSD.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+atf_init_test_cases()
+{
+ atf_add_test_case autofs_rmdir
+}
+
+atf_test_case autofs_rmdir cleanup
+autofs_rmdir_head()
+{
+ atf_set "descr" "verify rmdir() succeeds with autofs filesystem"
+ atf_set "require.user" root
+}
+
+# bugzilla PR 241531
+autofs_rmdir_body()
+{
+ atf_check daemon automountd
+ atf_check automount
+ atf_check -o not-empty mount -t autofs
+
+ # verify /media/md666 doesn't exist
+ atf_check -s exit:1 -e not-empty ls /media/md666
+
+ # create md666 device with UFS filesystem
+ atf_check truncate -s 100M autofs.img
+ atf_check mdconfig -f autofs.img -u 666
+ atf_check -o not-empty newfs /dev/md666
+
+ # clear autofs cache and verify existence of /media/md666
+ atf_check automount -c
+ atf_check -s exit:0 -o ignore ls /media/md666
+
+ # unmount /media/md666 and remove /dev/md666
+ atf_check automount -u
+ atf_check mdconfig -d -u 666
+
+ # clear autofs cache and remove /media/md666 directory
+ atf_check automount -c
+ atf_check rmdir /media/md666
+
+ # clear autofs cache and verify /media/md666 doesn't exist
+ atf_check automount -c
+ atf_check -s exit:1 -e not-empty ls /media/md666
+}
+
+autofs_rmdir_cleanup()
+{
+ automount -u
+ umount -At autofs
+ pkill automountd
+ mdconfig -d -u 666 2> /dev/null
+ rm -f autofs.img
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jul 19, 6:38 PM (12 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35244426
Default Alt Text
D57160.id178363.diff (3 KB)
Attached To
Mode
D57160: autofs/tests: test rmdir() for autofs filesystem
Attached
Detach File
Event Timeline
Log In to Comment