Index: stable/11/contrib/netbsd-tests/fs/h_funcs.subr =================================================================== --- stable/11/contrib/netbsd-tests/fs/h_funcs.subr (revision 309667) +++ stable/11/contrib/netbsd-tests/fs/h_funcs.subr (revision 309668) @@ -1,63 +1,75 @@ #!/bin/sh # # $NetBSD: h_funcs.subr,v 1.3 2010/06/23 11:19:17 pooka Exp $ # # Copyright (c) 2007 The NetBSD Foundation, Inc. # All rights reserved. # # 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. # # # require_fs name # # Checks that the given file system is built into the kernel and # that its corresponding mount(8) utility is available. Otherwise # skips the test. # require_fs() { local name local autoload name="${1}" atf_require_prog mount atf_require_prog mount_${name} atf_require_prog umount # 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 set -- $(sysctl -n vfs.generic.fstypes) found=no while [ ${#} -gt 1 ]; do if [ ${1} = ${name} ]; then found=yes break fi shift done + # Begin FreeBSD + fi + # End FreeBSD [ ${found} = yes ] || \ atf_skip "The kernel does not include support the " \ "\`${name}' file system" } Index: stable/11/contrib/netbsd-tests/fs/tmpfs/h_tools.c =================================================================== --- stable/11/contrib/netbsd-tests/fs/tmpfs/h_tools.c (revision 309667) +++ stable/11/contrib/netbsd-tests/fs/tmpfs/h_tools.c (revision 309668) @@ -1,299 +1,312 @@ /* $NetBSD: h_tools.c,v 1.4 2011/06/11 18:03:17 christos Exp $ */ /* * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc. * All rights reserved. * * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. */ /* * Helper tools for several tests. These are kept in a single file due * to the limitations of bsd.prog.mk to build a single program in a * given directory. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include +#ifdef __FreeBSD__ +#include +#endif + /* --------------------------------------------------------------------- */ static int getfh_main(int, char **); static int kqueue_main(int, char **); static int rename_main(int, char **); static int sockets_main(int, char **); static int statvfs_main(int, char **); /* --------------------------------------------------------------------- */ int getfh_main(int argc, char **argv) { int error; void *fh; size_t fh_size; if (argc < 2) return EXIT_FAILURE; +#ifdef __FreeBSD__ + fh_size = sizeof(fhandle_t); +#else fh_size = 0; +#endif + fh = NULL; for (;;) { if (fh_size) { fh = malloc(fh_size); if (fh == NULL) { fprintf(stderr, "out of memory"); return EXIT_FAILURE; } } /* * The kernel provides the necessary size in fh_size - * 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 { if (fh != NULL) free(fh); if (errno != E2BIG) { warn("getfh"); return EXIT_FAILURE; } } } error = write(STDOUT_FILENO, fh, fh_size); if (error == -1) { warn("write"); return EXIT_FAILURE; } free(fh); return 0; } /* --------------------------------------------------------------------- */ int kqueue_main(int argc, char **argv) { char *line; int i, kq; size_t len; struct kevent *changes, event; if (argc < 2) return EXIT_FAILURE; argc--; argv++; changes = malloc(sizeof(struct kevent) * argc); if (changes == NULL) errx(EXIT_FAILURE, "not enough memory"); for (i = 0; i < argc; i++) { int fd; fd = open(argv[i], O_RDONLY); if (fd == -1) err(EXIT_FAILURE, "cannot open %s", argv[i]); EV_SET(&changes[i], fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_ONESHOT, NOTE_ATTRIB | NOTE_DELETE | NOTE_EXTEND | NOTE_LINK | NOTE_RENAME | NOTE_REVOKE | NOTE_WRITE, 0, 0); } kq = kqueue(); if (kq == -1) err(EXIT_FAILURE, "kqueue"); while ((line = fgetln(stdin, &len)) != NULL) { int ec, nev; struct timespec to; to.tv_sec = 0; to.tv_nsec = 100000; (void)kevent(kq, changes, argc, &event, 1, &to); assert(len > 0); assert(line[len - 1] == '\n'); line[len - 1] = '\0'; ec = system(line); if (ec != EXIT_SUCCESS) errx(ec, "%s returned %d", line, ec); do { nev = kevent(kq, changes, argc, &event, 1, &to); if (nev == -1) err(EXIT_FAILURE, "kevent"); else if (nev > 0) { for (i = 0; i < argc; i++) if (event.ident == changes[i].ident) break; if (event.fflags & NOTE_ATTRIB) printf("%s - NOTE_ATTRIB\n", argv[i]); if (event.fflags & NOTE_DELETE) printf("%s - NOTE_DELETE\n", argv[i]); if (event.fflags & NOTE_EXTEND) printf("%s - NOTE_EXTEND\n", argv[i]); if (event.fflags & NOTE_LINK) printf("%s - NOTE_LINK\n", argv[i]); if (event.fflags & NOTE_RENAME) printf("%s - NOTE_RENAME\n", argv[i]); if (event.fflags & NOTE_REVOKE) printf("%s - NOTE_REVOKE\n", argv[i]); if (event.fflags & NOTE_WRITE) printf("%s - NOTE_WRITE\n", argv[i]); } } while (nev > 0); } for (i = 0; i < argc; i++) close(changes[i].ident); free(changes); return EXIT_SUCCESS; } /* --------------------------------------------------------------------- */ int rename_main(int argc, char **argv) { if (argc < 3) return EXIT_FAILURE; if (rename(argv[1], argv[2]) == -1) { warn("rename"); return EXIT_FAILURE; } return EXIT_SUCCESS; } /* --------------------------------------------------------------------- */ int sockets_main(int argc, char **argv) { int error, fd; struct sockaddr_un addr; if (argc < 2) return EXIT_FAILURE; fd = socket(PF_LOCAL, SOCK_STREAM, 0); if (fd == -1) { warn("socket"); return EXIT_FAILURE; } (void)strlcpy(addr.sun_path, argv[1], sizeof(addr.sun_path)); addr.sun_family = PF_UNIX; error = bind(fd, (struct sockaddr *)&addr, sizeof(addr)); if (error == -1) { warn("connect"); return EXIT_FAILURE; } close(fd); return EXIT_SUCCESS; } /* --------------------------------------------------------------------- */ int statvfs_main(int argc, char **argv) { int error; struct statvfs buf; if (argc < 2) return EXIT_FAILURE; error = statvfs(argv[1], &buf); if (error != 0) { warn("statvfs"); return EXIT_FAILURE; } (void)printf("f_bsize=%lu\n", buf.f_bsize); (void)printf("f_blocks=%" PRId64 "\n", buf.f_blocks); (void)printf("f_bfree=%" PRId64 "\n", buf.f_bfree); (void)printf("f_files=%" PRId64 "\n", buf.f_files); return EXIT_SUCCESS; } /* --------------------------------------------------------------------- */ int main(int argc, char **argv) { int error; if (argc < 2) return EXIT_FAILURE; argc -= 1; argv += 1; if (strcmp(argv[0], "getfh") == 0) error = getfh_main(argc, argv); else if (strcmp(argv[0], "kqueue") == 0) error = kqueue_main(argc, argv); else if (strcmp(argv[0], "rename") == 0) error = rename_main(argc, argv); else if (strcmp(argv[0], "sockets") == 0) error = sockets_main(argc, argv); else if (strcmp(argv[0], "statvfs") == 0) error = statvfs_main(argc, argv); else error = EXIT_FAILURE; return error; } Index: stable/11/contrib/netbsd-tests/fs/tmpfs/t_link.sh =================================================================== --- stable/11/contrib/netbsd-tests/fs/tmpfs/t_link.sh (revision 309667) +++ stable/11/contrib/netbsd-tests/fs/tmpfs/t_link.sh (revision 309668) @@ -1,129 +1,144 @@ # $NetBSD: t_link.sh,v 1.5 2010/11/07 17:51:18 jmmv Exp $ # # Copyright (c) 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc. # All rights reserved. # # 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. # # # Verifies that the link operation works. # atf_test_case basic basic_head() { atf_set "descr" "Verifies that the link operation works on files" \ "at the top directory" atf_set "require.user" "root" } basic_body() { test_mount atf_check -s eq:0 -o empty -e empty touch a atf_check -s eq:0 -o empty -e empty touch z eval $(stat -s a | sed -e 's|st_|sta_|g') eval $(stat -s z | sed -e 's|st_|stz_|g') test ${sta_ino} != ${stz_ino} || \ atf_fail "Node numbers are not different" test ${sta_nlink} -eq 1 || atf_fail "Number of links is incorrect" atf_check -s eq:0 -o empty -e empty ln a b echo "Checking if link count is correct after links are created" eval $(stat -s a | sed -e 's|st_|sta_|g') eval $(stat -s b | sed -e 's|st_|stb_|g') test ${sta_ino} = ${stb_ino} || atf_fail "Node number changed" test ${sta_nlink} -eq 2 || atf_fail "Link count is incorrect" test ${stb_nlink} -eq 2 || atf_fail "Link count is incorrect" echo "Checking if link count is correct after links are deleted" atf_check -s eq:0 -o empty -e empty rm a eval $(stat -s b | sed -e 's|st_|stb_|g') test ${stb_nlink} -eq 1 || atf_fail "Link count is incorrect" atf_check -s eq:0 -o empty -e empty rm b test_unmount } atf_test_case subdirs subdirs_head() { atf_set "descr" "Verifies that the link operation works if used" \ "in subdirectories" atf_set "require.user" "root" } subdirs_body() { test_mount atf_check -s eq:0 -o empty -e empty touch a atf_check -s eq:0 -o empty -e empty mkdir c atf_check -s eq:0 -o empty -e empty ln a c/b echo "Checking if link count is correct after links are created" eval $(stat -s a | sed -e 's|st_|sta_|g') eval $(stat -s c/b | sed -e 's|st_|stb_|g') test ${sta_ino} = ${stb_ino} || atf_fail "Node number changed" test ${sta_nlink} -eq 2 || atf_fail "Link count is incorrect" test ${stb_nlink} -eq 2 || atf_fail "Link count is incorrect" echo "Checking if link count is correct after links are deleted" atf_check -s eq:0 -o empty -e empty rm a eval $(stat -s c/b | sed -e 's|st_|stb_|g') test ${stb_nlink} -eq 1 || atf_fail "Link count is incorrect" atf_check -s eq:0 -o empty -e empty rm c/b atf_check -s eq:0 -o empty -e empty rmdir c 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" atf_set "require.user" "root" } 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 kqueue_check dir/a NOTE_LINK kqueue_check dir NOTE_WRITE echo 'rm dir/a' | kqueue_monitor 2 dir dir/b # XXX According to the (short) kqueue(2) documentation, the following # should raise a NOTE_LINK but FFS raises a NOTE_DELETE... kqueue_check dir/b NOTE_LINK kqueue_check dir NOTE_WRITE atf_check -s eq:0 -o empty -e empty rm dir/b atf_check -s eq:0 -o empty -e empty rmdir dir test_unmount } atf_init_test_cases() { . $(atf_get_srcdir)/../h_funcs.subr . $(atf_get_srcdir)/h_funcs.subr atf_add_test_case basic atf_add_test_case subdirs atf_add_test_case kqueue } Index: stable/11/contrib/netbsd-tests/fs/tmpfs/t_mknod.sh =================================================================== --- stable/11/contrib/netbsd-tests/fs/tmpfs/t_mknod.sh (revision 309667) +++ stable/11/contrib/netbsd-tests/fs/tmpfs/t_mknod.sh (revision 309668) @@ -1,143 +1,159 @@ # $NetBSD: t_mknod.sh,v 1.5 2010/11/07 17:51:18 jmmv Exp $ # # Copyright (c) 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc. # All rights reserved. # # 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. # # # Verifies that the mknod operation works. # atf_test_case block block_head() { atf_set "descr" "Tests that block devices can be created" atf_set "require.user" "root" } block_body() { test_mount umask 022 atf_check -s eq:0 -o empty -e empty mknod fd0a b 2 0 eval $(stat -s fd0a) [ ${st_mode} = 060644 ] || atf_fail "Invalid mode" [ ${st_rdev} -eq 512 ] || atf_fail "Invalid device" test_unmount } atf_test_case block_kqueue block_kqueue_head() { atf_set "descr" "Tests that creating a block device raises the" \ "appropriate kqueue events" atf_set "require.user" "root" } block_kqueue_body() { test_mount umask 022 atf_check -s eq:0 -o empty -e empty mkdir dir echo 'mknod dir/fd0a b 2 0' | kqueue_monitor 1 dir kqueue_check dir NOTE_WRITE test_unmount } atf_test_case char char_head() { atf_set "descr" "Tests that character devices can be created" atf_set "require.user" "root" } char_body() { test_mount umask 022 atf_check -s eq:0 -o empty -e empty mknod null c 2 2 eval $(stat -s null) [ ${st_mode} = 020644 ] || atf_fail "Invalid mode" [ ${st_rdev} -eq 514 ] || atf_fail "Invalid device" test_unmount } atf_test_case char_kqueue char_kqueue_head() { atf_set "descr" "Tests that creating a character device raises the" \ "appropriate kqueue events" atf_set "require.user" "root" } char_kqueue_body() { test_mount umask 022 atf_check -s eq:0 -o empty -e empty mkdir dir echo 'mknod dir/null c 2 2' | kqueue_monitor 1 dir kqueue_check dir NOTE_WRITE test_unmount } atf_test_case pipe pipe_head() { atf_set "descr" "Tests that named pipes can be created" atf_set "require.user" "root" } 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" test_unmount } atf_test_case pipe_kqueue pipe_kqueue_head() { atf_set "descr" "Tests that creating a named pipe raises the" \ "appropriate kqueue events" atf_set "require.user" "root" } pipe_kqueue_body() { test_mount 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 } atf_init_test_cases() { . $(atf_get_srcdir)/../h_funcs.subr . $(atf_get_srcdir)/h_funcs.subr atf_add_test_case block atf_add_test_case block_kqueue atf_add_test_case char atf_add_test_case char_kqueue atf_add_test_case pipe atf_add_test_case pipe_kqueue } Index: stable/11/contrib/netbsd-tests/fs/tmpfs/t_mount.sh =================================================================== --- stable/11/contrib/netbsd-tests/fs/tmpfs/t_mount.sh (revision 309667) +++ stable/11/contrib/netbsd-tests/fs/tmpfs/t_mount.sh (revision 309668) @@ -1,140 +1,155 @@ # $NetBSD: t_mount.sh,v 1.6 2010/11/07 17:51:18 jmmv Exp $ # # Copyright (c) 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc. # All rights reserved. # # 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. # # # Verifies that an execution of mount and umount works correctly without # causing errors and that the root node gets correct attributes. # Also verifies command line parsing from mount_tmpfs. # atf_test_case plain plain_head() { atf_set "descr" "Tests a mount and unmount without any options" atf_set "require.user" "root" } plain_body() { test_mount test_unmount } atf_test_case links links_head() { atf_set "descr" "Tests that the mount point has two hard links" atf_set "require.user" "root" } links_body() { test_mount eval $(stat -s ${Mount_Point}) [ ${st_nlink} = 2 ] || \ atf_fail "Root directory does not have two hard links" test_unmount } atf_test_case options options_head() { atf_set "descr" "Tests the read-only mount option" atf_set "require.user" "root" } options_body() { test_mount -o ro mount | grep ${Mount_Point} | grep -q read-only || \ atf_fail "read-only option (ro) does not work" test_unmount } atf_test_case attrs attrs_head() { atf_set "descr" "Tests that root directory attributes are set" \ "correctly" atf_set "require.user" "root" } attrs_body() { test_mount -o -u1000 -o -g100 -o -m755 eval $(stat -s ${Mount_Point}) [ ${st_uid} = 1000 ] || atf_fail "uid is incorrect" [ ${st_gid} = 100 ] || atf_fail "gid is incorrect" [ ${st_mode} = 040755 ] || atf_fail "mode is incorrect" test_unmount } atf_test_case negative negative_head() { atf_set "descr" "Tests that negative values passed to to -s are" \ "handled correctly" atf_set "require.user" "root" } negative_body() { mkdir tmp test_mount -o -s-10 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" atf_set "require.user" "root" } large_body() { test_mount -o -s9223372036854775807 test_unmount + + # Begin FreeBSD + atf_expect_fail "-o -s 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 atf_check -s eq:1 -o empty -e ignore \ mount -t tmpfs -o -s9223372036854775808g tmpfs tmp rmdir tmp } atf_test_case mntpt mntpt_head() { atf_set "descr" "Tests that the error messages printed when the" \ "mount point is invalid do not show the source" \ "unused parameter" } mntpt_body() { mount_tmpfs unused $(pwd)/mnt >out 2>&1 atf_check -s eq:1 -o empty -e empty grep unused out atf_check -s eq:0 -o ignore -e empty grep "$(pwd)/mnt" out mount_tmpfs unused mnt >out 2>&1 atf_check -s eq:1 -o empty -e empty grep unused out atf_check -s eq:0 -o ignore -e empty grep mnt out } atf_init_test_cases() { . $(atf_get_srcdir)/../h_funcs.subr . $(atf_get_srcdir)/h_funcs.subr atf_add_test_case plain atf_add_test_case options atf_add_test_case attrs atf_add_test_case negative atf_add_test_case large atf_add_test_case mntpt } Index: stable/11/contrib/netbsd-tests/fs/tmpfs/t_readdir.sh =================================================================== --- stable/11/contrib/netbsd-tests/fs/tmpfs/t_readdir.sh (revision 309667) +++ stable/11/contrib/netbsd-tests/fs/tmpfs/t_readdir.sh (revision 309668) @@ -1,116 +1,124 @@ # $NetBSD: t_readdir.sh,v 1.5 2010/11/07 17:51:18 jmmv Exp $ # # Copyright (c) 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc. # All rights reserved. # # 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. # # # Verifies that the readdir operation works. # atf_test_case dots dots_head() { atf_set "descr" "Verifies that readdir returns the '.' and '..'" \ "entries" atf_set "require.user" "root" } dots_body() { test_mount atf_check -s eq:0 -o save:stdout -e empty /bin/ls -a atf_check -s eq:0 -o ignore -e empty grep '^\.$' stdout atf_check -s eq:0 -o ignore -e empty grep '^\..$' stdout test_unmount } atf_test_case types types_head() { atf_set "descr" "Verifies that readdir works for all different" \ "file types" atf_set "require.user" "root" } types_body() { test_mount atf_check -s eq:0 -o empty -e empty mkdir dir atf_check -s eq:0 -o empty -e empty touch reg 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 atf_check -s eq:0 -o ignore -e empty ls atf_check -s eq:0 -o empty -e empty rm -rf * test_unmount } atf_test_case caching caching_head() { atf_set "descr" "Catch a bug caused by incorrect invalidation of" \ "readdir caching variables" atf_set "require.user" "root" } caching_body() { test_mount atf_check -s eq:0 -o empty -e empty touch $(jot 10) atf_check -s eq:0 -o empty -e empty rm * atf_check -s eq:0 -o empty -e empty touch $(jot 20) atf_check -s eq:0 -o empty -e empty -x "ls >/dev/null" test_unmount } atf_test_case many many_head() { atf_set "descr" "Verifies that readdir works with many files" atf_set "require.user" "root" } many_body() { test_mount atf_check -s eq:0 -o empty -e empty mkdir a echo "Creating 500 files" for f in $(jot 500); do touch a/$f done atf_check -s eq:0 -o empty -e empty rm a/* atf_check -s eq:0 -o empty -e empty rmdir a test_unmount } atf_init_test_cases() { . $(atf_get_srcdir)/../h_funcs.subr . $(atf_get_srcdir)/h_funcs.subr atf_add_test_case dots atf_add_test_case types atf_add_test_case caching atf_add_test_case many } Index: stable/11/contrib/netbsd-tests/fs/tmpfs/t_remove.sh =================================================================== --- stable/11/contrib/netbsd-tests/fs/tmpfs/t_remove.sh (revision 309667) +++ stable/11/contrib/netbsd-tests/fs/tmpfs/t_remove.sh (revision 309668) @@ -1,110 +1,125 @@ # $NetBSD: t_remove.sh,v 1.5 2010/11/07 17:51:18 jmmv Exp $ # # Copyright (c) 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc. # All rights reserved. # # 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. # # # Verifies that the remove operation works. # atf_test_case single single_head() { atf_set "descr" "Checks that file removal works" atf_set "require.user" "root" } single_body() { test_mount atf_check -s eq:1 -o empty -e empty test -f a atf_check -s eq:0 -o empty -e empty touch a atf_check -s eq:0 -o empty -e empty test -f a atf_check -s eq:0 -o empty -e empty rm a atf_check -s eq:1 -o empty -e empty test -f a 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 atf_check -s eq:0 -o empty -e empty chflags uchg a atf_check -s eq:1 -o empty -e ignore rm -f a atf_check -s eq:0 -o empty -e empty chflags nouchg a atf_check -s eq:0 -o empty -e empty rm a atf_check -s eq:1 -o empty -e empty test -f a test_unmount } atf_test_case dot dot_head() { atf_set "descr" "Checks that '.' cannot be removed" atf_set "require.user" "root" } dot_body() { test_mount atf_check -s eq:0 -o empty -e empty mkdir a atf_check -s eq:1 -o empty -e ignore unlink a/. atf_check -s eq:0 -o empty -e empty rmdir a test_unmount } atf_test_case kqueue kqueue_head() { atf_set "descr" "Removes a file and checks the kqueue events" \ "raised" atf_set "require.user" "root" } kqueue_body() { test_mount atf_check -s eq:0 -o empty -e empty mkdir dir atf_check -s eq:0 -o empty -e empty touch dir/a echo 'rm dir/a' | kqueue_monitor 2 dir dir/a kqueue_check dir/a NOTE_DELETE kqueue_check dir NOTE_WRITE atf_check -s eq:0 -o empty -e empty rmdir dir test_unmount } atf_init_test_cases() { . $(atf_get_srcdir)/../h_funcs.subr . $(atf_get_srcdir)/h_funcs.subr atf_add_test_case single atf_add_test_case uchg atf_add_test_case dot atf_add_test_case kqueue } Index: stable/11/contrib/netbsd-tests/fs/tmpfs/t_sizes.sh =================================================================== --- stable/11/contrib/netbsd-tests/fs/tmpfs/t_sizes.sh (revision 309667) +++ stable/11/contrib/netbsd-tests/fs/tmpfs/t_sizes.sh (revision 309668) @@ -1,131 +1,139 @@ # $NetBSD: t_sizes.sh,v 1.5 2010/11/07 17:51:18 jmmv Exp $ # # Copyright (c) 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc. # All rights reserved. # # 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. # # # Verifies that the file system controls memory usage correctly. # atf_test_case small small_head() { atf_set "descr" "Checks the status after creating a small file" atf_set "require.user" "root" } small_body() { test_mount -o -s10M echo a >a || atf_fail "Could not create file" eval $($(atf_get_srcdir)/h_tools statvfs .) f_bused=$((${f_blocks} - ${f_bfree})) [ ${f_bused} -gt 1 ] || atf_fail "Incorrect bused count" atf_check -s eq:0 -o empty -e empty rm a test_unmount } atf_test_case big big_head() { atf_set "descr" "Checks the status after creating a big file" atf_set "require.user" "root" } 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})) atf_check -s eq:0 -o ignore -e ignore \ dd if=/dev/zero of=a bs=1m count=5 eval $($(atf_get_srcdir)/h_tools statvfs .) f_bused=$((${f_blocks} - ${f_bfree})) [ ${f_bused} -ne ${cf_bused} ] || atf_fail "bused did not change" [ ${f_bused} -gt $((5 * 1024 * 1024 / ${pagesize})) ] || \ atf_fail "bused too big" of_bused=${f_bused} atf_check -s eq:0 -o empty -e empty rm a eval $($(atf_get_srcdir)/h_tools statvfs .) f_bused=$((${f_blocks} - ${f_bfree})) [ ${f_bused} -lt ${of_bused} ] || \ atf_fail "bused was not correctly restored" test_unmount } atf_test_case overflow overflow_head() { atf_set "descr" "Checks the status after creating a big file that" \ "overflows the file system limits" atf_set "require.user" "root" } overflow_body() { test_mount -o -s10M atf_check -s eq:0 -o empty -e empty touch a atf_check -s eq:0 -o empty -e empty rm a eval $($(atf_get_srcdir)/h_tools statvfs .) of_bused=$((${f_blocks} - ${f_bfree})) atf_check -s eq:1 -o ignore -e ignore \ dd if=/dev/zero of=a bs=1m count=15 atf_check -s eq:0 -o empty -e empty rm a eval $($(atf_get_srcdir)/h_tools statvfs .) f_bused=$((${f_blocks} - ${f_bfree})) [ ${f_bused} -ge ${of_bused} -a ${f_bused} -le $((${of_bused} + 1)) ] \ || atf_fail "Incorrect bused" test_unmount } atf_test_case overwrite overwrite_head() { atf_set "descr" "Checks that writing to the middle of a file" \ "does not change its size" atf_set "require.user" "root" } overwrite_body() { test_mount -o -s10M atf_check -s eq:0 -o ignore -e ignore \ dd if=/dev/zero of=a bs=1024 count=10 sync atf_check -s eq:0 -o ignore -e ignore \ dd if=/dev/zero of=a bs=1024 conv=notrunc seek=1 count=1 sync eval $(stat -s a) [ ${st_size} -eq 10240 ] || atf_fail "Incorrect file size" test_unmount } atf_init_test_cases() { . $(atf_get_srcdir)/../h_funcs.subr . $(atf_get_srcdir)/h_funcs.subr atf_add_test_case small atf_add_test_case big atf_add_test_case overflow atf_add_test_case overwrite } Index: stable/11/contrib/netbsd-tests/fs/tmpfs/t_statvfs.sh =================================================================== --- stable/11/contrib/netbsd-tests/fs/tmpfs/t_statvfs.sh (revision 309667) +++ stable/11/contrib/netbsd-tests/fs/tmpfs/t_statvfs.sh (revision 309668) @@ -1,59 +1,67 @@ # $NetBSD: t_statvfs.sh,v 1.4 2010/11/07 17:51:18 jmmv Exp $ # # Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc. # All rights reserved. # # 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. # # # Verifies that the statvfs system call works properly (returning the # correct values) over a tmpfs mount point. # atf_test_case values values_head() { atf_set "descr" "Tests that statvfs(2) returns correct values" atf_set "require.user" "root" } 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" [ $((${f_bsize} * ${f_blocks})) -ge $((10 * 1024 * 1024)) ] || \ atf_file "bsize * blocks too small" [ $((${f_bsize} * ${f_blocks})) -le \ $((10 * 1024 * 1024 + ${pagesize})) ] || \ atf_fail "bsize * blocks too big" test_unmount } atf_init_test_cases() { . $(atf_get_srcdir)/../h_funcs.subr . $(atf_get_srcdir)/h_funcs.subr atf_add_test_case values } Index: stable/11/contrib/netbsd-tests/fs/tmpfs/t_vnd.sh =================================================================== --- stable/11/contrib/netbsd-tests/fs/tmpfs/t_vnd.sh (revision 309667) +++ stable/11/contrib/netbsd-tests/fs/tmpfs/t_vnd.sh (revision 309668) @@ -1,78 +1,103 @@ # $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. # 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. # # # Verifies that vnd works with files stored in tmpfs. # atf_test_case basic cleanup basic_head() { atf_set "descr" "Verifies that vnd works with files stored in tmpfs" atf_set "require.user" "root" } basic_body() { test_mount 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 jot 1000 >mnt/${f} || atf_fail "Failed to create file ${f}" done echo "Verifying created files" for f in $(jot -w %u 100 | uniq); do [ $(md5 mnt/${f} | cut -d ' ' -f 4) = \ 53d025127ae99ab79e8502aae2d9bea6 ] || \ atf_fail "Invalid checksum for file ${f}" 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 } 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 } atf_init_test_cases() { . $(atf_get_srcdir)/../h_funcs.subr . $(atf_get_srcdir)/h_funcs.subr atf_add_test_case basic } Index: stable/11/contrib/netbsd-tests/fs/tmpfs/t_vnode_leak.sh =================================================================== --- stable/11/contrib/netbsd-tests/fs/tmpfs/t_vnode_leak.sh (revision 309667) +++ stable/11/contrib/netbsd-tests/fs/tmpfs/t_vnode_leak.sh (revision 309668) @@ -1,60 +1,68 @@ # $NetBSD: t_vnode_leak.sh,v 1.6 2010/11/07 17:51:18 jmmv Exp $ # # Copyright (c) 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc. # All rights reserved. # # 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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_test_case main cleanup main_head() { atf_set "descr" "Verifies that vnodes are not leaked and that" \ "their reclaim operation works as expected: i.e.," \ "when all free vnodes are exhausted, unused ones" \ "have to be recycled, which is what the reclaim" \ "operation does." atf_set "require.user" "root" } 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)) echo "Creating 4000 directories" for f in $(jot 4000); do mkdir ${f} done test_unmount } main_cleanup() { oldvnodes=$(cat oldvnodes) echo "Restoring kern.maxvnodes to ${oldvnodes}" sysctl -w kern.maxvnodes=${oldvnodes} } atf_init_test_cases() { . $(atf_get_srcdir)/../h_funcs.subr . $(atf_get_srcdir)/h_funcs.subr atf_add_test_case main } Index: stable/11/etc/mtree/BSD.tests.dist =================================================================== --- stable/11/etc/mtree/BSD.tests.dist (revision 309667) +++ stable/11/etc/mtree/BSD.tests.dist (revision 309668) @@ -1,678 +1,682 @@ # $FreeBSD$ # # Please see the file src/etc/mtree/README before making changes to this file. # /set type=dir uname=root gname=wheel mode=0755 . bin cat .. chown .. date .. dd .. expr .. ls .. mv .. pax .. pkill .. sh builtins .. errors .. execution .. expansion .. parameters .. parser .. set-e .. .. sleep .. test .. .. cddl lib .. sbin .. usr.bin .. usr.sbin dtrace common aggs .. arithmetic .. arrays .. assocs .. begin .. bitfields .. buffering .. builtinvar .. cg .. clauses .. cpc .. decls .. drops .. dtraceUtil .. end .. enum .. error .. exit .. fbtprovider .. funcs .. grammar .. include .. inline .. io .. ip .. java_api .. json .. lexer .. llquantize .. mdb .. mib .. misc .. multiaggs .. offsetof .. operators .. pid .. plockstat .. pointers .. pragma .. predicates .. preprocessor .. print .. printa .. printf .. privs .. probes .. proc .. profile-n .. providers .. raise .. rates .. safety .. scalars .. sched .. scripting .. sdt .. sizeof .. speculation .. stability .. stack .. stackdepth .. stop .. strlen .. strtoll .. struct .. syscall .. sysevent .. tick-n .. trace .. tracemem .. translators .. typedef .. types .. uctf .. union .. usdt .. ustack .. vars .. version .. .. .. zfsd .. .. .. etc rc.d .. .. games .. gnu lib .. usr.bin diff .. .. .. lib atf libatf-c detail .. .. libatf-c++ detail .. .. test-programs .. .. libarchive .. libc c063 .. db .. gen execve .. posix_spawn .. .. hash data .. .. iconv .. inet .. locale .. net getaddrinfo data .. .. .. nss .. regex data .. .. resolv .. rpc .. ssp .. setjmp .. stdio .. stdlib .. string .. sys .. time .. tls dso .. .. termios .. ttyio .. .. libcrypt .. libdevdctl .. libmp .. libnv .. libpam .. libproc .. librt .. libthr dlopen .. .. libutil .. libxo .. msun .. .. libexec atf atf-check .. atf-sh .. .. rtld-elf .. .. sbin dhclient .. devd .. growfs .. ifconfig .. mdconfig .. .. secure lib .. libexec .. usr.bin .. usr.sbin .. .. share examples tests atf .. plain .. .. .. .. sys acl .. aio .. fifo .. file .. + fs + tmpfs + .. + .. geom class concat .. eli .. gate .. gpt .. mirror .. nop .. raid3 .. shsec .. stripe .. uzip etalon .. .. .. .. kern acct .. execve .. pipe .. .. kqueue libkqueue .. .. mac bsdextended .. portacl .. .. mqueue .. netinet .. opencrypto .. pjdfstest chflags .. chmod .. chown .. ftruncate .. granular .. link .. mkdir .. mkfifo .. mknod .. open .. rename .. rmdir .. symlink .. truncate .. unlink .. .. posixshm .. sys .. vfs .. vm .. .. usr.bin apply .. basename .. bmake archives fmt_44bsd .. fmt_44bsd_mod .. fmt_oldbsd .. .. basic t0 .. t1 .. t2 .. t3 .. .. execution ellipsis .. empty .. joberr .. plus .. .. shell builtin .. meta .. path .. path_select .. replace .. select .. .. suffixes basic .. src_wild1 .. src_wild2 .. .. syntax directive-t0 .. enl .. funny-targets .. semi .. .. sysmk t0 2 1 .. .. mk .. .. t1 2 1 .. .. mk .. .. t2 2 1 .. .. mk .. .. .. variables modifier_M .. modifier_t .. opt_V .. t0 .. .. .. bsdcat .. calendar .. cmp .. cpio .. col .. comm .. cut .. dirname .. file2c .. grep .. gzip .. ident .. join .. jot .. lastcomm .. limits .. m4 .. mkimg .. ncal .. opensm .. printf .. sdiff .. sed regress.multitest.out .. .. soelim .. tar .. timeout .. tr .. truncate .. units .. uudecode .. uuencode .. xargs .. xinstall .. xo .. yacc yacc .. .. .. usr.sbin etcupdate .. extattr .. fstyp .. makefs .. newsyslog .. nmtree .. pw .. rpcbind .. sa .. .. .. # vim: set expandtab ts=4 sw=4: Index: stable/11/tests/sys/Makefile =================================================================== --- stable/11/tests/sys/Makefile (revision 309667) +++ stable/11/tests/sys/Makefile (revision 309668) @@ -1,24 +1,25 @@ # $FreeBSD$ TESTSDIR= ${TESTSBASE}/sys TESTS_SUBDIRS+= acl TESTS_SUBDIRS+= aio TESTS_SUBDIRS+= fifo TESTS_SUBDIRS+= file +TESTS_SUBDIRS+= fs TESTS_SUBDIRS+= geom TESTS_SUBDIRS+= kern TESTS_SUBDIRS+= kqueue TESTS_SUBDIRS+= mac TESTS_SUBDIRS+= mqueue TESTS_SUBDIRS+= netinet TESTS_SUBDIRS+= opencrypto TESTS_SUBDIRS+= posixshm TESTS_SUBDIRS+= sys TESTS_SUBDIRS+= vfs TESTS_SUBDIRS+= vm # Items not integrated into kyua runs by default SUBDIR+= pjdfstest .include Index: stable/11/tests/sys/fs/Makefile =================================================================== --- stable/11/tests/sys/fs/Makefile (nonexistent) +++ stable/11/tests/sys/fs/Makefile (revision 309668) @@ -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 Property changes on: stable/11/tests/sys/fs/Makefile ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: stable/11/tests/sys/fs/tmpfs/Makefile =================================================================== --- stable/11/tests/sys/fs/tmpfs/Makefile (nonexistent) +++ stable/11/tests/sys/fs/tmpfs/Makefile (revision 309668) @@ -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 + +.include Property changes on: stable/11/tests/sys/fs/tmpfs/Makefile ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: stable/11 =================================================================== --- stable/11 (revision 309667) +++ stable/11 (revision 309668) Property changes on: stable/11 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head:r306030-306031,306033,306036,306038,307190,307196,307204-307205,307701-307702