summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2016-12-07 06:57:08 +0000
committerngie <ngie@FreeBSD.org>2016-12-07 06:57:08 +0000
commit12f62f402e9ef9fd7e745e607c523dc2ff98970a (patch)
tree6c2d9f3ad13155b9ae75a79fdc053c45798e5777 /contrib
parentd2a105113f17e2b1ed40bc82f595725e238f295a (diff)
downloadFreeBSD-src-12f62f402e9ef9fd7e745e607c523dc2ff98970a.zip
FreeBSD-src-12f62f402e9ef9fd7e745e607c523dc2ff98970a.tar.gz
MFC r306030,r306031,r306033,r306036,r306038,r307190,r307196,r307204,r307205,r307701,r307702:
r306030: Port vnode_leak_test:main to FreeBSD Use a simpler way of dumping kern.maxvnodes, i.e. `sysctl -n kern.maxvnodes` The awk filtering method employed in NetBSD doesn't work on FreeBSD r306031: Port contrib/netbsd-tests/fs/h_funcs.subr to FreeBSD Use kldstat -m to determine whether or not a filesystem is loaded. This works well with tmpfs, ufs, and zfs r306033: Port sizes_test and statvfs_test to FreeBSD Similar to r306030, use a simpler method for getting the value of `hw.pagesize`, i.e. `sysctl -n hw.pagesize`. The awk filtering method doesn't work on FreeBSD r306036: Port to mknod_test and readdir_test to FreeBSD The `mknod <file> p` command doesn't exist on FreeBSD, like on NetBSD. Use mkfifo instead to create named pipes (FIFOs). r306038: Port vnd_test to FreeBSD Use mdmfs/mdconfig instead of vndconfig/newfs. vndconfig doesn't exist on FreeBSD. TODO: need to parameterize out the md(4) device as it's currently hardcoded to "3" (in both the FreeBSD and NetBSD cases). r307190: Skip :uchg on FreeBSD Unfortunately removing files with uchg set always succeeds with root on FreeBSD. Unfortunately running the test as an unprivileged user isn't doable because mounting tmpfs requires root PR: 212861 r307196: Port contrib/netbsd-tests/fs/tmpfs/h_tools.c to FreeBSD - Add inttypes.h #include for PRId64 macro - Use FreeBSD's copy of getfh(2), which doesn't include a `fh_size` parameter. Use sizeof(fhandle_t) instead as the size of fhp is always fixed as fhandle_t, unlike NetBSD's copy of fhp, which is void*. r307204: Expect :large to fail on FreeBSD FreeBSD doesn't appear to validate large -o size values like NetBSD does PR: 212862 r307205: Change atf_skip call to atf_expect_fail to make it clear that a failure is expected PR: 212861 Suggested by: jmmv r307701: Expect tests/sys/fs/tmpfs/link_test:kqueue to fail It fails with: "dir/b did not receive NOTE_LINK" Also, add needed cleanup logic to cleanup the mountpoint after the fact PR: 213662 r307702: Integrate contrib/netbsd-tests/fs/tmpfs into the FreeBSD test suite as tests/sys/fs These testcases exercise tmpfs support
Diffstat (limited to 'contrib')
-rw-r--r--contrib/netbsd-tests/fs/h_funcs.subr12
-rw-r--r--contrib/netbsd-tests/fs/tmpfs/h_tools.c13
-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.sh15
-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.sh25
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_vnode_leak.sh8
11 files changed, 143 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/fs/h_funcs.subr b/contrib/netbsd-tests/fs/h_funcs.subr
index 1216aaf..21bdd97 100644
--- a/contrib/netbsd-tests/fs/h_funcs.subr
+++ b/contrib/netbsd-tests/fs/h_funcs.subr
@@ -45,6 +45,15 @@ require_fs() {
# if we have autoloadable modules, just assume the file system
atf_require_prog sysctl
+ # Begin FreeBSD
+ if true; then
+ if kldstat -m ${name}; then
+ found=yes
+ else
+ found=no
+ fi
+ else
+ # End FreeBSD
autoload=$(sysctl -n kern.module.autoload)
[ "${autoload}" = "1" ] && return 0
@@ -57,6 +66,9 @@ require_fs() {
fi
shift
done
+ # Begin FreeBSD
+ fi
+ # End FreeBSD
[ ${found} = yes ] || \
atf_skip "The kernel does not include support the " \
"\`${name}' file system"
diff --git a/contrib/netbsd-tests/fs/tmpfs/h_tools.c b/contrib/netbsd-tests/fs/tmpfs/h_tools.c
index 6a7b8fd..64abe7b 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 {
diff --git a/contrib/netbsd-tests/fs/tmpfs/t_link.sh b/contrib/netbsd-tests/fs/tmpfs/t_link.sh
index 660f3f2..9e0ef7b 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..ec9d42f 100755
--- a/contrib/netbsd-tests/fs/tmpfs/t_mount.sh
+++ b/contrib/netbsd-tests/fs/tmpfs/t_mount.sh
@@ -93,7 +93,18 @@ negative_body() {
test_unmount
}
+# Begin FreeBSD
+if true; then
+atf_test_case large cleanup
+large_cleanup() {
+ umount -f tmp 2>/dev/null
+}
+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 +114,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..78a6e22 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 e5d0a78..5c2cf73 100755
--- a/contrib/netbsd-tests/fs/tmpfs/t_vnd.sh
+++ b/contrib/netbsd-tests/fs/tmpfs/t_vnd.sh
@@ -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
+ # 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
+ # 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
+ # Begin FreeBSD
+ if true; then
+ atf_check -s eq:0 -o empty -e empty 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