diff options
author | ngie <ngie@FreeBSD.org> | 2017-03-07 01:52:56 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2017-03-07 01:52:56 +0000 |
commit | 10b87d8ba3ff12dbc34b3c1d99e89f4383fc98c3 (patch) | |
tree | 9c82bf5ded885bafb240ccc56f48e06efbf594be /contrib/netbsd-tests/fs | |
parent | 6a26a03ab521df8ace37d7a8ab9af6479c2959c6 (diff) | |
download | FreeBSD-src-10b87d8ba3ff12dbc34b3c1d99e89f4383fc98c3.zip FreeBSD-src-10b87d8ba3ff12dbc34b3c1d99e89f4383fc98c3.tar.gz |
MFC r313439,r314450:
r313439:
Merge content from ^/projects/netbsd-tests-upstream-01-2017 into ^/head
The primary end-goal of this drop is ease future merges with NetBSD and
collaborate further with the NetBSD project.
The goal was (largely, not completely as some items are still oustanding
in the NetBSD GNATS system) achieved by doing the following:
- Pushing as many changes required to port contrib/netbsd-tests
back to NetBSD as possible, then pull the upstream applied changes
back in to FreeBSD.
- Diff reduce with upstream where possible by:
-- Improving libnetbsd header, etc compat glue.
-- Using _SED variables to modify test scripts on the fly for items
that could not be upstreamed to NetBSD.
As a bonus for this work, this change also introduces testcases for
uniq(1).
Many thanks to Christos for working with me to get many of the changes
back into the NetBSD project.
In collaboration with: Christos Zoulas <christos@netbsd.org>
r314450:
Add additional __FreeBSD_version guards around the hsearch_r testcases
The reasoning for this is the same as r276046: to ease MFCing the tests
to ^/stable/10 .
This was accidentally missed in r313439
Diffstat (limited to 'contrib/netbsd-tests/fs')
35 files changed, 381 insertions, 86 deletions
diff --git a/contrib/netbsd-tests/fs/common/h_fsmacros.h b/contrib/netbsd-tests/fs/common/h_fsmacros.h index b295cf2..eb83768 100644 --- a/contrib/netbsd-tests/fs/common/h_fsmacros.h +++ b/contrib/netbsd-tests/fs/common/h_fsmacros.h @@ -1,4 +1,4 @@ -/* $NetBSD: h_fsmacros.h,v 1.40 2015/08/29 19:19:43 dholland Exp $ */ +/* $NetBSD: h_fsmacros.h,v 1.41 2017/01/13 21:30:39 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #include <rump/rump.h> -#include "../../h_macros.h" +#include "h_macros.h" #define FSPROTOS(_fs_) \ int _fs_##_fstest_newfs(const atf_tc_t *, void **, const char *, \ diff --git a/contrib/netbsd-tests/fs/ffs/h_quota2_tests.c b/contrib/netbsd-tests/fs/ffs/h_quota2_tests.c index 59f3ea3..71cf3b4 100644 --- a/contrib/netbsd-tests/fs/ffs/h_quota2_tests.c +++ b/contrib/netbsd-tests/fs/ffs/h_quota2_tests.c @@ -1,4 +1,4 @@ -/* $NetBSD: h_quota2_tests.c,v 1.4 2012/09/30 21:26:57 bouyer Exp $ */ +/* $NetBSD: h_quota2_tests.c,v 1.5 2017/01/13 21:30:39 christos Exp $ */ /* * rump server for advanced quota tests @@ -22,7 +22,7 @@ #include <rump/rump.h> #include <rump/rump_syscalls.h> -#include "../../h_macros.h" +#include "h_macros.h" int background = 0; diff --git a/contrib/netbsd-tests/fs/ffs/t_fifos.c b/contrib/netbsd-tests/fs/ffs/t_fifos.c index fe1d425..10b50bb 100644 --- a/contrib/netbsd-tests/fs/ffs/t_fifos.c +++ b/contrib/netbsd-tests/fs/ffs/t_fifos.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_fifos.c,v 1.5 2010/11/07 17:51:17 jmmv Exp $ */ +/* $NetBSD: t_fifos.c,v 1.6 2017/01/13 21:30:39 christos Exp $ */ #include <sys/types.h> #include <sys/mount.h> @@ -17,7 +17,7 @@ #include <ufs/ufs/ufsmount.h> -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC_WITH_CLEANUP(fifos); ATF_TC_HEAD(fifos, tc) diff --git a/contrib/netbsd-tests/fs/ffs/t_mount.c b/contrib/netbsd-tests/fs/ffs/t_mount.c index 6a8f74f..2096095 100644 --- a/contrib/netbsd-tests/fs/ffs/t_mount.c +++ b/contrib/netbsd-tests/fs/ffs/t_mount.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_mount.c,v 1.13 2012/11/27 16:01:49 jakllsch Exp $ */ +/* $NetBSD: t_mount.c,v 1.14 2017/01/13 21:30:39 christos Exp $ */ /* * Basic tests for mounting @@ -25,7 +25,7 @@ #include <rump/rump.h> #include <rump/rump_syscalls.h> -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(48Kimage); ATF_TC_HEAD(48Kimage, tc) diff --git a/contrib/netbsd-tests/fs/ffs/t_quota2_1.c b/contrib/netbsd-tests/fs/ffs/t_quota2_1.c index 333f3c7..22cd5d2 100644 --- a/contrib/netbsd-tests/fs/ffs/t_quota2_1.c +++ b/contrib/netbsd-tests/fs/ffs/t_quota2_1.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_quota2_1.c,v 1.4 2012/03/15 02:02:22 joerg Exp $ */ +/* $NetBSD: t_quota2_1.c,v 1.5 2017/01/13 21:30:39 christos Exp $ */ /* * Basic tests for quota2 @@ -18,7 +18,7 @@ #include <rump/rump.h> #include <rump/rump_syscalls.h> -#include "../../h_macros.h" +#include "h_macros.h" static void do_quota(const atf_tc_t *tc, int n, const char *newfs_opts, int log) diff --git a/contrib/netbsd-tests/fs/ffs/t_quota2_remount.c b/contrib/netbsd-tests/fs/ffs/t_quota2_remount.c index f648856..d843cf8 100644 --- a/contrib/netbsd-tests/fs/ffs/t_quota2_remount.c +++ b/contrib/netbsd-tests/fs/ffs/t_quota2_remount.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_quota2_remount.c,v 1.4 2012/03/15 02:02:22 joerg Exp $ */ +/* $NetBSD: t_quota2_remount.c,v 1.5 2017/01/13 21:30:39 christos Exp $ */ /* * Basic tests for quota2 @@ -19,7 +19,7 @@ #include <rump/rump.h> #include <rump/rump_syscalls.h> -#include "../../h_macros.h" +#include "h_macros.h" static void do_quota(const atf_tc_t *tc, int n, const char *newfs_opts, int log) diff --git a/contrib/netbsd-tests/fs/ffs/t_snapshot.c b/contrib/netbsd-tests/fs/ffs/t_snapshot.c index 180a8cc..f661bec 100644 --- a/contrib/netbsd-tests/fs/ffs/t_snapshot.c +++ b/contrib/netbsd-tests/fs/ffs/t_snapshot.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_snapshot.c,v 1.6 2013/02/06 09:05:01 hannken Exp $ */ +/* $NetBSD: t_snapshot.c,v 1.7 2017/01/13 21:30:39 christos Exp $ */ #include <sys/types.h> #include <sys/mount.h> @@ -15,7 +15,7 @@ #include <string.h> #include <unistd.h> -#include "../../h_macros.h" +#include "h_macros.h" #define IMGNAME "ffs.img" #define NEWFS "newfs -F -s 10000 " IMGNAME diff --git a/contrib/netbsd-tests/fs/ffs/t_snapshot_log.c b/contrib/netbsd-tests/fs/ffs/t_snapshot_log.c index e1ce17e..31b28e5 100644 --- a/contrib/netbsd-tests/fs/ffs/t_snapshot_log.c +++ b/contrib/netbsd-tests/fs/ffs/t_snapshot_log.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_snapshot_log.c,v 1.2 2013/02/06 09:05:01 hannken Exp $ */ +/* $NetBSD: t_snapshot_log.c,v 1.3 2017/01/13 21:30:39 christos Exp $ */ #include <sys/types.h> #include <sys/mount.h> @@ -15,7 +15,7 @@ #include <string.h> #include <unistd.h> -#include "../../h_macros.h" +#include "h_macros.h" #define IMGNAME "ffs.img" #define NEWFS "newfs -F -s 10000 " IMGNAME diff --git a/contrib/netbsd-tests/fs/ffs/t_snapshot_v2.c b/contrib/netbsd-tests/fs/ffs/t_snapshot_v2.c index 393f3d4..b27929c 100644 --- a/contrib/netbsd-tests/fs/ffs/t_snapshot_v2.c +++ b/contrib/netbsd-tests/fs/ffs/t_snapshot_v2.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_snapshot_v2.c,v 1.2 2013/02/06 09:05:01 hannken Exp $ */ +/* $NetBSD: t_snapshot_v2.c,v 1.3 2017/01/13 21:30:39 christos Exp $ */ #include <sys/types.h> #include <sys/mount.h> @@ -15,7 +15,7 @@ #include <string.h> #include <unistd.h> -#include "../../h_macros.h" +#include "h_macros.h" #define IMGNAME "ffs.img" #define NEWFS "newfs -F -s 10000 -O 2 " IMGNAME diff --git a/contrib/netbsd-tests/fs/hfs/t_pathconvert.c b/contrib/netbsd-tests/fs/hfs/t_pathconvert.c index 307de70..056726a 100644 --- a/contrib/netbsd-tests/fs/hfs/t_pathconvert.c +++ b/contrib/netbsd-tests/fs/hfs/t_pathconvert.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_pathconvert.c,v 1.5 2011/02/25 20:54:18 martin Exp $ */ +/* $NetBSD: t_pathconvert.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */ #include <sys/types.h> #include <sys/mount.h> @@ -18,7 +18,7 @@ #include <fs/hfs/hfs.h> -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(colonslash); ATF_TC_HEAD(colonslash, tc) diff --git a/contrib/netbsd-tests/fs/kernfs/t_basic.c b/contrib/netbsd-tests/fs/kernfs/t_basic.c index e5ba4a7..77acd11 100644 --- a/contrib/netbsd-tests/fs/kernfs/t_basic.c +++ b/contrib/netbsd-tests/fs/kernfs/t_basic.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_basic.c,v 1.3 2010/05/31 23:44:54 pooka Exp $ */ +/* $NetBSD: t_basic.c,v 1.4 2017/01/13 21:30:40 christos Exp $ */ #include <sys/types.h> #include <sys/mount.h> @@ -20,7 +20,7 @@ #include <miscfs/kernfs/kernfs.h> -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(getdents); ATF_TC_HEAD(getdents, tc) diff --git a/contrib/netbsd-tests/fs/lfs/t_pr.c b/contrib/netbsd-tests/fs/lfs/t_pr.c index 97cb1db..ed676d8 100644 --- a/contrib/netbsd-tests/fs/lfs/t_pr.c +++ b/contrib/netbsd-tests/fs/lfs/t_pr.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_pr.c,v 1.6 2011/02/22 18:41:05 pooka Exp $ */ +/* $NetBSD: t_pr.c,v 1.7 2017/01/13 21:30:40 christos Exp $ */ #include <sys/types.h> #include <sys/mount.h> @@ -17,7 +17,7 @@ #include <ufs/ufs/ufsmount.h> -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(mknod); ATF_TC_HEAD(mknod, tc) diff --git a/contrib/netbsd-tests/fs/msdosfs/t_snapshot.c b/contrib/netbsd-tests/fs/msdosfs/t_snapshot.c index 8b5708f..449e625 100644 --- a/contrib/netbsd-tests/fs/msdosfs/t_snapshot.c +++ b/contrib/netbsd-tests/fs/msdosfs/t_snapshot.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_snapshot.c,v 1.3 2014/06/10 13:15:18 martin Exp $ */ +/* $NetBSD: t_snapshot.c,v 1.4 2017/01/13 21:30:40 christos Exp $ */ #include <sys/types.h> #include <sys/mount.h> @@ -17,7 +17,7 @@ #include <string.h> #include <unistd.h> -#include "../../h_macros.h" +#include "h_macros.h" #define IMGNAME "msdosfs.img" #define NEWFS "newfs_msdos -C 5M " IMGNAME diff --git a/contrib/netbsd-tests/fs/nfs/t_mountd.c b/contrib/netbsd-tests/fs/nfs/t_mountd.c index b6c1528..6272587 100644 --- a/contrib/netbsd-tests/fs/nfs/t_mountd.c +++ b/contrib/netbsd-tests/fs/nfs/t_mountd.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_mountd.c,v 1.5 2012/02/24 13:53:46 joerg Exp $ */ +/* $NetBSD: t_mountd.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ #include <rump/rump.h> #include <rump/rump_syscalls.h> -#include "../../h_macros.h" +#include "h_macros.h" #include "../common/h_fsmacros.h" ATF_TC(mountdhup); diff --git a/contrib/netbsd-tests/fs/nullfs/t_basic.c b/contrib/netbsd-tests/fs/nullfs/t_basic.c index 21dfccd..d54f773 100644 --- a/contrib/netbsd-tests/fs/nullfs/t_basic.c +++ b/contrib/netbsd-tests/fs/nullfs/t_basic.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_basic.c,v 1.3 2010/06/09 08:37:16 pooka Exp $ */ +/* $NetBSD: t_basic.c,v 1.4 2017/01/13 21:30:40 christos Exp $ */ #include <sys/types.h> #include <sys/mount.h> @@ -18,7 +18,7 @@ #include <miscfs/nullfs/null.h> #include <fs/tmpfs/tmpfs_args.h> -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(basic); ATF_TC_HEAD(basic, tc) diff --git a/contrib/netbsd-tests/fs/ptyfs/t_nullpts.c b/contrib/netbsd-tests/fs/ptyfs/t_nullpts.c index 9265f32..fcc7e47 100644 --- a/contrib/netbsd-tests/fs/ptyfs/t_nullpts.c +++ b/contrib/netbsd-tests/fs/ptyfs/t_nullpts.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_nullpts.c,v 1.5 2011/01/10 11:11:04 hannken Exp $ */ +/* $NetBSD: t_nullpts.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */ #include <sys/types.h> #include <sys/mount.h> @@ -19,7 +19,7 @@ #include <fs/ptyfs/ptyfs.h> #include <miscfs/nullfs/null.h> -#include "../../h_macros.h" +#include "h_macros.h" static void mountptyfs(const char *mp, int flags) diff --git a/contrib/netbsd-tests/fs/ptyfs/t_ptyfs.c b/contrib/netbsd-tests/fs/ptyfs/t_ptyfs.c index 90001b9..108c344 100644 --- a/contrib/netbsd-tests/fs/ptyfs/t_ptyfs.c +++ b/contrib/netbsd-tests/fs/ptyfs/t_ptyfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptyfs.c,v 1.1 2010/06/11 23:52:38 pooka Exp $ */ +/* $NetBSD: t_ptyfs.c,v 1.2 2017/01/13 21:30:40 christos Exp $ */ #include <sys/types.h> #include <sys/mount.h> @@ -17,7 +17,7 @@ #include <fs/ptyfs/ptyfs.h> -#include "../../h_macros.h" +#include "h_macros.h" static void mountptyfs(const char *mp, int flags) diff --git a/contrib/netbsd-tests/fs/puffs/t_basic.c b/contrib/netbsd-tests/fs/puffs/t_basic.c index 735108d..4b5b7b8 100644 --- a/contrib/netbsd-tests/fs/puffs/t_basic.c +++ b/contrib/netbsd-tests/fs/puffs/t_basic.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_basic.c,v 1.13 2016/12/01 14:49:04 hannken Exp $ */ +/* $NetBSD: t_basic.c,v 1.14 2017/01/13 21:30:40 christos Exp $ */ #include <sys/types.h> #include <sys/mount.h> @@ -20,7 +20,7 @@ #include <rump/rump.h> #include <rump/rump_syscalls.h> -#include "../../h_macros.h" +#include "h_macros.h" #include "../common/h_fsmacros.h" /* diff --git a/contrib/netbsd-tests/fs/puffs/t_fuzz.c b/contrib/netbsd-tests/fs/puffs/t_fuzz.c index 1d249c0..b2e000d 100644 --- a/contrib/netbsd-tests/fs/puffs/t_fuzz.c +++ b/contrib/netbsd-tests/fs/puffs/t_fuzz.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_fuzz.c,v 1.5 2012/04/21 01:03:46 manu Exp $ */ +/* $NetBSD: t_fuzz.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -56,7 +56,7 @@ #include <rump/rump.h> #include <rump/rump_syscalls.h> -#include "../../h_macros.h" +#include "h_macros.h" #define ITERATIONS 100 diff --git a/contrib/netbsd-tests/fs/puffs/t_io.c b/contrib/netbsd-tests/fs/puffs/t_io.c index 37c386c..72b5d85 100644 --- a/contrib/netbsd-tests/fs/puffs/t_io.c +++ b/contrib/netbsd-tests/fs/puffs/t_io.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_io.c,v 1.1 2010/11/12 17:33:28 pooka Exp $ */ +/* $NetBSD: t_io.c,v 1.2 2017/01/13 21:30:40 christos Exp $ */ #include <sys/types.h> #include <sys/mount.h> @@ -20,7 +20,7 @@ #include <rump/rump.h> #include <rump/rump_syscalls.h> -#include "../../h_macros.h" +#include "h_macros.h" #include "../common/h_fsmacros.h" #define MAKEOPTS(...) \ diff --git a/contrib/netbsd-tests/fs/tmpfs/t_mknod.sh b/contrib/netbsd-tests/fs/tmpfs/t_mknod.sh index 037dc16..62c7cce 100755 --- a/contrib/netbsd-tests/fs/tmpfs/t_mknod.sh +++ b/contrib/netbsd-tests/fs/tmpfs/t_mknod.sh @@ -106,15 +106,7 @@ 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" @@ -132,15 +124,7 @@ 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_readdir.sh b/contrib/netbsd-tests/fs/tmpfs/t_readdir.sh index 272c749..6f5dc3e 100755 --- a/contrib/netbsd-tests/fs/tmpfs/t_readdir.sh +++ b/contrib/netbsd-tests/fs/tmpfs/t_readdir.sh @@ -59,15 +59,7 @@ 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_renamerace.c b/contrib/netbsd-tests/fs/tmpfs/t_renamerace.c index 044937a..d7c10e4 100644 --- a/contrib/netbsd-tests/fs/tmpfs/t_renamerace.c +++ b/contrib/netbsd-tests/fs/tmpfs/t_renamerace.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_renamerace.c,v 1.13 2011/08/18 21:44:55 riastradh Exp $ */ +/* $NetBSD: t_renamerace.c,v 1.14 2017/01/13 21:30:40 christos Exp $ */ /* * Modified for rump and atf from a program supplied @@ -23,7 +23,7 @@ #include <fs/tmpfs/tmpfs_args.h> -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(renamerace2); ATF_TC_HEAD(renamerace2, tc) diff --git a/contrib/netbsd-tests/fs/umapfs/t_basic.c b/contrib/netbsd-tests/fs/umapfs/t_basic.c index 259f6fe..c9b2d9b 100644 --- a/contrib/netbsd-tests/fs/umapfs/t_basic.c +++ b/contrib/netbsd-tests/fs/umapfs/t_basic.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_basic.c,v 1.4 2010/07/19 15:35:39 pooka Exp $ */ +/* $NetBSD: t_basic.c,v 1.5 2017/01/13 21:30:40 christos Exp $ */ #include <sys/types.h> #include <sys/param.h> @@ -20,7 +20,7 @@ #include <fs/tmpfs/tmpfs_args.h> #include <miscfs/umapfs/umap.h> -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(basic); ATF_TC_HEAD(basic, tc) diff --git a/contrib/netbsd-tests/fs/union/t_pr.c b/contrib/netbsd-tests/fs/union/t_pr.c index 2d0c0c8..fc70bca 100644 --- a/contrib/netbsd-tests/fs/union/t_pr.c +++ b/contrib/netbsd-tests/fs/union/t_pr.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_pr.c,v 1.8 2011/08/10 06:27:02 hannken Exp $ */ +/* $NetBSD: t_pr.c,v 1.9 2017/01/13 21:30:40 christos Exp $ */ #include <sys/types.h> #include <sys/mount.h> @@ -17,7 +17,7 @@ #include <miscfs/union/union.h> -#include "../../h_macros.h" +#include "h_macros.h" ATF_TC(multilayer); ATF_TC_HEAD(multilayer, tc) diff --git a/contrib/netbsd-tests/fs/vfs/t_full.c b/contrib/netbsd-tests/fs/vfs/t_full.c index f338a02..51347de 100644 --- a/contrib/netbsd-tests/fs/vfs/t_full.c +++ b/contrib/netbsd-tests/fs/vfs/t_full.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_full.c,v 1.8 2013/03/16 05:45:37 jmmv Exp $ */ +/* $NetBSD: t_full.c,v 1.9 2017/01/13 21:30:40 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #include <rump/rump.h> #include "../common/h_fsmacros.h" -#include "../../h_macros.h" +#include "h_macros.h" /* * Write this much over the image size. This is to force an NFS commit, diff --git a/contrib/netbsd-tests/fs/vfs/t_io.c b/contrib/netbsd-tests/fs/vfs/t_io.c index 23c3a15..b7f6529 100644 --- a/contrib/netbsd-tests/fs/vfs/t_io.c +++ b/contrib/netbsd-tests/fs/vfs/t_io.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_io.c,v 1.16 2015/04/04 12:34:44 riastradh Exp $ */ +/* $NetBSD: t_io.c,v 1.17 2017/01/13 21:30:40 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #include <rump/rump.h> #include "../common/h_fsmacros.h" -#include "../../h_macros.h" +#include "h_macros.h" #define TESTSTR "this is a string. collect enough and you'll have Em" #define TESTSZ sizeof(TESTSTR) diff --git a/contrib/netbsd-tests/fs/vfs/t_mtime_otrunc.c b/contrib/netbsd-tests/fs/vfs/t_mtime_otrunc.c new file mode 100644 index 0000000..bb07609 --- /dev/null +++ b/contrib/netbsd-tests/fs/vfs/t_mtime_otrunc.c @@ -0,0 +1,86 @@ +/*- + * Copyright (c) 2017 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. + */ + +#include <sys/cdefs.h> +__COPYRIGHT("@(#) Copyright (c) 2013\ + The NetBSD Foundation, inc. All rights reserved."); +__RCSID("$NetBSD: t_mtime_otrunc.c,v 1.1 2017/02/02 22:07:05 martin Exp $"); + +#include <errno.h> +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/stat.h> +#include <atf-c.h> + +#include <rump/rump_syscalls.h> +#include <rump/rump.h> + +#include "../common/h_fsmacros.h" + +#define LOCKFILE "lock" + +static time_t +lock_it(void) +{ + struct stat st; + + if (rump_sys_stat(LOCKFILE, &st) != 0) + st.st_mtime = 0; + + int f = rump_sys_open(LOCKFILE, O_WRONLY|O_CREAT|O_TRUNC, 0666); + if (f == -1) return 0; + rump_sys_close(f); + + return st.st_mtime; +} + +static void +otrunc_mtime_update(const atf_tc_t *tc, const char *path) +{ + time_t last_ts = 0; + int res; + + /* atf_tc_expect_fail("PR kern/51762"); */ + + res = rump_sys_chdir(path); + if (res == -1) + atf_tc_fail("chdir failed"); + + for (int i = 0; i < 5; i++) { + time_t l = lock_it(); + printf("last lock: %ld\n", (long)l); + ATF_REQUIRE_MSG(i == 0 || l > last_ts, + "iteration %d: lock time did not increase, old time %lu, " + "new time %lu", i, + (unsigned long)last_ts, (unsigned long)l); + last_ts = l; + sleep(2); + } + rump_sys_chdir("/"); +} + +ATF_FSAPPLY(otrunc_mtime_update, "Checks for mtime updates by open(O_TRUNC) (PR kern/51762)"); diff --git a/contrib/netbsd-tests/fs/vfs/t_renamerace.c b/contrib/netbsd-tests/fs/vfs/t_renamerace.c index 809c380..63cfb44 100644 --- a/contrib/netbsd-tests/fs/vfs/t_renamerace.c +++ b/contrib/netbsd-tests/fs/vfs/t_renamerace.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_renamerace.c,v 1.33 2016/05/04 08:30:22 dholland Exp $ */ +/* $NetBSD: t_renamerace.c,v 1.34 2017/01/13 21:30:40 christos Exp $ */ /* * Modified for rump and atf from a program supplied @@ -34,7 +34,7 @@ #define FSTEST_IMGSIZE (50000 * 512) #include "../common/h_fsmacros.h" -#include "../../h_macros.h" +#include "h_macros.h" static volatile int quittingtime; pid_t wrkpid; diff --git a/contrib/netbsd-tests/fs/vfs/t_ro.c b/contrib/netbsd-tests/fs/vfs/t_ro.c index b1e1179..f7f4581 100644 --- a/contrib/netbsd-tests/fs/vfs/t_ro.c +++ b/contrib/netbsd-tests/fs/vfs/t_ro.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_ro.c,v 1.5 2011/02/22 21:23:19 yamt Exp $ */ +/* $NetBSD: t_ro.c,v 1.6 2017/01/13 21:30:40 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #include <rump/rump.h> #include "../common/h_fsmacros.h" -#include "../../h_macros.h" +#include "h_macros.h" #define AFILE "testfile" #define ADIR "testdir" diff --git a/contrib/netbsd-tests/fs/vfs/t_rwtoro.c b/contrib/netbsd-tests/fs/vfs/t_rwtoro.c new file mode 100644 index 0000000..ca8af07 --- /dev/null +++ b/contrib/netbsd-tests/fs/vfs/t_rwtoro.c @@ -0,0 +1,233 @@ +/* $NetBSD: t_rwtoro.c,v 1.1 2017/01/27 10:45:11 hannken Exp $ */ + +/*- + * Copyright (c) 2017 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. + */ + +#include <sys/types.h> +#include <sys/mount.h> +#include <sys/stat.h> +#include <sys/statvfs.h> + +#include <atf-c.h> +#include <fcntl.h> +#include <libgen.h> +#include <stdlib.h> +#include <unistd.h> + +#include <rump/rump_syscalls.h> +#include <rump/rump.h> + +#include <miscfs/nullfs/null.h> +#include <fs/tmpfs/tmpfs_args.h> + +#include "../common/h_fsmacros.h" +#include "../../h_macros.h" + +static const char *unsupported = "fs does not support r/o remount"; +static char file_path[MAXPATHLEN]; +static int file_fd; + +/* + * Remount the filesystem read-only and test errno. + * Skip filesystems that don't implement read-write -> read-only. + */ +static void +remount_ro(const atf_tc_t *tc, const char *mp, int expected_errno) +{ + int error; + union { + struct tmpfs_args tmpfs; + char data[4095]; + } mount_args; + int mount_args_length; + struct statvfs sbuf; + + if (FSTYPE_ZFS(tc)) + atf_tc_skip("%s", unsupported); + + /* Prepare mount arguments. */ + RL(rump_sys_statvfs1(mp, &sbuf, ST_WAIT)); + mount_args_length = sizeof(mount_args); + memset(&mount_args, 0, mount_args_length); + if (FSTYPE_TMPFS(tc)) + mount_args.tmpfs.ta_version = TMPFS_ARGS_VERSION; + mount_args_length = rump_sys_mount(sbuf.f_fstypename, mp, MNT_GETARGS, + &mount_args, mount_args_length); + ATF_CHECK(mount_args_length >= 0); + + /* Remount and test result. */ + error = rump_sys_mount(sbuf.f_fstypename, mp, MNT_UPDATE | MNT_RDONLY, + &mount_args, mount_args_length); + if (errno == EOPNOTSUPP) + atf_tc_skip("%s", unsupported); + if (expected_errno == 0) + ATF_CHECK(error == 0); + else + ATF_CHECK_ERRNO(expected_errno, error == -1); +} + +static void +open_file_ro(const char *prefix) +{ + + snprintf(file_path, sizeof(file_path), "%s/file", prefix); + RL(file_fd = rump_sys_open(file_path, O_CREAT | O_RDWR, 0777)); + RL(rump_sys_close(file_fd)); + RL(file_fd = rump_sys_open(file_path, O_RDONLY)); +} + +static void +open_file_ro_unlink(const char *prefix) +{ + + snprintf(file_path, sizeof(file_path), "%s/file", prefix); + RL(file_fd = rump_sys_open(file_path, O_CREAT | O_RDWR, 0777)); + RL(rump_sys_close(file_fd)); + RL(file_fd = rump_sys_open(file_path, O_RDONLY)); + RL(rump_sys_unlink(file_path)); +} + +static void +open_file_rw(const char *prefix) +{ + + snprintf(file_path, sizeof(file_path), "%s/file", prefix); + RL(file_fd = rump_sys_open(file_path, O_CREAT | O_RDWR, 0777)); +} + +static void +close_file(const char *unused) +{ + + RL(rump_sys_close(file_fd)); +} + +static void +basic_test(const atf_tc_t *tc, const char *mp, int expected_errno, + bool use_layer, void (*pre)(const char *), void (*post)(const char *)) +{ + const char *null_mount = "/nullm"; + struct null_args nargs; + + if (use_layer) { + RL(rump_sys_mkdir(null_mount, 0777)); + memset(&nargs, 0, sizeof(nargs)); + nargs.nulla_target = __UNCONST(mp);; + RL(rump_sys_mount(MOUNT_NULL, null_mount, 0, + &nargs, sizeof(nargs))); + } + if (pre) + (*pre)(use_layer ? null_mount : mp); + remount_ro(tc, mp, expected_errno); + if (post) + (*post)(use_layer ? null_mount : mp); + if (use_layer) + RL(rump_sys_unmount(null_mount, 0)); +} + +static void +noneopen(const atf_tc_t *tc, const char *mp) +{ + + basic_test(tc, mp, 0, false, NULL, NULL); +} + +static void +readopen(const atf_tc_t *tc, const char *mp) +{ + + basic_test(tc, mp, 0, false, open_file_ro, close_file); +} + +static void +writeopen(const atf_tc_t *tc, const char *mp) +{ + + basic_test(tc, mp, EBUSY, false, open_file_rw, close_file); +} + +static void +read_unlinked(const atf_tc_t *tc, const char *mp) +{ + + basic_test(tc, mp, EBUSY, false, open_file_ro_unlink, close_file); +} + +static void +layer_noneopen(const atf_tc_t *tc, const char *mp) +{ + + basic_test(tc, mp, 0, true, NULL, NULL); +} + +static void +layer_readopen(const atf_tc_t *tc, const char *mp) +{ + + basic_test(tc, mp, 0, true, open_file_ro, close_file); +} + +static void +layer_writeopen(const atf_tc_t *tc, const char *mp) +{ + + basic_test(tc, mp, EBUSY, true, open_file_rw, close_file); +} + +static void +layer_read_unlinked(const atf_tc_t *tc, const char *mp) +{ + + basic_test(tc, mp, EBUSY, true, open_file_ro_unlink, close_file); +} + +ATF_TC_FSAPPLY(noneopen, "remount r/o with no file open"); +ATF_TC_FSAPPLY(readopen, "remount r/o with file open for reading"); +ATF_TC_FSAPPLY(writeopen, "remount r/o with file open for writing"); +ATF_TC_FSAPPLY(read_unlinked, + "remount r/o with unlinked file open for reading"); +ATF_TC_FSAPPLY(layer_noneopen, "remount r/o with no file open on layer"); +ATF_TC_FSAPPLY(layer_readopen, + "remount r/o with file open for reading on layer"); +ATF_TC_FSAPPLY(layer_writeopen, + "remount r/o with file open for writing on layer"); +ATF_TC_FSAPPLY(layer_read_unlinked, + "remount r/o with unlinked file open for reading on layer"); + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_FSAPPLY(noneopen); + ATF_TP_FSAPPLY(readopen); + ATF_TP_FSAPPLY(writeopen); + ATF_TP_FSAPPLY(read_unlinked); + ATF_TP_FSAPPLY(layer_noneopen); + ATF_TP_FSAPPLY(layer_readopen); + ATF_TP_FSAPPLY(layer_writeopen); + ATF_TP_FSAPPLY(layer_read_unlinked); + + return atf_no_error(); +} diff --git a/contrib/netbsd-tests/fs/vfs/t_union.c b/contrib/netbsd-tests/fs/vfs/t_union.c index bdcef93..5da1ea1 100644 --- a/contrib/netbsd-tests/fs/vfs/t_union.c +++ b/contrib/netbsd-tests/fs/vfs/t_union.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_union.c,v 1.8 2011/08/07 06:01:51 hannken Exp $ */ +/* $NetBSD: t_union.c,v 1.9 2017/01/13 21:30:40 christos Exp $ */ #include <sys/types.h> #include <sys/mount.h> @@ -17,7 +17,7 @@ #include <miscfs/union/union.h> -#include "../../h_macros.h" +#include "h_macros.h" #include "../common/h_fsmacros.h" #define MSTR "magic bus" diff --git a/contrib/netbsd-tests/fs/vfs/t_unpriv.c b/contrib/netbsd-tests/fs/vfs/t_unpriv.c index 6da771b4..6536c21 100644 --- a/contrib/netbsd-tests/fs/vfs/t_unpriv.c +++ b/contrib/netbsd-tests/fs/vfs/t_unpriv.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_unpriv.c,v 1.12 2015/04/09 19:51:13 riastradh Exp $ */ +/* $NetBSD: t_unpriv.c,v 1.13 2017/01/13 21:30:40 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include <rump/rump.h> #include "../common/h_fsmacros.h" -#include "../../h_macros.h" +#include "h_macros.h" #define USES_OWNER \ if (FSTYPE_MSDOS(tc)) \ diff --git a/contrib/netbsd-tests/fs/vfs/t_vfsops.c b/contrib/netbsd-tests/fs/vfs/t_vfsops.c index 1bcee89..bbed9f9 100644 --- a/contrib/netbsd-tests/fs/vfs/t_vfsops.c +++ b/contrib/netbsd-tests/fs/vfs/t_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_vfsops.c,v 1.11 2011/04/04 19:16:58 hannken Exp $ */ +/* $NetBSD: t_vfsops.c,v 1.12 2017/01/13 21:30:40 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ #include <rump/rump.h> #include "../common/h_fsmacros.h" -#include "../../h_macros.h" +#include "h_macros.h" static void tmount(const atf_tc_t *tc, const char *path) diff --git a/contrib/netbsd-tests/fs/vfs/t_vnops.c b/contrib/netbsd-tests/fs/vfs/t_vnops.c index 978fadb..7da53c8 100644 --- a/contrib/netbsd-tests/fs/vfs/t_vnops.c +++ b/contrib/netbsd-tests/fs/vfs/t_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_vnops.c,v 1.58 2016/08/29 02:31:46 kre Exp $ */ +/* $NetBSD: t_vnops.c,v 1.59 2017/01/13 21:30:40 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -43,7 +43,7 @@ #include <rump/rump.h> #include "../common/h_fsmacros.h" -#include "../../h_macros.h" +#include "h_macros.h" #define TESTFILE "afile" |