diff options
-rw-r--r-- | contrib/netbsd-tests/fs/h_funcs.subr | 12 | ||||
-rw-r--r-- | contrib/netbsd-tests/fs/tmpfs/h_tools.c | 13 | ||||
-rwxr-xr-x | contrib/netbsd-tests/fs/tmpfs/t_link.sh | 15 | ||||
-rwxr-xr-x | contrib/netbsd-tests/fs/tmpfs/t_mknod.sh | 16 | ||||
-rwxr-xr-x | contrib/netbsd-tests/fs/tmpfs/t_mount.sh | 15 | ||||
-rwxr-xr-x | contrib/netbsd-tests/fs/tmpfs/t_readdir.sh | 8 | ||||
-rwxr-xr-x | contrib/netbsd-tests/fs/tmpfs/t_remove.sh | 15 | ||||
-rwxr-xr-x | contrib/netbsd-tests/fs/tmpfs/t_sizes.sh | 8 | ||||
-rwxr-xr-x | contrib/netbsd-tests/fs/tmpfs/t_statvfs.sh | 8 | ||||
-rwxr-xr-x | contrib/netbsd-tests/fs/tmpfs/t_vnd.sh | 25 | ||||
-rwxr-xr-x | contrib/netbsd-tests/fs/tmpfs/t_vnode_leak.sh | 8 | ||||
-rw-r--r-- | etc/mtree/BSD.tests.dist | 4 | ||||
-rw-r--r-- | tests/sys/Makefile | 1 | ||||
-rw-r--r-- | tests/sys/fs/Makefile | 23 | ||||
-rw-r--r-- | tests/sys/fs/tmpfs/Makefile | 56 |
15 files changed, 227 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)) diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index 6cd0e85..1f22bf9 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -384,6 +384,10 @@ .. file .. + fs + tmpfs + .. + .. geom class concat diff --git a/tests/sys/Makefile b/tests/sys/Makefile index 682e21c..1bcd76e 100644 --- a/tests/sys/Makefile +++ b/tests/sys/Makefile @@ -6,6 +6,7 @@ TESTS_SUBDIRS+= acl TESTS_SUBDIRS+= aio TESTS_SUBDIRS+= fifo TESTS_SUBDIRS+= file +TESTS_SUBDIRS+= fs TESTS_SUBDIRS+= geom TESTS_SUBDIRS+= kern TESTS_SUBDIRS+= kqueue diff --git a/tests/sys/fs/Makefile b/tests/sys/fs/Makefile new file mode 100644 index 0000000..c82ee14 --- /dev/null +++ b/tests/sys/fs/Makefile @@ -0,0 +1,23 @@ +# $FreeBSD$ + +PACKAGE= tests + +TESTSDIR= ${TESTSBASE}/sys/fs + +TESTSRC= ${SRCTOP}/contrib/netbsd-tests/fs + +#TESTS_SUBDIRS+= nullfs # XXX: needs rump +TESTS_SUBDIRS+= tmpfs + +${PACKAGE}FILES+= h_funcs.subr +${PACKAGE}FILESDIR= ${TESTSDIR} + +CLEANFILES+= h_funcs.subr +CLEANFILES+= h_funcs.subr.tmp + +h_funcs.subr: ${TESTSRC}/h_funcs.subr + cat ${.ALLSRC} | \ + sed -e '/atf_require_prog mount_$${name}/d' >>${.TARGET}.tmp + mv ${.TARGET}.tmp ${.TARGET} + +.include <bsd.test.mk> diff --git a/tests/sys/fs/tmpfs/Makefile b/tests/sys/fs/tmpfs/Makefile new file mode 100644 index 0000000..63facd1 --- /dev/null +++ b/tests/sys/fs/tmpfs/Makefile @@ -0,0 +1,56 @@ +# $FreeBSD$ + +PACKAGE= tests + +FILESYSTEM?= ${.CURDIR:T} + +TESTSDIR= ${TESTSBASE}/sys/fs/${FILESYSTEM} + +TESTSRC= ${SRCTOP}/contrib/netbsd-tests/fs/${FILESYSTEM} + +# XXX: uses /dev/MAKEDEV to create pseudo /dev/{null,zero} character devices +#NETBSD_ATF_TESTS_SH+= devices_test +NETBSD_ATF_TESTS_SH+= create_test +NETBSD_ATF_TESTS_SH+= read_write_test +NETBSD_ATF_TESTS_SH+= dots_test +NETBSD_ATF_TESTS_SH+= exec_test +NETBSD_ATF_TESTS_SH+= link_test +NETBSD_ATF_TESTS_SH+= mkdir_test +NETBSD_ATF_TESTS_SH+= mknod_test +NETBSD_ATF_TESTS_SH+= mount_test +# XXX: need to replace `mknod ... p` with something more sensible +#NETBSD_ATF_TESTS_SH+= pipes_test +NETBSD_ATF_TESTS_SH+= trail_slash_test +NETBSD_ATF_TESTS_SH+= readdir_test +NETBSD_ATF_TESTS_SH+= remove_test +NETBSD_ATF_TESTS_SH+= rename_test +NETBSD_ATF_TESTS_SH+= rmdir_test +NETBSD_ATF_TESTS_SH+= setattr_test +NETBSD_ATF_TESTS_SH+= sizes_test +NETBSD_ATF_TESTS_SH+= sockets_test +NETBSD_ATF_TESTS_SH+= statvfs_test +NETBSD_ATF_TESTS_SH+= symlink_test +NETBSD_ATF_TESTS_SH+= times_test +NETBSD_ATF_TESTS_SH+= truncate_test +NETBSD_ATF_TESTS_SH+= vnd_test +NETBSD_ATF_TESTS_SH+= vnode_leak_test + +${PACKAGE}FILES+= h_funcs.subr +${PACKAGE}FILESDIR= ${TESTSDIR} + +PROGS+= h_tools +BINDIR.h_tools= ${TESTSDIR} + +ATF_TESTS_SH_SED_mount_test= \ + -e 's,-o -g,-o gid=,g' \ + -e 's,-o -m,-o mode=,g' \ + -e 's,-o -s,-o size=,g' \ + -e 's,-o -u,-o uid=,g' \ + -e 's,mount_${FILESYSTEM},mount -t ${FILESYSTEM},g' +ATF_TESTS_SH_SED_sizes_test= -e 's,-o -s,-o size=,g' +ATF_TESTS_SH_SED_statvfs_test= -e 's,-o -s,-o size=,g' +ATF_TESTS_SH_SED_vnode_leak_test= -e 's,-o -s,-o size=,g' + +.include <netbsd-tests.test.mk> + +.include <bsd.test.mk> |