summaryrefslogtreecommitdiffstats
path: root/contrib/netbsd-tests/fs/tmpfs
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/netbsd-tests/fs/tmpfs')
-rw-r--r--contrib/netbsd-tests/fs/tmpfs/h_funcs.subr19
-rw-r--r--contrib/netbsd-tests/fs/tmpfs/h_tools.c24
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_link.sh15
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_mknod.sh16
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_mount.sh16
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_readdir.sh8
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_remove.sh15
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_sizes.sh8
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_statvfs.sh8
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_vnd.sh33
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_vnode_leak.sh8
11 files changed, 165 insertions, 5 deletions
diff --git a/contrib/netbsd-tests/fs/tmpfs/h_funcs.subr b/contrib/netbsd-tests/fs/tmpfs/h_funcs.subr
index 07c1644..edab789 100644
--- a/contrib/netbsd-tests/fs/tmpfs/h_funcs.subr
+++ b/contrib/netbsd-tests/fs/tmpfs/h_funcs.subr
@@ -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]
#
diff --git a/contrib/netbsd-tests/fs/tmpfs/h_tools.c b/contrib/netbsd-tests/fs/tmpfs/h_tools.c
index 6a7b8fd..492e084 100644
--- a/contrib/netbsd-tests/fs/tmpfs/h_tools.c
+++ b/contrib/netbsd-tests/fs/tmpfs/h_tools.c
@@ -50,6 +50,10 @@
#include <string.h>
#include <unistd.h>
+#ifdef __FreeBSD__
+#include <inttypes.h>
+#endif
+
/* --------------------------------------------------------------------- */
static int getfh_main(int, char **);
@@ -70,7 +74,12 @@ getfh_main(int argc, char **argv)
if (argc < 2)
return EXIT_FAILURE;
+#ifdef __FreeBSD__
+ fh_size = sizeof(fhandle_t);
+#else
fh_size = 0;
+#endif
+
fh = NULL;
for (;;) {
if (fh_size) {
@@ -85,7 +94,11 @@ getfh_main(int argc, char **argv)
* but it may change if someone moves things around,
* so retry untill we have enough memory.
*/
+#ifdef __FreeBSD__
+ error = getfh(argv[1], fh);
+#else
error = getfh(argv[1], fh, &fh_size);
+#endif
if (error == 0) {
break;
} else {
@@ -230,12 +243,21 @@ sockets_main(int argc, char **argv)
return EXIT_FAILURE;
}
+#ifdef __FreeBSD__
+ memset(&addr, 0, sizeof(addr));
+#endif
(void)strlcpy(addr.sun_path, argv[1], sizeof(addr.sun_path));
addr.sun_family = PF_UNIX;
-
+#ifdef __FreeBSD__
+ error = bind(fd, (struct sockaddr *)&addr, SUN_LEN(&addr));
+#else
error = bind(fd, (struct sockaddr *)&addr, sizeof(addr));
+#endif
if (error == -1) {
warn("connect");
+#ifdef __FreeBSD__
+ (void)close(fd);
+#endif
return EXIT_FAILURE;
}
diff --git a/contrib/netbsd-tests/fs/tmpfs/t_link.sh b/contrib/netbsd-tests/fs/tmpfs/t_link.sh
index 660f3f2..612c1e2 100755
--- a/contrib/netbsd-tests/fs/tmpfs/t_link.sh
+++ b/contrib/netbsd-tests/fs/tmpfs/t_link.sh
@@ -93,7 +93,18 @@ subdirs_body() {
test_unmount
}
+# Begin FreeBSD
+if true; then
+atf_test_case kqueue cleanup
+kqueue_cleanup() {
+ Mount_Point=$(pwd)/mntpt _test_unmount || :
+}
+else
+# End FreeBSD
atf_test_case kqueue
+# Begin FreeBSD
+fi
+# End FreeBSD
kqueue_head() {
atf_set "descr" "Verifies that creating a link raises the correct" \
"kqueue events"
@@ -102,6 +113,10 @@ kqueue_head() {
kqueue_body() {
test_mount
+ # Begin FreeBSD
+ atf_expect_fail "fails with: dir/b did not receive NOTE_LINK - bug 213662"
+ # End FreeBSD
+
atf_check -s eq:0 -o empty -e empty mkdir dir
atf_check -s eq:0 -o empty -e empty touch dir/a
echo 'ln dir/a dir/b' | kqueue_monitor 2 dir dir/a
diff --git a/contrib/netbsd-tests/fs/tmpfs/t_mknod.sh b/contrib/netbsd-tests/fs/tmpfs/t_mknod.sh
index 62c7cce..037dc16 100755
--- a/contrib/netbsd-tests/fs/tmpfs/t_mknod.sh
+++ b/contrib/netbsd-tests/fs/tmpfs/t_mknod.sh
@@ -106,7 +106,15 @@ pipe_body() {
test_mount
umask 022
+ # Begin FreeBSD
+ if true; then
+ atf_check -s eq:0 -o empty -e empty mkfifo pipe
+ else
+ # End FreeBSD
atf_check -s eq:0 -o empty -e empty mknod pipe p
+ # Begin FreeBSD
+ fi
+ # End FreeBSD
eval $(stat -s pipe)
[ ${st_mode} = 010644 ] || atf_fail "Invalid mode"
@@ -124,7 +132,15 @@ pipe_kqueue_body() {
umask 022
atf_check -s eq:0 -o empty -e empty mkdir dir
+ # Begin FreeBSD
+ if true; then
+ echo 'mkfifo dir/pipe' | kqueue_monitor 1 dir
+ else
+ # End FreeBSD
echo 'mknod dir/pipe p' | kqueue_monitor 1 dir
+ # Begin FreeBSD
+ fi
+ # End FreeBSD
kqueue_check dir NOTE_WRITE
test_unmount
diff --git a/contrib/netbsd-tests/fs/tmpfs/t_mount.sh b/contrib/netbsd-tests/fs/tmpfs/t_mount.sh
index 11a77d4..9ec5e31 100755
--- a/contrib/netbsd-tests/fs/tmpfs/t_mount.sh
+++ b/contrib/netbsd-tests/fs/tmpfs/t_mount.sh
@@ -93,7 +93,19 @@ negative_body() {
test_unmount
}
+# Begin FreeBSD
+if true; then
+atf_test_case large cleanup
+large_cleanup() {
+ umount -f tmp 2>/dev/null || :
+ Mount_Point=$(pwd)/mnt _test_unmount || :
+}
+else
+# End FreeBSD
atf_test_case large
+# Begin FreeBSD
+fi
+# End FreeBSD
large_head() {
atf_set "descr" "Tests that extremely long values passed to -s" \
"are handled correctly"
@@ -103,6 +115,10 @@ large_body() {
test_mount -o -s9223372036854775807
test_unmount
+ # Begin FreeBSD
+ atf_expect_fail "-o -s<large-size> succeeds unexpectedly on FreeBSD - bug 212862"
+ # End FreeBSD
+
mkdir tmp
atf_check -s eq:1 -o empty -e ignore \
mount -t tmpfs -o -s9223372036854775808 tmpfs tmp
diff --git a/contrib/netbsd-tests/fs/tmpfs/t_readdir.sh b/contrib/netbsd-tests/fs/tmpfs/t_readdir.sh
index 6f5dc3e..272c749 100755
--- a/contrib/netbsd-tests/fs/tmpfs/t_readdir.sh
+++ b/contrib/netbsd-tests/fs/tmpfs/t_readdir.sh
@@ -59,7 +59,15 @@ types_body() {
atf_check -s eq:0 -o empty -e empty ln -s reg lnk
atf_check -s eq:0 -o empty -e empty mknod blk b 0 0
atf_check -s eq:0 -o empty -e empty mknod chr c 0 0
+ # Begin FreeBSD
+ if true; then
+ atf_check -s eq:0 -o empty -e empty mkfifo fifo
+ else
+ # End FreeBSD
atf_check -s eq:0 -o empty -e empty mknod fifo p
+ # Begin FreeBSD
+ fi
+ # End FreeBSD
atf_check -s eq:0 -o empty -e empty \
$(atf_get_srcdir)/h_tools sockets sock
diff --git a/contrib/netbsd-tests/fs/tmpfs/t_remove.sh b/contrib/netbsd-tests/fs/tmpfs/t_remove.sh
index df868f9..f75032c 100755
--- a/contrib/netbsd-tests/fs/tmpfs/t_remove.sh
+++ b/contrib/netbsd-tests/fs/tmpfs/t_remove.sh
@@ -46,13 +46,28 @@ single_body() {
test_unmount
}
+# Begin FreeBSD
+if true; then
+atf_test_case uchg cleanup
+uchg_cleanup() {
+ Mount_Point=$(pwd)/mntpt _test_unmount
+}
+else
+# End FreeBSD
atf_test_case uchg
+# Begin FreeBSD
+fi
+# End FreeBSD
uchg_head() {
atf_set "descr" "Checks that files with the uchg flag set cannot" \
"be removed"
atf_set "require.user" "root"
}
uchg_body() {
+ # Begin FreeBSD
+ atf_expect_fail "this fails on FreeBSD with root - bug 212861"
+ # End FreeBSD
+
test_mount
atf_check -s eq:0 -o empty -e empty touch a
diff --git a/contrib/netbsd-tests/fs/tmpfs/t_sizes.sh b/contrib/netbsd-tests/fs/tmpfs/t_sizes.sh
index 9673b91..35abe8a 100755
--- a/contrib/netbsd-tests/fs/tmpfs/t_sizes.sh
+++ b/contrib/netbsd-tests/fs/tmpfs/t_sizes.sh
@@ -54,7 +54,15 @@ big_head() {
big_body() {
test_mount -o -s10M
+ # Begin FreeBSD
+ if true; then
+ pagesize=$(sysctl -n hw.pagesize)
+ else
+ # End FreeBSD
pagesize=$(sysctl hw.pagesize | cut -d ' ' -f 3)
+ # Begin FreeBSD
+ fi
+ # End FreeBSD
eval $($(atf_get_srcdir)/h_tools statvfs . | sed -e 's|^f_|cf_|')
cf_bused=$((${cf_blocks} - ${cf_bfree}))
diff --git a/contrib/netbsd-tests/fs/tmpfs/t_statvfs.sh b/contrib/netbsd-tests/fs/tmpfs/t_statvfs.sh
index 21290b6..d0e7ac2 100755
--- a/contrib/netbsd-tests/fs/tmpfs/t_statvfs.sh
+++ b/contrib/netbsd-tests/fs/tmpfs/t_statvfs.sh
@@ -38,7 +38,15 @@ values_head() {
values_body() {
test_mount -o -s10M
+ # Begin FreeBSD
+ if true; then
+ pagesize=$(sysctl -n hw.pagesize)
+ else
+ # End FreeBSD
pagesize=$(sysctl hw.pagesize | cut -d ' ' -f 3)
+ # Begin FreeBSD
+ fi
+ # End FreeBSD
eval $($(atf_get_srcdir)/h_tools statvfs .)
[ ${pagesize} -eq ${f_bsize} ] || \
atf_fail "Invalid bsize"
diff --git a/contrib/netbsd-tests/fs/tmpfs/t_vnd.sh b/contrib/netbsd-tests/fs/tmpfs/t_vnd.sh
index 2c97fa9..1f42f62 100755
--- a/contrib/netbsd-tests/fs/tmpfs/t_vnd.sh
+++ b/contrib/netbsd-tests/fs/tmpfs/t_vnd.sh
@@ -1,4 +1,4 @@
-# $NetBSD: t_vnd.sh,v 1.8 2011/04/21 22:26:46 haad Exp $
+# $NetBSD: t_vnd.sh,v 1.9 2016/07/29 05:23:24 pgoyette Exp $
#
# Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -38,12 +38,21 @@ basic_body() {
atf_check -s eq:0 -o ignore -e ignore \
dd if=/dev/zero of=disk.img bs=1m count=10
- atf_check -s eq:0 -o empty -e empty vnconfig /dev/vnd3 disk.img
+ # Begin FreeBSD
+ if true; then
+ atf_check -s eq:0 -o empty -e empty mkdir mnt
+ atf_check -s eq:0 -o empty -e empty mdmfs -F disk.img md3 mnt
+ else
+ # End FreeBSD
+ atf_check -s eq:0 -o empty -e empty vndconfig /dev/vnd3 disk.img
atf_check -s eq:0 -o ignore -e ignore newfs /dev/rvnd3a
atf_check -s eq:0 -o empty -e empty mkdir mnt
atf_check -s eq:0 -o empty -e empty mount /dev/vnd3a mnt
+ # Begin FreeBSD
+ fi
+ # End FreeBSD
echo "Creating test files"
for f in $(jot -w %u 100 | uniq); do
@@ -58,7 +67,15 @@ basic_body() {
done
atf_check -s eq:0 -o empty -e empty umount mnt
- atf_check -s eq:0 -o empty -e empty vnconfig -u /dev/vnd3
+ # Begin FreeBSD
+ if true; then
+ atf_check -s eq:0 -o empty -e empty mdconfig -d -u 3
+ else
+ # End FreeBSD
+ atf_check -s eq:0 -o empty -e empty vndconfig -u /dev/vnd3
+ # Begin FreeBSD
+ fi
+ # End FreeBSD
test_unmount
touch done
@@ -66,7 +83,15 @@ basic_body() {
basic_cleanup() {
if [ ! -f done ]; then
umount mnt 2>/dev/null 1>&2
- vnconfig -u /dev/vnd3 2>/dev/null 1>&2
+ # Begin FreeBSD
+ if true; then
+ [ ! -c /dev/md3 ] || mdconfig -d -u 3
+ else
+ # End FreeBSD
+ vndconfig -u /dev/vnd3 2>/dev/null 1>&2
+ # Begin FreeBSD
+ fi
+ # End FreeBSD
fi
}
diff --git a/contrib/netbsd-tests/fs/tmpfs/t_vnode_leak.sh b/contrib/netbsd-tests/fs/tmpfs/t_vnode_leak.sh
index c505ffd..4630a7c 100755
--- a/contrib/netbsd-tests/fs/tmpfs/t_vnode_leak.sh
+++ b/contrib/netbsd-tests/fs/tmpfs/t_vnode_leak.sh
@@ -36,7 +36,15 @@ main_head() {
}
main_body() {
echo "Lowering kern.maxvnodes to 2000"
+ # Begin FreeBSD
+ if true; then
+ sysctl -n kern.maxvnodes > oldvnodes
+ else
+ # End FreeBSD
sysctl kern.maxvnodes | awk '{ print $3; }' >oldvnodes
+ # Begin FreeBSD
+ fi
+ # End FreeBSD
atf_check -s eq:0 -o ignore -e empty sysctl -w kern.maxvnodes=2000
test_mount -o -s$(((4000 + 2) * 4096))
OpenPOWER on IntegriCloud