summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2017-06-28 08:48:09 +0000
committerEnji Cooper <ngie@FreeBSD.org>2017-06-28 08:48:09 +0000
commita5b450a49bc66a4d95320117399db1432dab6872 (patch)
tree39a39ec551b0e354cb0265a0b8c7f2b5ba521430
parent9a56205fc912cc30c498cd8ab536eef96373b16f (diff)
Notes
-rw-r--r--.gitignore19
-rw-r--r--.travis.yml19
-rw-r--r--AUTHORS3
-rw-r--r--COPYING27
-rw-r--r--ChangeLog0
-rw-r--r--Makefile.am5
-rw-r--r--NEWS0
-rw-r--r--README75
-rw-r--r--configure.ac107
-rw-r--r--pjdfstest.c543
-rw-r--r--tests/chflags/00.t1
-rw-r--r--tests/chflags/01.t7
-rw-r--r--tests/chflags/02.t1
-rw-r--r--tests/chflags/03.t1
-rw-r--r--tests/chflags/04.t1
-rw-r--r--tests/chflags/05.t1
-rw-r--r--tests/chflags/06.t1
-rw-r--r--tests/chflags/07.t1
-rw-r--r--tests/chflags/08.t1
-rw-r--r--tests/chflags/09.t1
-rw-r--r--tests/chflags/10.t1
-rw-r--r--tests/chflags/11.t1
-rw-r--r--tests/chflags/12.t11
-rw-r--r--tests/chflags/13.t1
-rw-r--r--tests/chmod/00.t1
-rw-r--r--tests/chmod/01.t1
-rw-r--r--tests/chmod/02.t19
-rw-r--r--tests/chmod/03.t19
-rw-r--r--tests/chmod/04.t1
-rw-r--r--tests/chmod/05.t1
-rw-r--r--tests/chmod/06.t1
-rw-r--r--tests/chmod/07.t1
-rw-r--r--tests/chmod/08.t1
-rw-r--r--tests/chmod/09.t9
-rw-r--r--tests/chmod/10.t1
-rw-r--r--tests/chmod/11.t11
-rw-r--r--tests/chmod/12.t1
-rw-r--r--tests/chown/00.t23
-rw-r--r--tests/chown/01.t1
-rw-r--r--tests/chown/02.t1
-rw-r--r--tests/chown/03.t1
-rw-r--r--tests/chown/04.t1
-rw-r--r--tests/chown/05.t1
-rw-r--r--tests/chown/06.t1
-rw-r--r--tests/chown/07.t1
-rw-r--r--tests/chown/08.t1
-rw-r--r--tests/chown/09.t9
-rw-r--r--tests/chown/10.t1
-rw-r--r--tests/conf34
-rw-r--r--tests/ftruncate/00.t3
-rw-r--r--tests/ftruncate/01.t1
-rw-r--r--tests/ftruncate/02.t1
-rw-r--r--tests/ftruncate/03.t1
-rw-r--r--tests/ftruncate/04.t1
-rw-r--r--tests/ftruncate/05.t1
-rw-r--r--tests/ftruncate/06.t1
-rw-r--r--tests/ftruncate/07.t1
-rw-r--r--tests/ftruncate/08.t1
-rw-r--r--tests/ftruncate/09.t1
-rw-r--r--tests/ftruncate/10.t9
-rw-r--r--tests/ftruncate/11.t2
-rw-r--r--tests/ftruncate/12.t1
-rw-r--r--tests/ftruncate/13.t1
-rw-r--r--tests/ftruncate/14.t1
-rw-r--r--tests/granular/00.t1
-rw-r--r--tests/granular/01.t1
-rw-r--r--tests/granular/02.t1
-rw-r--r--tests/granular/03.t1
-rw-r--r--tests/granular/04.t40
-rw-r--r--tests/granular/05.t1
-rw-r--r--tests/link/00.t1
-rw-r--r--tests/link/01.t1
-rw-r--r--tests/link/02.t1
-rw-r--r--tests/link/03.t1
-rw-r--r--tests/link/04.t1
-rw-r--r--tests/link/05.t9
-rw-r--r--tests/link/06.t1
-rw-r--r--tests/link/07.t1
-rw-r--r--tests/link/08.t1
-rw-r--r--tests/link/09.t1
-rw-r--r--tests/link/10.t1
-rw-r--r--tests/link/11.t1
-rw-r--r--tests/link/12.t30
-rw-r--r--tests/link/13.t1
-rw-r--r--tests/link/14.t9
-rw-r--r--tests/link/15.t9
-rw-r--r--tests/link/16.t9
-rw-r--r--tests/link/17.t1
-rwxr-xr-xtests/misc.sh134
-rw-r--r--tests/mkdir/00.t1
-rw-r--r--tests/mkdir/01.t1
-rw-r--r--tests/mkdir/02.t1
-rw-r--r--tests/mkdir/03.t1
-rw-r--r--tests/mkdir/04.t1
-rw-r--r--tests/mkdir/05.t1
-rw-r--r--tests/mkdir/06.t1
-rw-r--r--tests/mkdir/07.t1
-rw-r--r--tests/mkdir/08.t1
-rw-r--r--tests/mkdir/09.t9
-rw-r--r--tests/mkdir/10.t1
-rw-r--r--tests/mkdir/11.t9
-rw-r--r--tests/mkdir/12.t1
-rw-r--r--tests/mkfifo/00.t1
-rw-r--r--tests/mkfifo/01.t1
-rw-r--r--tests/mkfifo/02.t1
-rw-r--r--tests/mkfifo/03.t1
-rw-r--r--tests/mkfifo/04.t1
-rw-r--r--tests/mkfifo/05.t1
-rw-r--r--tests/mkfifo/06.t1
-rw-r--r--tests/mkfifo/07.t1
-rw-r--r--tests/mkfifo/08.t9
-rw-r--r--tests/mkfifo/09.t1
-rw-r--r--tests/mkfifo/10.t1
-rw-r--r--tests/mkfifo/11.t9
-rw-r--r--tests/mkfifo/12.t1
-rw-r--r--tests/mknod/00.t3
-rw-r--r--tests/mknod/01.t1
-rw-r--r--tests/mknod/02.t1
-rw-r--r--tests/mknod/03.t1
-rw-r--r--tests/mknod/04.t3
-rw-r--r--tests/mknod/05.t1
-rw-r--r--tests/mknod/06.t1
-rw-r--r--tests/mknod/07.t1
-rw-r--r--tests/mknod/08.t1
-rw-r--r--tests/mknod/09.t1
-rw-r--r--tests/mknod/10.t1
-rw-r--r--tests/mknod/11.t1
-rw-r--r--tests/open/00.t1
-rw-r--r--tests/open/01.t1
-rw-r--r--tests/open/02.t1
-rw-r--r--tests/open/03.t1
-rw-r--r--tests/open/04.t1
-rw-r--r--tests/open/05.t1
-rw-r--r--tests/open/06.t1
-rw-r--r--tests/open/07.t1
-rw-r--r--tests/open/08.t1
-rw-r--r--tests/open/09.t1
-rw-r--r--tests/open/10.t1
-rw-r--r--tests/open/11.t1
-rw-r--r--tests/open/12.t1
-rw-r--r--tests/open/13.t1
-rw-r--r--tests/open/14.t9
-rw-r--r--tests/open/15.t9
-rw-r--r--tests/open/16.t18
-rw-r--r--tests/open/17.t1
-rw-r--r--tests/open/18.t1
-rw-r--r--tests/open/19.t9
-rw-r--r--tests/open/20.t2
-rw-r--r--tests/open/21.t1
-rw-r--r--tests/open/22.t1
-rw-r--r--tests/open/23.t1
-rw-r--r--tests/open/24.t25
-rw-r--r--tests/rename/00.t1
-rw-r--r--tests/rename/01.t1
-rw-r--r--tests/rename/02.t1
-rw-r--r--tests/rename/03.t1
-rw-r--r--tests/rename/04.t1
-rw-r--r--tests/rename/05.t1
-rw-r--r--tests/rename/06.t1
-rw-r--r--tests/rename/07.t1
-rw-r--r--tests/rename/08.t1
-rw-r--r--tests/rename/09.t1
-rw-r--r--tests/rename/10.t1
-rw-r--r--tests/rename/11.t1
-rw-r--r--tests/rename/12.t1
-rw-r--r--tests/rename/13.t1
-rw-r--r--tests/rename/14.t1
-rw-r--r--tests/rename/15.t9
-rw-r--r--tests/rename/16.t9
-rw-r--r--tests/rename/17.t1
-rw-r--r--tests/rename/18.t1
-rw-r--r--tests/rename/19.t1
-rw-r--r--tests/rename/20.t1
-rw-r--r--tests/rename/21.t1
-rw-r--r--tests/rmdir/00.t1
-rw-r--r--tests/rmdir/01.t1
-rw-r--r--tests/rmdir/02.t1
-rw-r--r--tests/rmdir/03.t1
-rw-r--r--tests/rmdir/04.t1
-rw-r--r--tests/rmdir/05.t1
-rw-r--r--tests/rmdir/06.t1
-rw-r--r--tests/rmdir/07.t1
-rw-r--r--tests/rmdir/08.t1
-rw-r--r--tests/rmdir/09.t1
-rw-r--r--tests/rmdir/10.t1
-rw-r--r--tests/rmdir/11.t1
-rw-r--r--tests/rmdir/12.t1
-rw-r--r--tests/rmdir/13.t9
-rw-r--r--tests/rmdir/14.t9
-rw-r--r--tests/rmdir/15.t1
-rw-r--r--tests/symlink/00.t1
-rw-r--r--tests/symlink/01.t1
-rw-r--r--tests/symlink/02.t1
-rw-r--r--tests/symlink/03.t1
-rw-r--r--tests/symlink/04.t1
-rw-r--r--tests/symlink/05.t1
-rw-r--r--tests/symlink/06.t1
-rw-r--r--tests/symlink/07.t1
-rw-r--r--tests/symlink/08.t1
-rw-r--r--tests/symlink/09.t1
-rw-r--r--tests/symlink/10.t9
-rw-r--r--tests/symlink/11.t9
-rw-r--r--tests/symlink/12.t1
-rw-r--r--tests/truncate/00.t1
-rw-r--r--tests/truncate/01.t1
-rw-r--r--tests/truncate/02.t1
-rw-r--r--tests/truncate/03.t1
-rw-r--r--tests/truncate/04.t1
-rw-r--r--tests/truncate/05.t1
-rw-r--r--tests/truncate/06.t1
-rw-r--r--tests/truncate/07.t1
-rw-r--r--tests/truncate/08.t1
-rw-r--r--tests/truncate/09.t1
-rw-r--r--tests/truncate/10.t9
-rw-r--r--tests/truncate/11.t2
-rw-r--r--tests/truncate/12.t1
-rw-r--r--tests/truncate/13.t1
-rw-r--r--tests/truncate/14.t1
-rw-r--r--tests/unlink/00.t1
-rw-r--r--tests/unlink/01.t1
-rw-r--r--tests/unlink/02.t1
-rw-r--r--tests/unlink/03.t1
-rw-r--r--tests/unlink/04.t1
-rw-r--r--tests/unlink/05.t1
-rw-r--r--tests/unlink/06.t1
-rw-r--r--tests/unlink/07.t1
-rw-r--r--tests/unlink/08.t1
-rw-r--r--tests/unlink/09.t1
-rw-r--r--tests/unlink/10.t1
-rw-r--r--tests/unlink/11.t1
-rw-r--r--tests/unlink/12.t9
-rw-r--r--tests/unlink/13.t1
-rw-r--r--tests/utimensat/00.t36
-rw-r--r--tests/utimensat/01.t56
-rw-r--r--tests/utimensat/02.t35
-rw-r--r--tests/utimensat/03.t39
-rw-r--r--tests/utimensat/04.t36
-rw-r--r--tests/utimensat/05.t53
-rw-r--r--tests/utimensat/06.t45
-rw-r--r--tests/utimensat/07.t51
-rw-r--r--tests/utimensat/08.t40
-rw-r--r--tests/utimensat/09.t35
-rwxr-xr-xtravis/build.sh8
-rwxr-xr-xtravis/test.sh29
244 files changed, 1640 insertions, 387 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000000..852005fb569ea
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,19 @@
+autom4te.cache
+aclocal.m4
+compile
+configure
+config.h*
+config.guess
+config.log
+config.status
+config.sub
+depcomp
+install-sh
+missing
+pjdfstest
+stamp-h1
+INSTALL
+Makefile
+Makefile.in
+.deps
+*.o
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000000000..d29cd1e2fb265
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,19 @@
+language: c
+sudo: required
+
+matrix:
+ include:
+ - os: linux
+ compiler: clang
+ dist: xenial
+ - os: linux
+ compiler: gcc
+ dist: xenial
+ - os: osx
+ compiler: clang
+ - os: osx
+ compiler: gcc
+
+script:
+ - ./travis/build.sh
+ - ./travis/test.sh
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000000000..ff78a21e5b17c
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,3 @@
+* Alan Somers <asomers@FreeBSD.org> - contributor/co-maintainer
+* Ngie Cooper <ngie@FreeBSD.org> - contributor/co-maintainer
+* Pawel Jakub Dawidek <pawel@dawidek.net> - pjdfstest author/maintainer
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000000000..f91e71b37bf44
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,27 @@
+$FreeBSD: head/tools/regression/pjdfstest/LICENSE 211354 2010-08-15 21:29:03Z pjd $
+
+License for all regression tests available with pjdfstest:
+
+Copyright (c) 2006-2012 Pawel Jakub Dawidek <pawel@dawidek.net>
+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 AUTHORS 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 AUTHORS 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.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000000000..e69de29bb2d1d
--- /dev/null
+++ b/ChangeLog
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000000000..65e77496cf4a0
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,5 @@
+AM_CFLAGS= -Wall -Werror
+
+bin_PROGRAMS= pjdfstest
+
+pjdfstest_SOURCES= pjdfstest.c
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000000000..e69de29bb2d1d
--- /dev/null
+++ b/NEWS
diff --git a/README b/README
index dcc5a64ba3f41..75177f13da42a 100644
--- a/README
+++ b/README
@@ -1,22 +1,57 @@
$FreeBSD: head/tools/regression/pjdfstest/README 211354 2010-08-15 21:29:03Z pjd $
-Few notes on how to use pjdfstest in short steps:
-
- # cd pjdfstest
- # vi tests/conf
- Change 'fs' to file system type you want to test (UFS or ZFS).
- # vi Makefile
- You need to manually tweak few things by editing CFLAGS lines
- at the top of the file.
- # make
- It will compile pjdfstest utility which is used by regression tests.
- # cd /path/to/file/system/you/want/to/test/
- # prove -r /path/to/pjdfstest/tests
-
-That's all. Enjoy.
-
-Currently supported operating systems: FreeBSD, Solaris.
-Currently supported file system types: UFS, ZFS.
-
---
-Pawel Jakub Dawidek <pawel@dawidek.net>
+============
+Introduction
+============
+
+pjdfstest is a test suite that helps exercise POSIX system calls.
+
+pjdfstest supports the following operating systems/filesystems:
+
+- Supported Operating Systems: FreeBSD, Linux, Solaris
+- Supported Filesystems: ext4, UFS, ZFS
+
+==================
+Building pjdfstest
+==================
+
+-------------
+Prerequisites
+-------------
+
+- autoconf 2.69 or newer
+- automake 1.15 or newer
+- cc (clang or gcc)
+- make
+- appropriate system headers (please install your distribution appropriate
+ header package)
+
+---------
+Procedure
+---------
+
+ $ autoreconf -ifs
+ $ ./configure
+ $ make pjdfstest
+
+=================
+Running pjdfstest
+=================
+
+-------------
+Prerequisites
+-------------
+- You must be root when running these testcases.
+
+----------------------
+Software Prerequisites
+----------------------
+- perl
+- TAP-Harness (perl package)
+
+---------
+Procedure
+---------
+
+ # cd /path/to/filesystem/under/test
+ # prove -rv /path/to/pjdfstest/tests
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000000000..df0b94572c045
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,107 @@
+AC_PREREQ(2.61)
+AC_INIT([pjdfstest],[0.1],)
+AC_CONFIG_AUX_DIR([.])
+AM_INIT_AUTOMAKE
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_FILES([ \
+ Makefile \
+])
+
+AC_CANONICAL_HOST
+
+AC_PROG_CC([cc])
+
+# For _GNU_SOURCE on Linux, etc.
+AC_USE_SYSTEM_EXTENSIONS
+
+AC_CHECK_HEADERS([ \
+ sys/mkdev.h \
+])
+
+#HAS_FREEBSD_ACL
+
+AC_CHECK_FUNC([bindat],
+ [AC_DEFINE([HAVE_BINDAT], [1], [Define if bindat exists])])
+AC_CHECK_FUNC([chflags],
+ [AC_DEFINE([HAVE_CHFLAGS], [1], [Define if chflags exists])])
+AC_CHECK_FUNC([chflagsat],
+ [AC_DEFINE([HAVE_CHFLAGSAT], [1], [Define if chflagsat exists])])
+AC_CHECK_FUNC([connectat],
+ [AC_DEFINE([HAVE_CONNECTAT], [1], [Define if connectat exists])])
+AC_CHECK_FUNC([faccessat],
+ [AC_DEFINE([HAVE_FACCESSAT], [1], [Define if faccessat exists])])
+AC_CHECK_FUNC([fchflags],
+ [AC_DEFINE([HAVE_FCHFLAGS], [1], [Define if fchflags exists])])
+AC_CHECK_FUNC([fchmodat],
+ [AC_DEFINE([HAVE_FCHMODAT], [1], [Define if fchmodat exists])])
+AC_CHECK_FUNC([fchownat],
+ [AC_DEFINE([HAVE_FCHOWNAT], [1], [Define if fchownat exists])])
+AC_CHECK_FUNC([fstatat],
+ [AC_DEFINE([HAVE_FSTATAT], [1], [Define if fstatat exists])])
+AC_CHECK_FUNC([lchflags],
+ [AC_DEFINE([HAVE_LCHFLAGS], [1], [Define if lchflags exists])])
+AC_CHECK_FUNC([lchmod],
+ [AC_DEFINE([HAVE_LCHMOD], [1], [Define if lchmod exists])])
+AC_CHECK_FUNC([linkat],
+ [AC_DEFINE([HAVE_LINKAT], [1], [Define if linkat exists])])
+AC_CHECK_FUNC([lpathconf],
+ [AC_DEFINE([HAVE_LPATHCONF], [1], [Define if lpathconf exists])])
+AC_CHECK_FUNC([mkdirat],
+ [AC_DEFINE([HAVE_MKDIRAT], [1], [Define if mkdirat exists])])
+AC_CHECK_FUNC([mkfifoat],
+ [AC_DEFINE([HAVE_MKFIFOAT], [1], [Define if mkfifoat exists])])
+AC_CHECK_FUNC([mknodat],
+ [AC_DEFINE([HAVE_MKNODAT], [1], [Define if mknodat exists])])
+AC_CHECK_FUNC([openat],
+ [AC_DEFINE([HAVE_OPENAT], [1], [Define if openat exists])])
+AC_CHECK_FUNC([posix_fallocate],
+ [AC_DEFINE([HAVE_POSIX_FALLOCATE], [1], [Define if posix_fallocate exists])])
+AC_CHECK_FUNC([readlinkat],
+ [AC_DEFINE([HAVE_READLINKAT], [1], [Define if readlinkat exists])])
+AC_CHECK_FUNC([renameat],
+ [AC_DEFINE([HAVE_RENAMEAT], [1], [Define if renameat exists])])
+AC_CHECK_FUNC([symlinkat],
+ [AC_DEFINE([HAVE_SYMLINKAT], [1], [Define if symlinkat exists])])
+AC_CHECK_FUNC([utimensat],
+ [AC_DEFINE([HAVE_UTIMENSAT], [1], [Define if utimensat exists])])
+
+# ACL test battery.
+AC_CHECK_HEADER([sys/acl.h], [has_sys_acl_h=yes], [has_sys_acl_h=no])
+has_acl_funcs=no
+if test x$has_sys_acl_h = xyes; then
+ AC_DEFINE([HAVE_SYS_ACL_H], [1],
+ [Define to 1 if sys/acl.h is available])
+ AC_CHECK_FUNCS([acl_create_entry_np acl_from_text acl_get_entry acl_get_file acl_set_file],
+ [has_acl_funcs=yes],[])
+fi
+if test x$has_acl_funcs = xyes; then
+ # Check for NFSv4 ACL support.
+ AC_CHECK_DECL([ACL_TYPE_NFS4],
+ [has_nfsv4_acl_support=yes], [has_nfsv4_acl_support=no],[[#include <sys/acl.h>]])
+ if test x$has_nfsv4_acl_support = xyes; then
+ AC_DEFINE([HAS_NFSV4_ACL_SUPPORT], [1],
+ [Define to 1 if NFSv4 ACL support is available])
+ fi
+fi
+
+AC_CHECK_MEMBERS([struct stat.st_atim, struct stat.st_atimespec], [], [], [[
+#include <sys/types.h>
+#include <sys/stat.h>
+]])
+
+AC_CHECK_MEMBERS([struct stat.st_birthtim, struct stat.st_birthtime, struct stat.st_birthtimespec], [], [], [[
+#include <sys/types.h>
+#include <sys/stat.h>
+]])
+
+AC_CHECK_MEMBERS([struct stat.st_ctim, struct stat.st_ctimespec], [], [], [[
+#include <sys/types.h>
+#include <sys/stat.h>
+]])
+
+AC_CHECK_MEMBERS([struct stat.st_mtim, struct stat.st_mtimespec], [], [], [[
+#include <sys/types.h>
+#include <sys/stat.h>
+]])
+
+AC_OUTPUT
diff --git a/pjdfstest.c b/pjdfstest.c
index 046df490e4f76..dffaa2f5d517a 100644
--- a/pjdfstest.c
+++ b/pjdfstest.c
@@ -26,14 +26,19 @@
* $FreeBSD$
*/
+/* Needs to be first to twiddle appropriate system configuration/HAVE_* flags */
+#include "config.h"
+
#include <sys/param.h>
-#include <sys/types.h>
+#ifdef HAVE_SYS_ACL_H
+#include <sys/acl.h>
+#endif
+#ifdef HAVE_SYS_MKDEV_H
+#include <sys/mkdev.h>
+#endif
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/un.h>
-#ifndef makedev
-#include <sys/mkdev.h>
-#endif
#include <assert.h>
#include <ctype.h>
@@ -45,17 +50,14 @@
#include <string.h>
#include <unistd.h>
-#ifndef HAS_TRUNCATE64
-#define truncate64 truncate
-#define ftruncate64 ftruncate
+#ifdef __sun__
+#define _USE_STAT64
#endif
-#ifndef HAS_STAT64
-#define stat64 stat
-#define fstat64 fstat
-#define lstat64 lstat
-#endif
-#ifdef HAS_FREEBSD_ACL
-#include <sys/acl.h>
+
+#ifdef _USE_STAT64
+typedef struct stat64 stat_t;
+#else
+typedef struct stat stat_t;
#endif
#ifndef ALLPERMS
@@ -64,69 +66,91 @@
enum action {
ACTION_OPEN,
+#ifdef HAVE_OPENAT
ACTION_OPENAT,
+#endif
ACTION_CREATE,
ACTION_UNLINK,
+#ifdef HAVE_UNLINKAT
ACTION_UNLINKAT,
+#endif
ACTION_MKDIR,
+#ifdef HAVE_MKDIRAT
ACTION_MKDIRAT,
+#endif
ACTION_RMDIR,
ACTION_LINK,
+#ifdef HAVE_LINKAT
ACTION_LINKAT,
+#endif
ACTION_SYMLINK,
+#ifdef HAVE_SYMLINKAT
ACTION_SYMLINKAT,
+#endif
ACTION_RENAME,
+#ifdef HAVE_RENAMEAT
ACTION_RENAMEAT,
+#endif
ACTION_MKFIFO,
+#ifdef HAVE_MKFIFOAT
ACTION_MKFIFOAT,
+#endif
ACTION_MKNOD,
ACTION_MKNODAT,
ACTION_BIND,
-#ifdef HAS_BINDAT
+#ifdef HAVE_BINDAT
ACTION_BINDAT,
#endif
ACTION_CONNECT,
-#ifdef HAS_CONNECTAT
+#ifdef HAVE_CONNECTAT
ACTION_CONNECTAT,
#endif
ACTION_CHMOD,
ACTION_FCHMOD,
-#ifdef HAS_LCHMOD
+#ifdef HAVE_LCHMOD
ACTION_LCHMOD,
#endif
ACTION_FCHMODAT,
ACTION_CHOWN,
ACTION_FCHOWN,
ACTION_LCHOWN,
+#ifdef HAVE_FCHOWNAT
ACTION_FCHOWNAT,
-#ifdef HAS_CHFLAGS
+#endif
+#ifdef HAVE_CHFLAGS
ACTION_CHFLAGS,
#endif
-#ifdef HAS_FCHFLAGS
+#ifdef HAVE_FCHFLAGS
ACTION_FCHFLAGS,
#endif
-#ifdef HAS_CHFLAGSAT
+#ifdef HAVE_CHFLAGSAT
ACTION_CHFLAGSAT,
#endif
-#ifdef HAS_LCHFLAGS
+#ifdef HAVE_LCHFLAGS
ACTION_LCHFLAGS,
#endif
ACTION_TRUNCATE,
ACTION_FTRUNCATE,
+#ifdef HAVE_POSIX_FALLOCATE
+ ACTION_POSIX_FALLOCATE,
+#endif
ACTION_STAT,
ACTION_FSTAT,
ACTION_LSTAT,
ACTION_FSTATAT,
ACTION_PATHCONF,
ACTION_FPATHCONF,
-#ifdef HAS_LPATHCONF
+#ifdef HAVE_LPATHCONF
ACTION_LPATHCONF,
#endif
-#ifdef HAS_FREEBSD_ACL
+#ifdef HAS_NFSV4_ACL_SUPPORT
ACTION_PREPENDACL,
ACTION_READACL,
#endif
ACTION_WRITE,
+#ifdef HAVE_UTIMENSAT
+ ACTION_UTIMENSAT,
+#endif
};
#define TYPE_NONE 0x0000
@@ -147,69 +171,104 @@ struct syscall_desc {
static struct syscall_desc syscalls[] = {
{ "open", ACTION_OPEN, { TYPE_STRING, TYPE_STRING, TYPE_NUMBER | TYPE_OPTIONAL, TYPE_NONE } },
+#ifdef HAVE_OPENAT
{ "openat", ACTION_OPENAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_NUMBER | TYPE_OPTIONAL, TYPE_NONE } },
+#endif
{ "create", ACTION_CREATE, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } },
{ "unlink", ACTION_UNLINK, { TYPE_STRING, TYPE_NONE } },
+#ifdef HAVE_UNLINKAT
{ "unlinkat", ACTION_UNLINKAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_NONE } },
+#endif
{ "mkdir", ACTION_MKDIR, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } },
+#ifdef HAVE_MKDIRAT
{ "mkdirat", ACTION_MKDIRAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NUMBER, TYPE_NONE } },
+#endif
{ "rmdir", ACTION_RMDIR, { TYPE_STRING, TYPE_NONE } },
{ "link", ACTION_LINK, { TYPE_STRING, TYPE_STRING, TYPE_NONE } },
+#ifdef HAVE_LINKAT
{ "linkat", ACTION_LINKAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_NONE } },
+#endif
{ "symlink", ACTION_SYMLINK, { TYPE_STRING, TYPE_STRING, TYPE_NONE } },
+#ifdef HAVE_SYMLINKAT
{ "symlinkat", ACTION_SYMLINKAT, { TYPE_STRING, TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } },
+#endif
{ "rename", ACTION_RENAME, { TYPE_STRING, TYPE_STRING, TYPE_NONE } },
+#ifdef HAVE_RENAMEAT
{ "renameat", ACTION_RENAMEAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } },
+#endif
{ "mkfifo", ACTION_MKFIFO, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } },
+#ifdef HAVE_MKFIFOAT
{ "mkfifoat", ACTION_MKFIFOAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NUMBER, TYPE_NONE } },
+#endif
{ "mknod", ACTION_MKNOD, { TYPE_STRING, TYPE_STRING, TYPE_NUMBER, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE} },
+#ifdef HAVE_MKNODAT
{ "mknodat", ACTION_MKNODAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_NUMBER, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE} },
+#endif
{ "bind", ACTION_BIND, { TYPE_STRING, TYPE_NONE } },
-#ifdef HAS_BINDAT
+#ifdef HAVE_BINDAT
{ "bindat", ACTION_BINDAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } },
#endif
{ "connect", ACTION_CONNECT, { TYPE_STRING, TYPE_NONE } },
-#ifdef HAS_CONNECTAT
+#ifdef HAVE_CONNECTAT
{ "connectat", ACTION_CONNECTAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } },
#endif
{ "chmod", ACTION_CHMOD, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } },
{ "fchmod", ACTION_FCHMOD, { TYPE_DESCRIPTOR, TYPE_NUMBER, TYPE_NONE } },
-#ifdef HAS_LCHMOD
+#ifdef HAVE_LCHMOD
{ "lchmod", ACTION_LCHMOD, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } },
#endif
+#ifdef HAVE_FCHMODAT
{ "fchmodat", ACTION_FCHMODAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NUMBER, TYPE_STRING, TYPE_NONE } },
+#endif
{ "chown", ACTION_CHOWN, { TYPE_STRING, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE } },
{ "fchown", ACTION_FCHOWN, { TYPE_DESCRIPTOR, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE } },
{ "lchown", ACTION_LCHOWN, { TYPE_STRING, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE } },
+#ifdef HAVE_FCHOWNAT
{ "fchownat", ACTION_FCHOWNAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NUMBER, TYPE_NUMBER, TYPE_STRING, TYPE_NONE } },
-#ifdef HAS_CHFLAGS
+#endif
+#ifdef HAVE_CHFLAGS
{ "chflags", ACTION_CHFLAGS, { TYPE_STRING, TYPE_STRING, TYPE_NONE } },
#endif
-#ifdef HAS_FCHFLAGS
+#ifdef HAVE_FCHFLAGS
{ "fchflags", ACTION_FCHFLAGS, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } },
#endif
-#ifdef HAS_CHFLAGSAT
+#ifdef HAVE_CHFLAGSAT
{ "chflagsat", ACTION_CHFLAGSAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_NONE } },
#endif
-#ifdef HAS_LCHFLAGS
+#ifdef HAVE_LCHFLAGS
{ "lchflags", ACTION_LCHFLAGS, { TYPE_STRING, TYPE_STRING, TYPE_NONE } },
#endif
{ "truncate", ACTION_TRUNCATE, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } },
{ "ftruncate", ACTION_FTRUNCATE, { TYPE_DESCRIPTOR, TYPE_NUMBER, TYPE_NONE } },
+#ifdef HAVE_POSIX_FALLOCATE
+ { "posix_fallocate", ACTION_POSIX_FALLOCATE, { TYPE_DESCRIPTOR, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE } },
+#endif
{ "stat", ACTION_STAT, { TYPE_STRING, TYPE_STRING, TYPE_NONE } },
{ "fstat", ACTION_FSTAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } },
{ "lstat", ACTION_LSTAT, { TYPE_STRING, TYPE_STRING, TYPE_NONE } },
+#ifdef HAVE_FSTATAT
{ "fstatat", ACTION_FSTATAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_NONE } },
+#endif
{ "pathconf", ACTION_PATHCONF, { TYPE_STRING, TYPE_STRING, TYPE_NONE } },
{ "fpathconf", ACTION_FPATHCONF, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } },
-#ifdef HAS_LPATHCONF
+#ifdef HAVE_LPATHCONF
{ "lpathconf", ACTION_LPATHCONF, { TYPE_STRING, TYPE_STRING, TYPE_NONE } },
#endif
-#ifdef HAS_FREEBSD_ACL
+#ifdef HAS_NFSV4_ACL_SUPPORT
{ "prependacl", ACTION_PREPENDACL, { TYPE_STRING, TYPE_STRING, TYPE_NONE } },
{ "readacl", ACTION_READACL, { TYPE_STRING, TYPE_NONE } },
#endif
{ "write", ACTION_WRITE, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } },
+#ifdef HAVE_UTIMENSAT
+ { "utimensat", ACTION_UTIMENSAT, {
+ TYPE_DESCRIPTOR, /* Directory */
+ TYPE_STRING, /* Relative path */
+ TYPE_NUMBER, /* atime seconds */
+ TYPE_STRING, /* atime nanoseconds */
+ TYPE_NUMBER, /* mtime seconds */
+ TYPE_STRING, /* mtime nanoseconds */
+ TYPE_STRING, /* flags */}},
+#endif
{ NULL, -1, { TYPE_NONE } }
};
@@ -219,122 +278,136 @@ struct flag {
};
static struct flag open_flags[] = {
-#ifdef O_RDONLY
+#ifdef O_RDONLY
{ O_RDONLY, "O_RDONLY" },
#endif
-#ifdef O_WRONLY
+#ifdef O_WRONLY
{ O_WRONLY, "O_WRONLY" },
#endif
-#ifdef O_RDWR
+#ifdef O_RDWR
{ O_RDWR, "O_RDWR" },
#endif
-#ifdef O_NONBLOCK
+#ifdef O_NONBLOCK
{ O_NONBLOCK, "O_NONBLOCK" },
#endif
-#ifdef O_APPEND
+#ifdef O_APPEND
{ O_APPEND, "O_APPEND" },
#endif
-#ifdef O_CREAT
+#ifdef O_CREAT
{ O_CREAT, "O_CREAT" },
#endif
-#ifdef O_TRUNC
+#ifdef O_TRUNC
{ O_TRUNC, "O_TRUNC" },
#endif
-#ifdef O_EXCL
+#ifdef O_EXCL
{ O_EXCL, "O_EXCL" },
#endif
-#ifdef O_SHLOCK
+#ifdef O_SHLOCK
{ O_SHLOCK, "O_SHLOCK" },
#endif
-#ifdef O_EXLOCK
+#ifdef O_EXLOCK
{ O_EXLOCK, "O_EXLOCK" },
#endif
-#ifdef O_DIRECT
+#ifdef O_DIRECT
{ O_DIRECT, "O_DIRECT" },
#endif
-#ifdef O_FSYNC
+#ifdef O_FSYNC
{ O_FSYNC, "O_FSYNC" },
#endif
-#ifdef O_SYNC
+#ifdef O_SYNC
{ O_SYNC, "O_SYNC" },
#endif
-#ifdef O_NOFOLLOW
+#ifdef O_NOFOLLOW
{ O_NOFOLLOW, "O_NOFOLLOW" },
#endif
-#ifdef O_NOCTTY
+#ifdef O_NOCTTY
{ O_NOCTTY, "O_NOCTTY" },
#endif
-#ifdef O_DIRECTORY
+#ifdef O_DIRECTORY
{ O_DIRECTORY, "O_DIRECTORY" },
#endif
{ 0, NULL }
};
-#ifdef HAS_CHFLAGS
+#ifdef HAVE_CHFLAGS
static struct flag chflags_flags[] = {
-#ifdef UF_NODUMP
+#ifdef UF_NODUMP
{ UF_NODUMP, "UF_NODUMP" },
#endif
-#ifdef UF_IMMUTABLE
+#ifdef UF_IMMUTABLE
{ UF_IMMUTABLE, "UF_IMMUTABLE" },
#endif
-#ifdef UF_APPEND
+#ifdef UF_APPEND
{ UF_APPEND, "UF_APPEND" },
#endif
-#ifdef UF_NOUNLINK
+#ifdef UF_NOUNLINK
{ UF_NOUNLINK, "UF_NOUNLINK" },
#endif
-#ifdef UF_OPAQUE
+#ifdef UF_OPAQUE
{ UF_OPAQUE, "UF_OPAQUE" },
#endif
-#ifdef SF_ARCHIVED
+#ifdef SF_ARCHIVED
{ SF_ARCHIVED, "SF_ARCHIVED" },
#endif
-#ifdef SF_IMMUTABLE
+#ifdef SF_IMMUTABLE
{ SF_IMMUTABLE, "SF_IMMUTABLE" },
#endif
-#ifdef SF_APPEND
+#ifdef SF_APPEND
{ SF_APPEND, "SF_APPEND" },
#endif
-#ifdef SF_NOUNLINK
+#ifdef SF_NOUNLINK
{ SF_NOUNLINK, "SF_NOUNLINK" },
#endif
-#ifdef SF_SNAPSHOT
+#ifdef SF_SNAPSHOT
{ SF_SNAPSHOT, "SF_SNAPSHOT" },
#endif
{ 0, NULL }
};
#endif
+#ifdef HAVE_UNLINKAT
static struct flag unlinkat_flags[] = {
{ AT_REMOVEDIR, "AT_REMOVEDIR" },
{ 0, NULL }
};
+#endif
+#ifdef HAVE_LINKAT
static struct flag linkat_flags[] = {
+#ifdef AT_SYMLINK_FOLLOW
{ AT_SYMLINK_FOLLOW, "AT_SYMLINK_FOLLOW" },
+#endif
{ 0, NULL }
};
+#endif
+#ifdef HAVE_CHFLAGSAT
static struct flag chflagsat_flags[] = {
{ AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" },
{ 0, NULL }
};
+#endif
+#ifdef HAVE_FCHMODAT
static struct flag fchmodat_flags[] = {
{ AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" },
{ 0, NULL }
};
+#endif
+#ifdef HAVE_FCHOWNAT
static struct flag fchownat_flags[] = {
{ AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" },
{ 0, NULL }
};
+#endif
+#ifdef HAVE_FSTATAT
static struct flag fstatat_flags[] = {
{ AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" },
{ 0, NULL }
};
+#endif
struct name {
int n_name;
@@ -342,16 +415,16 @@ struct name {
};
static struct name pathconf_names[] = {
-#ifdef _PC_LINK_MAX
+#ifdef _PC_LINK_MAX
{ _PC_LINK_MAX, "_PC_LINK_MAX" },
#endif
-#ifdef _PC_NAME_MAX
+#ifdef _PC_NAME_MAX
{ _PC_NAME_MAX, "_PC_NAME_MAX" },
#endif
-#ifdef _PC_PATH_MAX
+#ifdef _PC_PATH_MAX
{ _PC_PATH_MAX, "_PC_PATH_MAX" },
#endif
-#ifdef _PC_SYMLINK_MAX
+#ifdef _PC_SYMLINK_MAX
{ _PC_SYMLINK_MAX, "_PC_SYMLINK_MAX" },
#endif
{ 0, NULL }
@@ -394,7 +467,7 @@ str2flags(struct flag *tflags, char *sflags)
return (flags);
}
-#ifdef HAS_CHFLAGS
+#ifdef HAVE_CHFLAGS
static char *
flags2str(struct flag *tflags, long long flags)
{
@@ -440,7 +513,7 @@ find_syscall(const char *name)
}
static void
-show_stat(struct stat64 *sp, const char *what)
+show_stat(stat_t *sp, const char *what)
{
if (strcmp(what, "mode") == 0)
@@ -459,11 +532,51 @@ show_stat(struct stat64 *sp, const char *what)
printf("%lld", (long long)sp->st_blocks);
else if (strcmp(what, "atime") == 0)
printf("%lld", (long long)sp->st_atime);
- else if (strcmp(what, "mtime") == 0)
- printf("%lld", (long long)sp->st_mtime);
+#if defined(HAVE_STRUCT_STAT_ST_ATIM) || \
+ defined(HAVE_STRUCT_STAT_ST_ATIMESPEC)
+ else if (strcmp(what, "atime_ns") == 0)
+#ifdef HAVE_STRUCT_STAT_ST_ATIMESPEC
+ printf("%lld", (long long)sp->st_atimespec.tv_nsec);
+#else
+ printf("%lld", (long long)sp->st_atim.tv_nsec);
+#endif
+#endif /* st_atim* */
else if (strcmp(what, "ctime") == 0)
printf("%lld", (long long)sp->st_ctime);
-#ifdef HAS_CHFLAGS
+#if defined(HAVE_STRUCT_STAT_ST_CTIM) || \
+ defined(HAVE_STRUCT_STAT_ST_CTIMESPEC)
+ else if (strcmp(what, "ctime_ns") == 0)
+#ifdef HAVE_STRUCT_STAT_ST_CTIMESPEC
+ printf("%lld", (long long)sp->st_ctimespec.tv_nsec);
+#else
+ printf("%lld", (long long)sp->st_ctim.tv_nsec);
+#endif
+#endif /* st_ctim* */
+ else if (strcmp(what, "mtime") == 0)
+ printf("%lld", (long long)sp->st_mtime);
+ else if (strcmp(what, "mtime_ns") == 0)
+#if defined(HAVE_STRUCT_STAT_ST_MTIM) || \
+ defined(HAVE_STRUCT_STAT_ST_MTIMESPEC)
+#ifdef HAVE_STRUCT_STAT_ST_MTIMESPEC
+ printf("%lld", (long long)sp->st_mtimespec.tv_nsec);
+#else
+ printf("%lld", (long long)sp->st_mtim.tv_nsec);
+#endif
+#endif /* st_mtim* */
+#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME
+ else if (strcmp(what, "birthtime") == 0)
+ printf("%lld", (long long)sp->st_birthtime);
+#endif /* st_birthtime */
+#if defined(HAVE_STRUCT_STAT_ST_BIRTHTIM) || \
+ defined(HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC)
+ else if (strcmp(what, "birthtime_ns") == 0)
+#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC
+ printf("%lld", (long long)sp->st_birthtimespec.tv_nsec);
+#else
+ printf("%lld", (long long)sp->st_birthtim.tv_nsec);
+#endif
+#endif /* st_birthtim{,espec} */
+#ifdef HAVE_CHFLAGS
else if (strcmp(what, "flags") == 0)
printf("%s", flags2str(chflags_flags, (long long)sp->st_flags));
#endif
@@ -504,7 +617,7 @@ show_stat(struct stat64 *sp, const char *what)
}
static void
-show_stats(struct stat64 *sp, char *what)
+show_stats(stat_t *sp, char *what)
{
const char *s = "";
char *w;
@@ -547,7 +660,11 @@ descriptor_get(int pos)
static unsigned int
call_syscall(struct syscall_desc *scall, char *argv[])
{
- struct stat64 sb;
+ stat_t sb;
+#ifdef HAVE_UTIMENSAT
+ struct timespec times[2];
+ int flag;
+#endif
long long flags;
unsigned int i;
char *endp;
@@ -556,7 +673,7 @@ call_syscall(struct syscall_desc *scall, char *argv[])
char *str;
long long num;
} args[MAX_ARGS];
-#ifdef HAS_FREEBSD_ACL
+#ifdef HAS_NFSV4_ACL_SUPPORT
int entry_id = ACL_FIRST_ENTRY;
acl_t acl, newacl;
acl_entry_t entry, newentry;
@@ -645,6 +762,7 @@ call_syscall(struct syscall_desc *scall, char *argv[])
if (rval >= 0)
descriptor_add(rval);
break;
+#ifdef HAVE_OPENAT
case ACTION_OPENAT:
flags = str2flags(open_flags, STR(2));
if (flags & O_CREAT) {
@@ -664,6 +782,7 @@ call_syscall(struct syscall_desc *scall, char *argv[])
if (rval >= 0)
descriptor_add(rval);
break;
+#endif
case ACTION_CREATE:
rval = open(STR(0), O_CREAT | O_EXCL, (mode_t)NUM(1));
if (rval >= 0)
@@ -672,46 +791,60 @@ call_syscall(struct syscall_desc *scall, char *argv[])
case ACTION_UNLINK:
rval = unlink(STR(0));
break;
+#ifdef HAVE_UNLINKAT
case ACTION_UNLINKAT:
rval = unlinkat(NUM(0), STR(1),
(int)str2flags(unlinkat_flags, STR(2)));
break;
+#endif
case ACTION_MKDIR:
rval = mkdir(STR(0), (mode_t)NUM(1));
break;
+#ifdef HAVE_MKDIRAT
case ACTION_MKDIRAT:
rval = mkdirat(NUM(0), STR(1), (mode_t)NUM(2));
break;
+#endif
case ACTION_RMDIR:
rval = rmdir(STR(0));
break;
case ACTION_LINK:
rval = link(STR(0), STR(1));
break;
+#ifdef HAVE_LINKAT
case ACTION_LINKAT:
rval = linkat(NUM(0), STR(1), NUM(2), STR(3),
(int)str2flags(linkat_flags, STR(4)));
break;
+#endif
case ACTION_SYMLINK:
rval = symlink(STR(0), STR(1));
break;
+#ifdef HAVE_SYMLINKAT
case ACTION_SYMLINKAT:
rval = symlinkat(STR(0), NUM(1), STR(2));
break;
+#endif
case ACTION_RENAME:
rval = rename(STR(0), STR(1));
break;
+#ifdef HAVE_RENAMEAT
case ACTION_RENAMEAT:
rval = renameat(NUM(0), STR(1), NUM(2), STR(3));
break;
+#endif
case ACTION_MKFIFO:
rval = mkfifo(STR(0), (mode_t)NUM(1));
break;
+#ifdef HAVE_MKFIFOAT
case ACTION_MKFIFOAT:
rval = mkfifoat(NUM(0), STR(1), (mode_t)NUM(2));
break;
+#endif
case ACTION_MKNOD:
+#ifdef HAVE_MKNODAT
case ACTION_MKNODAT:
+#endif
{
mode_t ntype;
dev_t dev;
@@ -721,9 +854,11 @@ call_syscall(struct syscall_desc *scall, char *argv[])
case ACTION_MKNOD:
fa = 0;
break;
+#ifdef HAVE_MKNODAT
case ACTION_MKNODAT:
fa = 1;
break;
+#endif
default:
abort();
}
@@ -747,9 +882,11 @@ call_syscall(struct syscall_desc *scall, char *argv[])
case ACTION_MKNOD:
rval = mknod(STR(0), ntype | NUM(2), dev);
break;
+#ifdef HAVE_MKNODAT
case ACTION_MKNODAT:
rval = mknodat(NUM(0), STR(1), ntype | NUM(3), dev);
break;
+#endif
default:
abort();
}
@@ -768,7 +905,7 @@ call_syscall(struct syscall_desc *scall, char *argv[])
rval = bind(rval, (struct sockaddr *)&sunx, sizeof(sunx));
break;
}
-#ifdef HAS_BINDAT
+#ifdef HAVE_BINDAT
case ACTION_BINDAT:
{
struct sockaddr_un sunx;
@@ -797,7 +934,7 @@ call_syscall(struct syscall_desc *scall, char *argv[])
rval = connect(rval, (struct sockaddr *)&sunx, sizeof(sunx));
break;
}
-#ifdef HAS_CONNECTAT
+#ifdef HAVE_CONNECTAT
case ACTION_CONNECTAT:
{
struct sockaddr_un sunx;
@@ -819,15 +956,17 @@ call_syscall(struct syscall_desc *scall, char *argv[])
case ACTION_FCHMOD:
rval = fchmod(NUM(0), (mode_t)NUM(1));
break;
-#ifdef HAS_LCHMOD
+#ifdef HAVE_LCHMOD
case ACTION_LCHMOD:
rval = lchmod(STR(0), (mode_t)NUM(1));
break;
#endif
+#ifdef HAVE_FCHMODAT
case ACTION_FCHMODAT:
rval = fchmodat(NUM(0), STR(1), (mode_t)NUM(2),
str2flags(fchmodat_flags, STR(3)));
break;
+#endif
case ACTION_CHOWN:
rval = chown(STR(0), (uid_t)NUM(1), (gid_t)NUM(2));
break;
@@ -837,62 +976,94 @@ call_syscall(struct syscall_desc *scall, char *argv[])
case ACTION_LCHOWN:
rval = lchown(STR(0), (uid_t)NUM(1), (gid_t)NUM(2));
break;
+#ifdef HAVE_FCHOWNAT
case ACTION_FCHOWNAT:
rval = fchownat(NUM(0), STR(1), (uid_t)NUM(2), (gid_t)NUM(3),
(int)str2flags(fchownat_flags, STR(4)));
break;
-#ifdef HAS_CHFLAGS
+#endif
+#ifdef HAVE_CHFLAGS
case ACTION_CHFLAGS:
rval = chflags(STR(0),
(unsigned long)str2flags(chflags_flags, STR(1)));
break;
#endif
-#ifdef HAS_FCHFLAGS
+#ifdef HAVE_FCHFLAGS
case ACTION_FCHFLAGS:
rval = fchflags(NUM(0),
(unsigned long)str2flags(chflags_flags, STR(1)));
break;
#endif
-#ifdef HAS_CHFLAGSAT
+#ifdef HAVE_CHFLAGSAT
case ACTION_CHFLAGSAT:
rval = chflagsat(NUM(0), STR(1),
(unsigned long)str2flags(chflags_flags, STR(2)),
(int)str2flags(chflagsat_flags, STR(3)));
break;
#endif
-#ifdef HAS_LCHFLAGS
+#ifdef HAVE_LCHFLAGS
case ACTION_LCHFLAGS:
rval = lchflags(STR(0),
(unsigned long)str2flags(chflags_flags, STR(1)));
break;
#endif
case ACTION_TRUNCATE:
+#ifdef _USE_STAT64
rval = truncate64(STR(0), NUM(1));
+#else
+ rval = truncate(STR(0), NUM(1));
+#endif
break;
case ACTION_FTRUNCATE:
+#ifdef _USE_STAT64
rval = ftruncate64(NUM(0), NUM(1));
+#else
+ rval = ftruncate(NUM(0), NUM(1));
+#endif
break;
+#ifdef HAVE_POSIX_FALLOCATE
+ case ACTION_POSIX_FALLOCATE:
+ rval = posix_fallocate(NUM(0), NUM(1), NUM(2));
+ if (rval != 0) {
+ errno = rval;
+ rval = -1;
+ }
+ break;
+#endif
case ACTION_STAT:
+#ifdef _USE_STAT64
rval = stat64(STR(0), &sb);
+#else
+ rval = stat(STR(0), &sb);
+#endif
if (rval == 0) {
show_stats(&sb, STR(1));
return (i);
}
break;
case ACTION_FSTAT:
+#ifdef _USE_STAT64
rval = fstat64(NUM(0), &sb);
+#else
+ rval = fstat(NUM(0), &sb);
+#endif
if (rval == 0) {
show_stats(&sb, STR(1));
return (i);
}
break;
case ACTION_LSTAT:
+#ifdef _USE_STAT64
rval = lstat64(STR(0), &sb);
+#else
+ rval = lstat(STR(0), &sb);
+#endif
if (rval == 0) {
show_stats(&sb, STR(1));
return (i);
}
break;
+#ifdef HAVE_FSTATAT
case ACTION_FSTATAT:
rval = fstatat(NUM(0), STR(1), &sb,
(int)str2flags(fstatat_flags, STR(2)));
@@ -901,9 +1072,10 @@ call_syscall(struct syscall_desc *scall, char *argv[])
return (i);
}
break;
+#endif
case ACTION_PATHCONF:
case ACTION_FPATHCONF:
-#ifdef HAS_LPATHCONF
+#ifdef HAVE_LPATHCONF
case ACTION_LPATHCONF:
#endif
{
@@ -922,7 +1094,7 @@ call_syscall(struct syscall_desc *scall, char *argv[])
case ACTION_FPATHCONF:
lrval = fpathconf(NUM(0), name);
break;
-#ifdef HAS_LPATHCONF
+#ifdef HAVE_LPATHCONF
case ACTION_LPATHCONF:
lrval = lpathconf(STR(0), name);
break;
@@ -940,7 +1112,7 @@ call_syscall(struct syscall_desc *scall, char *argv[])
rval = -1;
break;
}
-#ifdef HAS_FREEBSD_ACL
+#ifdef HAS_NFSV4_ACL_SUPPORT
case ACTION_PREPENDACL:
rval = -1;
@@ -975,6 +1147,29 @@ call_syscall(struct syscall_desc *scall, char *argv[])
case ACTION_WRITE:
rval = write(NUM(0), STR(1), strlen(STR(1)));
break;
+#ifdef HAVE_UTIMENSAT
+ case ACTION_UTIMENSAT:
+ times[0].tv_sec = NUM(2);
+ if (strcmp(STR(3), "UTIME_NOW") == 0)
+ times[0].tv_nsec = UTIME_NOW;
+ else if (strcmp(STR(3), "UTIME_OMIT") == 0)
+ times[0].tv_nsec = UTIME_OMIT;
+ else
+ times[0].tv_nsec = strtol(STR(3), NULL, 10);
+ times[1].tv_sec = NUM(4);
+ if (strcmp(STR(5), "UTIME_NOW") == 0)
+ times[1].tv_nsec = UTIME_NOW;
+ else if (strcmp(STR(5), "UTIME_OMIT") == 0)
+ times[1].tv_nsec = UTIME_OMIT;
+ else
+ times[1].tv_nsec = strtol(STR(5), NULL, 10);
+ if (strcmp(STR(6), "AT_SYMLINK_NOFOLLOW") == 0)
+ flag = AT_SYMLINK_NOFOLLOW;
+ else
+ flag = strtol(STR(6), NULL, 10);
+ rval = utimensat(NUM(0), STR(1), times, flag);
+ break;
+#endif
default:
fprintf(stderr, "unsupported syscall\n");
exit(1);
@@ -1007,7 +1202,7 @@ set_gids(char *gids)
assert(gidset != NULL);
for (i = 0, g = strtok(gids, ","); g != NULL;
g = strtok(NULL, ","), i++) {
- if (i >= ngroups) {
+ if ((long)i >= ngroups) {
fprintf(stderr, "too many gids\n");
exit(1);
}
@@ -1118,371 +1313,371 @@ err2str(int error)
static char errnum[8];
switch (error) {
-#ifdef EPERM
+#ifdef EPERM
case EPERM:
return ("EPERM");
#endif
-#ifdef ENOENT
+#ifdef ENOENT
case ENOENT:
return ("ENOENT");
#endif
-#ifdef ESRCH
+#ifdef ESRCH
case ESRCH:
return ("ESRCH");
#endif
-#ifdef EINTR
+#ifdef EINTR
case EINTR:
return ("EINTR");
#endif
-#ifdef EIO
+#ifdef EIO
case EIO:
return ("EIO");
#endif
-#ifdef ENXIO
+#ifdef ENXIO
case ENXIO:
return ("ENXIO");
#endif
-#ifdef E2BIG
+#ifdef E2BIG
case E2BIG:
return ("E2BIG");
#endif
-#ifdef ENOEXEC
+#ifdef ENOEXEC
case ENOEXEC:
return ("ENOEXEC");
#endif
-#ifdef EBADF
+#ifdef EBADF
case EBADF:
return ("EBADF");
#endif
-#ifdef ECHILD
+#ifdef ECHILD
case ECHILD:
return ("ECHILD");
#endif
-#ifdef EDEADLK
+#ifdef EDEADLK
case EDEADLK:
return ("EDEADLK");
#endif
-#ifdef ENOMEM
+#ifdef ENOMEM
case ENOMEM:
return ("ENOMEM");
#endif
-#ifdef EACCES
+#ifdef EACCES
case EACCES:
return ("EACCES");
#endif
-#ifdef EFAULT
+#ifdef EFAULT
case EFAULT:
return ("EFAULT");
#endif
-#ifdef ENOTBLK
+#ifdef ENOTBLK
case ENOTBLK:
return ("ENOTBLK");
#endif
-#ifdef EBUSY
+#ifdef EBUSY
case EBUSY:
return ("EBUSY");
#endif
-#ifdef EEXIST
+#ifdef EEXIST
case EEXIST:
return ("EEXIST");
#endif
-#ifdef EXDEV
+#ifdef EXDEV
case EXDEV:
return ("EXDEV");
#endif
-#ifdef ENODEV
+#ifdef ENODEV
case ENODEV:
return ("ENODEV");
#endif
-#ifdef ENOTDIR
+#ifdef ENOTDIR
case ENOTDIR:
return ("ENOTDIR");
#endif
-#ifdef EISDIR
+#ifdef EISDIR
case EISDIR:
return ("EISDIR");
#endif
-#ifdef EINVAL
+#ifdef EINVAL
case EINVAL:
return ("EINVAL");
#endif
-#ifdef ENFILE
+#ifdef ENFILE
case ENFILE:
return ("ENFILE");
#endif
-#ifdef EMFILE
+#ifdef EMFILE
case EMFILE:
return ("EMFILE");
#endif
-#ifdef ENOTTY
+#ifdef ENOTTY
case ENOTTY:
return ("ENOTTY");
#endif
-#ifdef ETXTBSY
+#ifdef ETXTBSY
case ETXTBSY:
return ("ETXTBSY");
#endif
-#ifdef EFBIG
+#ifdef EFBIG
case EFBIG:
return ("EFBIG");
#endif
-#ifdef ENOSPC
+#ifdef ENOSPC
case ENOSPC:
return ("ENOSPC");
#endif
-#ifdef ESPIPE
+#ifdef ESPIPE
case ESPIPE:
return ("ESPIPE");
#endif
-#ifdef EROFS
+#ifdef EROFS
case EROFS:
return ("EROFS");
#endif
-#ifdef EMLINK
+#ifdef EMLINK
case EMLINK:
return ("EMLINK");
#endif
-#ifdef EPIPE
+#ifdef EPIPE
case EPIPE:
return ("EPIPE");
#endif
-#ifdef EDOM
+#ifdef EDOM
case EDOM:
return ("EDOM");
#endif
-#ifdef ERANGE
+#ifdef ERANGE
case ERANGE:
return ("ERANGE");
#endif
-#ifdef EAGAIN
+#ifdef EAGAIN
case EAGAIN:
return ("EAGAIN");
#endif
-#ifdef EINPROGRESS
+#ifdef EINPROGRESS
case EINPROGRESS:
return ("EINPROGRESS");
#endif
-#ifdef EALREADY
+#ifdef EALREADY
case EALREADY:
return ("EALREADY");
#endif
-#ifdef ENOTSOCK
+#ifdef ENOTSOCK
case ENOTSOCK:
return ("ENOTSOCK");
#endif
-#ifdef EDESTADDRREQ
+#ifdef EDESTADDRREQ
case EDESTADDRREQ:
return ("EDESTADDRREQ");
#endif
-#ifdef EMSGSIZE
+#ifdef EMSGSIZE
case EMSGSIZE:
return ("EMSGSIZE");
#endif
-#ifdef EPROTOTYPE
+#ifdef EPROTOTYPE
case EPROTOTYPE:
return ("EPROTOTYPE");
#endif
-#ifdef ENOPROTOOPT
+#ifdef ENOPROTOOPT
case ENOPROTOOPT:
return ("ENOPROTOOPT");
#endif
-#ifdef EPROTONOSUPPORT
+#ifdef EPROTONOSUPPORT
case EPROTONOSUPPORT:
return ("EPROTONOSUPPORT");
#endif
-#ifdef ESOCKTNOSUPPORT
+#ifdef ESOCKTNOSUPPORT
case ESOCKTNOSUPPORT:
return ("ESOCKTNOSUPPORT");
#endif
-#ifdef EOPNOTSUPP
+#ifdef EOPNOTSUPP
case EOPNOTSUPP:
return ("EOPNOTSUPP");
#endif
-#ifdef EPFNOSUPPORT
+#ifdef EPFNOSUPPORT
case EPFNOSUPPORT:
return ("EPFNOSUPPORT");
#endif
-#ifdef EAFNOSUPPORT
+#ifdef EAFNOSUPPORT
case EAFNOSUPPORT:
return ("EAFNOSUPPORT");
#endif
-#ifdef EADDRINUSE
+#ifdef EADDRINUSE
case EADDRINUSE:
return ("EADDRINUSE");
#endif
-#ifdef EADDRNOTAVAIL
+#ifdef EADDRNOTAVAIL
case EADDRNOTAVAIL:
return ("EADDRNOTAVAIL");
#endif
-#ifdef ENETDOWN
+#ifdef ENETDOWN
case ENETDOWN:
return ("ENETDOWN");
#endif
-#ifdef ENETUNREACH
+#ifdef ENETUNREACH
case ENETUNREACH:
return ("ENETUNREACH");
#endif
-#ifdef ENETRESET
+#ifdef ENETRESET
case ENETRESET:
return ("ENETRESET");
#endif
-#ifdef ECONNABORTED
+#ifdef ECONNABORTED
case ECONNABORTED:
return ("ECONNABORTED");
#endif
-#ifdef ECONNRESET
+#ifdef ECONNRESET
case ECONNRESET:
return ("ECONNRESET");
#endif
-#ifdef ENOBUFS
+#ifdef ENOBUFS
case ENOBUFS:
return ("ENOBUFS");
#endif
-#ifdef EISCONN
+#ifdef EISCONN
case EISCONN:
return ("EISCONN");
#endif
-#ifdef ENOTCONN
+#ifdef ENOTCONN
case ENOTCONN:
return ("ENOTCONN");
#endif
-#ifdef ESHUTDOWN
+#ifdef ESHUTDOWN
case ESHUTDOWN:
return ("ESHUTDOWN");
#endif
-#ifdef ETOOMANYREFS
+#ifdef ETOOMANYREFS
case ETOOMANYREFS:
return ("ETOOMANYREFS");
#endif
-#ifdef ETIMEDOUT
+#ifdef ETIMEDOUT
case ETIMEDOUT:
return ("ETIMEDOUT");
#endif
-#ifdef ECONNREFUSED
+#ifdef ECONNREFUSED
case ECONNREFUSED:
return ("ECONNREFUSED");
#endif
-#ifdef ELOOP
+#ifdef ELOOP
case ELOOP:
return ("ELOOP");
#endif
-#ifdef ENAMETOOLONG
+#ifdef ENAMETOOLONG
case ENAMETOOLONG:
return ("ENAMETOOLONG");
#endif
-#ifdef EHOSTDOWN
+#ifdef EHOSTDOWN
case EHOSTDOWN:
return ("EHOSTDOWN");
#endif
-#ifdef EHOSTUNREACH
+#ifdef EHOSTUNREACH
case EHOSTUNREACH:
return ("EHOSTUNREACH");
#endif
-#ifdef ENOTEMPTY
+#ifdef ENOTEMPTY
case ENOTEMPTY:
return ("ENOTEMPTY");
#endif
-#ifdef EPROCLIM
+#ifdef EPROCLIM
case EPROCLIM:
return ("EPROCLIM");
#endif
-#ifdef EUSERS
+#ifdef EUSERS
case EUSERS:
return ("EUSERS");
#endif
-#ifdef EDQUOT
+#ifdef EDQUOT
case EDQUOT:
return ("EDQUOT");
#endif
-#ifdef ESTALE
+#ifdef ESTALE
case ESTALE:
return ("ESTALE");
#endif
-#ifdef EREMOTE
+#ifdef EREMOTE
case EREMOTE:
return ("EREMOTE");
#endif
-#ifdef EBADRPC
+#ifdef EBADRPC
case EBADRPC:
return ("EBADRPC");
#endif
-#ifdef ERPCMISMATCH
+#ifdef ERPCMISMATCH
case ERPCMISMATCH:
return ("ERPCMISMATCH");
#endif
-#ifdef EPROGUNAVAIL
+#ifdef EPROGUNAVAIL
case EPROGUNAVAIL:
return ("EPROGUNAVAIL");
#endif
-#ifdef EPROGMISMATCH
+#ifdef EPROGMISMATCH
case EPROGMISMATCH:
return ("EPROGMISMATCH");
#endif
-#ifdef EPROCUNAVAIL
+#ifdef EPROCUNAVAIL
case EPROCUNAVAIL:
return ("EPROCUNAVAIL");
#endif
-#ifdef ENOLCK
+#ifdef ENOLCK
case ENOLCK:
return ("ENOLCK");
#endif
-#ifdef ENOSYS
+#ifdef ENOSYS
case ENOSYS:
return ("ENOSYS");
#endif
-#ifdef EFTYPE
+#ifdef EFTYPE
case EFTYPE:
return ("EFTYPE");
#endif
-#ifdef EAUTH
+#ifdef EAUTH
case EAUTH:
return ("EAUTH");
#endif
-#ifdef ENEEDAUTH
+#ifdef ENEEDAUTH
case ENEEDAUTH:
return ("ENEEDAUTH");
#endif
-#ifdef EIDRM
+#ifdef EIDRM
case EIDRM:
return ("EIDRM");
#endif
-#ifdef ENOMSG
+#ifdef ENOMSG
case ENOMSG:
return ("ENOMSG");
#endif
-#ifdef EOVERFLOW
+#ifdef EOVERFLOW
case EOVERFLOW:
return ("EOVERFLOW");
#endif
-#ifdef ECANCELED
+#ifdef ECANCELED
case ECANCELED:
return ("ECANCELED");
#endif
-#ifdef EILSEQ
+#ifdef EILSEQ
case EILSEQ:
return ("EILSEQ");
#endif
-#ifdef ENOATTR
+#ifdef ENOATTR
case ENOATTR:
return ("ENOATTR");
#endif
-#ifdef EDOOFUS
+#ifdef EDOOFUS
case EDOOFUS:
return ("EDOOFUS");
#endif
-#ifdef EBADMSG
+#ifdef EBADMSG
case EBADMSG:
return ("EBADMSG");
#endif
-#ifdef EMULTIHOP
+#ifdef EMULTIHOP
case EMULTIHOP:
return ("EMULTIHOP");
#endif
-#ifdef ENOLINK
+#ifdef ENOLINK
case ENOLINK:
return ("ENOLINK");
#endif
-#ifdef EPROTO
+#ifdef EPROTO
case EPROTO:
return ("EPROTO");
#endif
diff --git a/tests/chflags/00.t b/tests/chflags/00.t
index 4d7b4c9a34647..ec1ae24399e56 100644
--- a/tests/chflags/00.t
+++ b/tests/chflags/00.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/00.t 211352 2010-08-15 21:24:17Z pjd $
desc="chflags changes flags"
diff --git a/tests/chflags/01.t b/tests/chflags/01.t
index 62713fd0347aa..2124678343d3b 100644
--- a/tests/chflags/01.t
+++ b/tests/chflags/01.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/01.t 211474 2010-08-18 22:06:43Z pjd $
desc="chflags returns ENOTDIR if a component of the path prefix is not a directory"
@@ -7,6 +8,8 @@ dir=`dirname $0`
. ${dir}/../misc.sh
require chflags
+if requires_root
+then
echo "1..17"
@@ -20,3 +23,7 @@ for type in regular fifo block char socket; do
expect 0 unlink ${n0}/${n1}
done
expect 0 rmdir ${n0}
+
+else
+echo "1..1"
+fi
diff --git a/tests/chflags/02.t b/tests/chflags/02.t
index d4a0b371b094a..096370e758632 100644
--- a/tests/chflags/02.t
+++ b/tests/chflags/02.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/02.t 211352 2010-08-15 21:24:17Z pjd $
desc="chflags returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters"
diff --git a/tests/chflags/03.t b/tests/chflags/03.t
index 87a62029509bd..8389fc12f53f7 100644
--- a/tests/chflags/03.t
+++ b/tests/chflags/03.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/03.t 211352 2010-08-15 21:24:17Z pjd $
desc="chflags returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters"
diff --git a/tests/chflags/04.t b/tests/chflags/04.t
index 3d5aa3b42ba3c..a58fdc3ce448a 100644
--- a/tests/chflags/04.t
+++ b/tests/chflags/04.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/04.t 211352 2010-08-15 21:24:17Z pjd $
desc="chflags returns ENOENT if the named file does not exist"
diff --git a/tests/chflags/05.t b/tests/chflags/05.t
index cc3e04b3ec57c..95c71ee59e01d 100644
--- a/tests/chflags/05.t
+++ b/tests/chflags/05.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/05.t 211352 2010-08-15 21:24:17Z pjd $
desc="chflags returns EACCES when search permission is denied for a component of the path prefix"
diff --git a/tests/chflags/06.t b/tests/chflags/06.t
index e4899eb7642eb..635e42c34a262 100644
--- a/tests/chflags/06.t
+++ b/tests/chflags/06.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/06.t 211352 2010-08-15 21:24:17Z pjd $
desc="chflags returns ELOOP if too many symbolic links were encountered in translating the pathname"
diff --git a/tests/chflags/07.t b/tests/chflags/07.t
index c2d0af2447b92..9421352e56e31 100644
--- a/tests/chflags/07.t
+++ b/tests/chflags/07.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/07.t 211352 2010-08-15 21:24:17Z pjd $
desc="chflags returns EPERM when the effective user ID does not match the owner of the file and the effective user ID is not the super-user"
diff --git a/tests/chflags/08.t b/tests/chflags/08.t
index 62ed480feec0c..47d1d07aab681 100644
--- a/tests/chflags/08.t
+++ b/tests/chflags/08.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/08.t 211352 2010-08-15 21:24:17Z pjd $
desc="chflags returns EPERM when one of SF_IMMUTABLE, SF_APPEND, or SF_NOUNLINK is set and the user is not the super-user"
diff --git a/tests/chflags/09.t b/tests/chflags/09.t
index e7bd5cc8d6608..9b5f4b6b89f2d 100644
--- a/tests/chflags/09.t
+++ b/tests/chflags/09.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/09.t 211352 2010-08-15 21:24:17Z pjd $
desc="chflags returns EPERM when one of SF_IMMUTABLE, SF_APPEND, or SF_NOUNLINK is set and securelevel is greater than 0"
diff --git a/tests/chflags/10.t b/tests/chflags/10.t
index 11ce36b4d0ab8..e1095876e2477 100644
--- a/tests/chflags/10.t
+++ b/tests/chflags/10.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/10.t 211352 2010-08-15 21:24:17Z pjd $
desc="chflags returns EPERM if non-super-user tries to set one of SF_IMMUTABLE, SF_APPEND, or SF_NOUNLINK"
diff --git a/tests/chflags/11.t b/tests/chflags/11.t
index 33acca7f327af..7fb7258ee6db9 100644
--- a/tests/chflags/11.t
+++ b/tests/chflags/11.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/11.t 211352 2010-08-15 21:24:17Z pjd $
desc="chflags returns EPERM if a user tries to set or remove the SF_SNAPSHOT flag"
diff --git a/tests/chflags/12.t b/tests/chflags/12.t
index 8af941c59ef0c..2b56186818084 100644
--- a/tests/chflags/12.t
+++ b/tests/chflags/12.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/12.t 211352 2010-08-15 21:24:17Z pjd $
desc="chflags returns EROFS if the named file resides on a read-only file system"
@@ -16,8 +17,8 @@ FreeBSD:UFS)
n1=`namegen`
expect 0 mkdir ${n0} 0755
- n=`mdconfig -a -n -t malloc -s 1m`
- newfs /dev/md${n} >/dev/null
+ n=`mdconfig -a -n -t malloc -s 1m` || exit
+ newfs /dev/md${n} >/dev/null || exit
mount /dev/md${n} ${n0}
expect 0 create ${n0}/${n1} 0644
expect 0 chflags ${n0}/${n1} UF_IMMUTABLE
@@ -34,7 +35,7 @@ FreeBSD:UFS)
expect none stat ${n0}/${n1} flags
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
- mdconfig -d -u ${n}
+ mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
;;
FreeBSD:ZFS)
@@ -43,7 +44,7 @@ FreeBSD:ZFS)
n0=`namegen`
n1=`namegen`
- n=`mdconfig -a -n -t malloc -s 128m`
+ n=`mdconfig -a -n -t malloc -s 128m` || exit
zpool create ${n0} /dev/md${n}
expect 0 create /${n0}/${n1} 0644
expect 0 chflags /${n0}/${n1} UF_NODUMP
@@ -60,7 +61,7 @@ FreeBSD:ZFS)
expect none stat /${n0}/${n1} flags
expect 0 unlink /${n0}/${n1}
zpool destroy ${n0}
- mdconfig -d -u ${n}
+ mdconfig -d -u ${n} || exit
;;
*)
quick_exit
diff --git a/tests/chflags/13.t b/tests/chflags/13.t
index 981122c8b3be8..5605414156ec4 100644
--- a/tests/chflags/13.t
+++ b/tests/chflags/13.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/13.t 211352 2010-08-15 21:24:17Z pjd $
desc="chflags returns EFAULT if the path argument points outside the process's allocated address space"
diff --git a/tests/chmod/00.t b/tests/chmod/00.t
index d68d0cf4e652a..f7ab7a670272d 100644
--- a/tests/chmod/00.t
+++ b/tests/chmod/00.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/00.t 211352 2010-08-15 21:24:17Z pjd $
desc="chmod changes permission"
diff --git a/tests/chmod/01.t b/tests/chmod/01.t
index 85802fca24392..aa629cf6e8646 100644
--- a/tests/chmod/01.t
+++ b/tests/chmod/01.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/01.t 211474 2010-08-18 22:06:43Z pjd $
desc="chmod returns ENOTDIR if a component of the path prefix is not a directory"
diff --git a/tests/chmod/02.t b/tests/chmod/02.t
index 0cadec29bf0ca..83558ba8fe626 100644
--- a/tests/chmod/02.t
+++ b/tests/chmod/02.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/02.t 211352 2010-08-15 21:24:17Z pjd $
desc="chmod returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters"
@@ -6,7 +7,11 @@ desc="chmod returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX
dir=`dirname $0`
. ${dir}/../misc.sh
-echo "1..10"
+if supported lchmod; then
+ echo "1..10"
+else
+ echo "1..5"
+fi
nx=`namegen_max`
nxx="${nx}x"
@@ -17,8 +22,10 @@ expect 0620 stat ${nx} mode
expect 0 unlink ${nx}
expect ENAMETOOLONG chmod ${nxx} 0620
-expect 0 create ${nx} 0644
-expect 0 lchmod ${nx} 0620
-expect 0620 stat ${nx} mode
-expect 0 unlink ${nx}
-expect ENAMETOOLONG lchmod ${nxx} 0620
+if supported lchmod; then
+ expect 0 create ${nx} 0644
+ expect 0 lchmod ${nx} 0620
+ expect 0620 stat ${nx} mode
+ expect 0 unlink ${nx}
+ expect ENAMETOOLONG lchmod ${nxx} 0620
+fi
diff --git a/tests/chmod/03.t b/tests/chmod/03.t
index fa4580fbcfeb3..157f28d3306e1 100644
--- a/tests/chmod/03.t
+++ b/tests/chmod/03.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/03.t 211352 2010-08-15 21:24:17Z pjd $
desc="chmod returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters"
@@ -6,7 +7,11 @@ desc="chmod returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} char
dir=`dirname $0`
. ${dir}/../misc.sh
-echo "1..10"
+if supported lchmod; then
+ echo "1..10"
+else
+ echo "1..5"
+fi
nx=`dirgen_max`
nxx="${nx}x"
@@ -19,10 +24,12 @@ expect 0642 stat ${nx} mode
expect 0 unlink ${nx}
expect ENAMETOOLONG chmod ${nxx} 0642
-expect 0 create ${nx} 0644
-expect 0 lchmod ${nx} 0642
-expect 0642 stat ${nx} mode
-expect 0 unlink ${nx}
-expect ENAMETOOLONG lchmod ${nxx} 0642
+if supported lchmod; then
+ expect 0 create ${nx} 0644
+ expect 0 lchmod ${nx} 0642
+ expect 0642 stat ${nx} mode
+ expect 0 unlink ${nx}
+ expect ENAMETOOLONG lchmod ${nxx} 0642
+fi
rm -rf "${nx%%/*}"
diff --git a/tests/chmod/04.t b/tests/chmod/04.t
index 9386c9a3e6ba5..757e9d72b30ab 100644
--- a/tests/chmod/04.t
+++ b/tests/chmod/04.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/04.t 211352 2010-08-15 21:24:17Z pjd $
desc="chmod returns ENOENT if the named file does not exist"
diff --git a/tests/chmod/05.t b/tests/chmod/05.t
index 5648e46eef8b7..3475752e7f082 100644
--- a/tests/chmod/05.t
+++ b/tests/chmod/05.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/05.t 211352 2010-08-15 21:24:17Z pjd $
desc="chmod returns EACCES when search permission is denied for a component of the path prefix"
diff --git a/tests/chmod/06.t b/tests/chmod/06.t
index d44b3cb1ea525..a925dad2cfd08 100644
--- a/tests/chmod/06.t
+++ b/tests/chmod/06.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/06.t 211474 2010-08-18 22:06:43Z pjd $
desc="chmod returns ELOOP if too many symbolic links were encountered in translating the pathname"
diff --git a/tests/chmod/07.t b/tests/chmod/07.t
index 012e59a97bb52..279dbae02bdc3 100644
--- a/tests/chmod/07.t
+++ b/tests/chmod/07.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/07.t 211352 2010-08-15 21:24:17Z pjd $
desc="chmod returns EPERM if the operation would change the ownership, but the effective user ID is not the super-user"
diff --git a/tests/chmod/08.t b/tests/chmod/08.t
index 5b37569a82d7e..7f0602b64dc6b 100644
--- a/tests/chmod/08.t
+++ b/tests/chmod/08.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/08.t 211352 2010-08-15 21:24:17Z pjd $
desc="chmod returns EPERM if the named file has its immutable or append-only flag set"
diff --git a/tests/chmod/09.t b/tests/chmod/09.t
index c62b908f5802f..000e0e35774d1 100644
--- a/tests/chmod/09.t
+++ b/tests/chmod/09.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/09.t 211352 2010-08-15 21:24:17Z pjd $
desc="chmod returns EROFS if the named file resides on a read-only file system"
@@ -14,9 +15,9 @@ n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 1m`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 1m` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
expect 0 create ${n0}/${n1} 0644
expect 0 chmod ${n0}/${n1} 0640
expect 0640 stat ${n0}/${n1} mode
@@ -33,5 +34,5 @@ expect 0 lchmod ${n0}/${n1} 0640
expect 0640 stat ${n0}/${n1} mode
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/chmod/10.t b/tests/chmod/10.t
index 1153429ac1dc9..f37a94bea84b8 100644
--- a/tests/chmod/10.t
+++ b/tests/chmod/10.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/10.t 211352 2010-08-15 21:24:17Z pjd $
desc="chmod returns EFAULT if the path argument points outside the process's allocated address space"
diff --git a/tests/chmod/11.t b/tests/chmod/11.t
index 94c5e5f4f3193..c68d939b7fe35 100644
--- a/tests/chmod/11.t
+++ b/tests/chmod/11.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/11.t 211352 2010-08-15 21:24:17Z pjd $
desc="chmod returns EFTYPE if the effective user ID is not the super-user, the mode includes the sticky bit (S_ISVTX), and path does not refer to a directory"
@@ -63,6 +64,12 @@ for type in regular fifo block char socket symlink; do
create_file ${type} ${n1} 0640 65534 65534
expect 0 symlink ${n1} ${n2}
case "${os}" in
+ Darwin)
+ expect 0 -u 65534 -g 65534 chmod ${n1} 01644
+ expect 01644 stat ${n1} mode
+ expect 0 -u 65534 -g 65534 chmod ${n2} 01640
+ expect 01640 stat ${n1} mode
+ ;;
FreeBSD)
expect EFTYPE -u 65534 -g 65534 chmod ${n1} 01644
expect 0640 stat ${n1} mode
@@ -93,6 +100,10 @@ for type in regular fifo block char socket symlink; do
if supported lchmod; then
create_file ${type} ${n1} 0640 65534 65534
case "${os}" in
+ Darwin)
+ expect 0 -u 65534 -g 65534 lchmod ${n1} 01644
+ expect 01644 lstat ${n1} mode
+ ;;
FreeBSD)
expect EFTYPE -u 65534 -g 65534 lchmod ${n1} 01644
expect 0640 lstat ${n1} mode
diff --git a/tests/chmod/12.t b/tests/chmod/12.t
index b7f7d67997fbe..e3b2b24d79124 100644
--- a/tests/chmod/12.t
+++ b/tests/chmod/12.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chmod/12.t 219463 2011-03-10 20:59:02Z pjd $
desc="verify SUID/SGID bit behaviour"
diff --git a/tests/chown/00.t b/tests/chown/00.t
index 5c6be97d66dd5..d62fba7b0e8c4 100644
--- a/tests/chown/00.t
+++ b/tests/chown/00.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/00.t 228975 2011-12-30 00:04:11Z uqs $
desc="chown changes ownership"
@@ -213,6 +214,20 @@ done
# when non-super-user calls chown(2) successfully, set-uid and set-gid bits may
# be removed, except when both uid and gid are equal to -1.
for type in regular dir fifo block char socket symlink; do
+ #
+ # Linux makes a destinction for behavior when an executable file vs a
+ # non-executable file. From chmod(2):
+ #
+ # When the owner or group of an executable file are changed by an
+ # unprivileged user the S_ISUID and S_ISGID mode bits are cleared.
+ #
+ # I believe in this particular case, the behavior's bugged.
+ #
+ if [ "${type}" = "dir" -a "${os}" = "Linux" ]; then
+ _todo_msg="Linux doesn't clear the SGID/SUID bits for directories, despite the description noted"
+ else
+ _todo_msg=
+ fi
if [ "${type}" != "symlink" ]; then
create_file ${type} ${n0}
@@ -220,10 +235,12 @@ for type in regular dir fifo block char socket symlink; do
expect 0 chmod ${n0} 06555
expect 06555,65534,65533 stat ${n0} mode,uid,gid
expect 0 -u 65534 -g 65533,65532 chown ${n0} 65534 65532
+ [ -n "${_todo_msg}" ] && todo "Linux" "${_todo_msg}"
expect 0555,65534,65532 stat ${n0} mode,uid,gid
expect 0 chmod ${n0} 06555
expect 06555,65534,65532 stat ${n0} mode,uid,gid
expect 0 -u 65534 -g 65533,65532 -- chown ${n0} -1 65533
+ [ -n "${_todo_msg}" ] && todo "Linux" "${_todo_msg}"
expect 0555,65534,65533 stat ${n0} mode,uid,gid
expect 0 chmod ${n0} 06555
expect 06555,65534,65533 stat ${n0} mode,uid,gid
@@ -236,13 +253,17 @@ for type in regular dir fifo block char socket symlink; do
expect 06555,65534,65533 stat ${n0} mode,uid,gid
expect 06555,65534,65533 stat ${n1} mode,uid,gid
expect 0 -u 65534 -g 65533,65532 chown ${n1} 65534 65532
+ [ -n "${_todo_msg}" ] && todo "Linux" "${_todo_msg}"
expect 0555,65534,65532 stat ${n0} mode,uid,gid
+ [ -n "${_todo_msg}" ] && todo "Linux" "${_todo_msg}"
expect 0555,65534,65532 stat ${n1} mode,uid,gid
expect 0 chmod ${n1} 06555
expect 06555,65534,65532 stat ${n0} mode,uid,gid
expect 06555,65534,65532 stat ${n1} mode,uid,gid
expect 0 -u 65534 -g 65533,65532 -- chown ${n1} -1 65533
+ [ -n "${_todo_msg}" ] && todo "Linux" "${_todo_msg}"
expect 0555,65534,65533 stat ${n0} mode,uid,gid
+ [ -n "${_todo_msg}" ] && todo "Linux" "${_todo_msg}"
expect 0555,65534,65533 stat ${n1} mode,uid,gid
expect 0 chmod ${n1} 06555
expect 06555,65534,65533 stat ${n0} mode,uid,gid
@@ -270,6 +291,7 @@ for type in regular dir fifo block char socket symlink; do
fi
expect 06555,65534,65533 lstat ${n0} mode,uid,gid
expect 0 -u 65534 -g 65533,65532 lchown ${n0} 65534 65532
+ [ -n "${_todo_msg}" ] && todo "Linux" "${_todo_msg}"
expect 0555,65534,65532 lstat ${n0} mode,uid,gid
if supported lchmod; then
expect 0 lchmod ${n0} 06555
@@ -278,6 +300,7 @@ for type in regular dir fifo block char socket symlink; do
fi
expect 06555,65534,65532 lstat ${n0} mode,uid,gid
expect 0 -u 65534 -g 65533,65532 -- lchown ${n0} -1 65533
+ [ -n "${_todo_msg}" ] && todo "Linux" "${_todo_msg}"
expect 0555,65534,65533 lstat ${n0} mode,uid,gid
if supported lchmod; then
expect 0 lchmod ${n0} 06555
diff --git a/tests/chown/01.t b/tests/chown/01.t
index 1813394aee83e..a60126a4f466a 100644
--- a/tests/chown/01.t
+++ b/tests/chown/01.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/01.t 211474 2010-08-18 22:06:43Z pjd $
desc="chown returns ENOTDIR if a component of the path prefix is not a directory"
diff --git a/tests/chown/02.t b/tests/chown/02.t
index e110db8261ba2..e65d38eec24c6 100644
--- a/tests/chown/02.t
+++ b/tests/chown/02.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/02.t 211352 2010-08-15 21:24:17Z pjd $
desc="chown returns ENAMETOOLONG if a component of a pathname exceeded ${NAME_MAX} characters"
diff --git a/tests/chown/03.t b/tests/chown/03.t
index 031a878f3524e..3cb1ded0081e4 100644
--- a/tests/chown/03.t
+++ b/tests/chown/03.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/03.t 211352 2010-08-15 21:24:17Z pjd $
desc="chown returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters"
diff --git a/tests/chown/04.t b/tests/chown/04.t
index d6eac198ed1e8..4b66bacb74223 100644
--- a/tests/chown/04.t
+++ b/tests/chown/04.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/04.t 211410 2010-08-17 06:08:09Z pjd $
desc="chown returns ENOENT if the named file does not exist"
diff --git a/tests/chown/05.t b/tests/chown/05.t
index 5a27a9ca90fcc..68b52b88b0ca9 100644
--- a/tests/chown/05.t
+++ b/tests/chown/05.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/05.t 211410 2010-08-17 06:08:09Z pjd $
desc="chown returns EACCES when search permission is denied for a component of the path prefix"
diff --git a/tests/chown/06.t b/tests/chown/06.t
index a7ac349c02f8a..aaec6177689e2 100644
--- a/tests/chown/06.t
+++ b/tests/chown/06.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/06.t 211410 2010-08-17 06:08:09Z pjd $
desc="chown returns ELOOP if too many symbolic links were encountered in translating the pathname"
diff --git a/tests/chown/07.t b/tests/chown/07.t
index f188080d05eca..bf7c544eeee35 100644
--- a/tests/chown/07.t
+++ b/tests/chown/07.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/07.t 211410 2010-08-17 06:08:09Z pjd $
desc="chown returns EPERM if the operation would change the ownership, but the effective user ID is not the super-user and the process is not an owner of the file"
diff --git a/tests/chown/08.t b/tests/chown/08.t
index a98f873ff91b1..3e1db6411f8f6 100644
--- a/tests/chown/08.t
+++ b/tests/chown/08.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/08.t 211352 2010-08-15 21:24:17Z pjd $
desc="chown returns EPERM if the named file has its immutable or append-only flag set"
diff --git a/tests/chown/09.t b/tests/chown/09.t
index 455f43690706f..9fd44df5fe01f 100644
--- a/tests/chown/09.t
+++ b/tests/chown/09.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/09.t 211352 2010-08-15 21:24:17Z pjd $
desc="chown returns EROFS if the named file resides on a read-only file system"
@@ -14,9 +15,9 @@ n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 1m`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 1m` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
expect 0 create ${n0}/${n1} 0644
expect 0 chown ${n0}/${n1} 65534 65534
expect 65534,65534 stat ${n0}/${n1} uid,gid
@@ -28,5 +29,5 @@ expect 0 chown ${n0}/${n1} 65533 65533
expect 65533,65533 stat ${n0}/${n1} uid,gid
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/chown/10.t b/tests/chown/10.t
index e791008ee54ee..6e7f8207a1d4b 100644
--- a/tests/chown/10.t
+++ b/tests/chown/10.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/chown/10.t 211410 2010-08-17 06:08:09Z pjd $
desc="chown returns EFAULT if the path argument points outside the process's allocated address space"
diff --git a/tests/conf b/tests/conf
index adb6cd6fb9b53..cf8fb8be0247c 100644
--- a/tests/conf
+++ b/tests/conf
@@ -1,15 +1,40 @@
# $FreeBSD: head/tools/regression/pjdfstest/tests/conf 211354 2010-08-15 21:29:03Z pjd $
+# vim: filetype=sh noexpandtab ts=8 sw=8
# pjdfstest configuration file
# Supported operating systems: FreeBSD, Darwin, SunOS, Linux
os=`uname`
+unsupported_os()
+{
+ echo "Unsupported operating system ${os}." >/dev/stderr
+ exit 1
+}
+
+get_mountpoint()
+{
+ case "${os}" in
+ Darwin|FreeBSD)
+ df . | tail -1 | awk '{print $NF}'
+ ;;
+ *)
+ unsupported_os
+ ;;
+ esac
+}
+
case "${os}" in
-FreeBSD|Darwin)
+Darwin)
GREP=grep
#fs=`df -T . | tail -1 | awk '{print $2}'`
- pattern="`df . | tail -1 | awk '{printf("%s on %s \n", $1, $6)}'`"
- fs=`mount | ${GREP} -E "^${pattern}" | awk -F '[(,]' '{print toupper($2)}'`
+ mountpoint="`get_mountpoint`"
+ fs=`mount | grep "on $mountpoint" | sed -e 's/.*(//' -e 's/,.*//g' | tr '[:lower:]' '[:upper:]'`
+ ;;
+FreeBSD)
+ GREP=grep
+ #fs=`df -T . | tail -1 | awk '{print $2}'`
+ mountpoint="`get_mountpoint`"
+ fs=`mount -p | awk '$2 == "'$mountpoint'" { print toupper($3) }'`
;;
Solaris|SunOS)
GREP=ggrep
@@ -22,8 +47,7 @@ Linux)
fs=`df -PT . | tail -1 | awk '{print toupper($2)}'`
;;
*)
- echo "Unsupported operating system ${os}." >/dev/stderr
- exit 1
+ unsupported_os
;;
esac
diff --git a/tests/ftruncate/00.t b/tests/ftruncate/00.t
index ff6728fe2a53e..124a84c51d814 100644
--- a/tests/ftruncate/00.t
+++ b/tests/ftruncate/00.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/ftruncate/00.t 219439 2011-03-09 23:11:30Z pjd $
desc="ftruncate descrease/increase file size"
@@ -6,7 +7,7 @@ desc="ftruncate descrease/increase file size"
dir=`dirname $0`
. ${dir}/../misc.sh
-echo "1..21"
+echo "1..26"
n0=`namegen`
n1=`namegen`
diff --git a/tests/ftruncate/01.t b/tests/ftruncate/01.t
index a8e95ac60181b..7360a57f66188 100644
--- a/tests/ftruncate/01.t
+++ b/tests/ftruncate/01.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/01.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns ENOTDIR if a component of the path prefix is not a directory"
diff --git a/tests/ftruncate/02.t b/tests/ftruncate/02.t
index 83de38d3244f7..823d01c2147a8 100644
--- a/tests/ftruncate/02.t
+++ b/tests/ftruncate/02.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/02.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters"
diff --git a/tests/ftruncate/03.t b/tests/ftruncate/03.t
index 41e98625ba4f5..d3d3ab3d57ae5 100644
--- a/tests/ftruncate/03.t
+++ b/tests/ftruncate/03.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/03.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters"
diff --git a/tests/ftruncate/04.t b/tests/ftruncate/04.t
index cd1cfc66b2b0a..ba7c4e5e81abe 100644
--- a/tests/ftruncate/04.t
+++ b/tests/ftruncate/04.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/04.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns ENOENT if the named file does not exist"
diff --git a/tests/ftruncate/05.t b/tests/ftruncate/05.t
index f12881581bce7..adafe9355ce77 100644
--- a/tests/ftruncate/05.t
+++ b/tests/ftruncate/05.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/05.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns EACCES when search permission is denied for a component of the path prefix"
diff --git a/tests/ftruncate/06.t b/tests/ftruncate/06.t
index 1ce516fa74a65..45b55c8ebc65c 100644
--- a/tests/ftruncate/06.t
+++ b/tests/ftruncate/06.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/06.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns EACCES if the named file is not writable by the user"
diff --git a/tests/ftruncate/07.t b/tests/ftruncate/07.t
index 44f87e7ea8590..52c3f6cb0a907 100644
--- a/tests/ftruncate/07.t
+++ b/tests/ftruncate/07.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/07.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns ELOOP if too many symbolic links were encountered in translating the pathname"
diff --git a/tests/ftruncate/08.t b/tests/ftruncate/08.t
index 6f205ef965f2d..70f39273204cc 100644
--- a/tests/ftruncate/08.t
+++ b/tests/ftruncate/08.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/08.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns EPERM if the named file has its immutable or append-only flag set"
diff --git a/tests/ftruncate/09.t b/tests/ftruncate/09.t
index d7e082ddbe0ee..c0a805c54cc73 100644
--- a/tests/ftruncate/09.t
+++ b/tests/ftruncate/09.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/09.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns EISDIR if the named file is a directory"
diff --git a/tests/ftruncate/10.t b/tests/ftruncate/10.t
index 08893a3854398..c8b8eaade6b38 100644
--- a/tests/ftruncate/10.t
+++ b/tests/ftruncate/10.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/10.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns EROFS if the named file resides on a read-only file system"
@@ -14,9 +15,9 @@ n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 1m`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 1m` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
expect 0 create ${n0}/${n1} 0644
expect 0 truncate ${n0}/${n1} 123
expect 123 stat ${n0}/${n1} size
@@ -28,5 +29,5 @@ expect 0 truncate ${n0}/${n1} 1234
expect 1234 stat ${n0}/${n1} size
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/ftruncate/11.t b/tests/ftruncate/11.t
index b00d7b89c16db..2b28dfde5108f 100644
--- a/tests/ftruncate/11.t
+++ b/tests/ftruncate/11.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/11.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns ETXTBSY the file is a pure procedure (shared text) file that is being executed"
@@ -7,6 +8,7 @@ dir=`dirname $0`
. ${dir}/../misc.sh
[ "${os}" = "FreeBSD" ] || quick_exit
+noexec && quick_exit
echo "1..2"
diff --git a/tests/ftruncate/12.t b/tests/ftruncate/12.t
index 1825456a7b132..98f3daeaf4610 100644
--- a/tests/ftruncate/12.t
+++ b/tests/ftruncate/12.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/12.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns EFBIG or EINVAL if the length argument was greater than the maximum file size"
diff --git a/tests/ftruncate/13.t b/tests/ftruncate/13.t
index 28307ae40af70..219295519ac6c 100644
--- a/tests/ftruncate/13.t
+++ b/tests/ftruncate/13.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/13.t 211352 2010-08-15 21:24:17Z pjd $
desc="ftruncate returns EINVAL if the length argument was less than 0"
diff --git a/tests/ftruncate/14.t b/tests/ftruncate/14.t
index a238771264f9e..a6d4ed55767c4 100644
--- a/tests/ftruncate/14.t
+++ b/tests/ftruncate/14.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/14.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns EFAULT if the path argument points outside the process's allocated address space"
diff --git a/tests/granular/00.t b/tests/granular/00.t
index 629f66e419acc..fcf4c02d8185e 100644
--- a/tests/granular/00.t
+++ b/tests/granular/00.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/granular/00.t 211352 2010-08-15 21:24:17Z pjd $
desc="NFSv4 granular permissions checking - WRITE_DATA vs APPEND_DATA on directories"
diff --git a/tests/granular/01.t b/tests/granular/01.t
index f6658cc5f8405..34453b7117149 100644
--- a/tests/granular/01.t
+++ b/tests/granular/01.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/granular/01.t 211352 2010-08-15 21:24:17Z pjd $
desc="NFSv4 granular permissions checking - ACL_READ_ATTRIBUTES and ACL_WRITE_ATTRIBUTES"
diff --git a/tests/granular/02.t b/tests/granular/02.t
index 32a318cc0d901..6b8e26d4954be 100644
--- a/tests/granular/02.t
+++ b/tests/granular/02.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/granular/02.t 211352 2010-08-15 21:24:17Z pjd $
desc="NFSv4 granular permissions checking - ACL_READ_ACL and ACL_WRITE_ACL"
diff --git a/tests/granular/03.t b/tests/granular/03.t
index 3b825ccef3a3f..fe778ea405bdf 100644
--- a/tests/granular/03.t
+++ b/tests/granular/03.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/granular/03.t 211352 2010-08-15 21:24:17Z pjd $
desc="NFSv4 granular permissions checking - DELETE and DELETE_CHILD"
diff --git a/tests/granular/04.t b/tests/granular/04.t
index a06b0d605ebd7..fccb05c606b62 100644
--- a/tests/granular/04.t
+++ b/tests/granular/04.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/granular/04.t 211352 2010-08-15 21:24:17Z pjd $
desc="NFSv4 granular permissions checking - ACL_WRITE_OWNER"
@@ -6,12 +7,11 @@ desc="NFSv4 granular permissions checking - ACL_WRITE_OWNER"
dir=`dirname $0`
. ${dir}/../misc.sh
-[ "${os}:${fs}" = "FreeBSD:ZFS" ] || quick_exit
+nfsv4acls || quick_exit
-echo "1..52"
+echo "1..22"
n0=`namegen`
-n1=`namegen`
n2=`namegen`
expect 0 mkdir ${n2} 0755
@@ -42,39 +42,5 @@ expect 0 -u 65534 -g 65532,65531 chown ${n0} 65534 65531
expect 65534,65531 lstat ${n0} uid,gid
expect 0 unlink ${n0}
-# When non-owner calls chown(2) successfully, set-uid and set-gid bits are
-# removed, except when both uid and gid are equal to -1.
-expect 0 create ${n0} 0644
-expect 0 prependacl ${n0} user:65534:write_owner::allow
-expect 0 chmod ${n0} 06555
-expect 06555 lstat ${n0} mode
-expect 0 -u 65534 -g 65533,65532 chown ${n0} 65534 65532
-expect 0555,65534,65532 lstat ${n0} mode,uid,gid
-expect 0 chmod ${n0} 06555
-expect 06555 lstat ${n0} mode
-expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 65533
-expect 0555,65534,65533 lstat ${n0} mode,uid,gid
-expect 0 chmod ${n0} 06555
-expect 06555 lstat ${n0} mode
-expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 -1
-expect 06555,65534,65533 lstat ${n0} mode,uid,gid
-expect 0 unlink ${n0}
-
-expect 0 mkdir ${n0} 0755
-expect 0 prependacl ${n0} user:65534:write_owner::allow
-expect 0 chmod ${n0} 06555
-expect 06555 lstat ${n0} mode
-expect 0 -u 65534 -g 65533,65532 chown ${n0} 65534 65532
-expect 0555,65534,65532 lstat ${n0} mode,uid,gid
-expect 0 chmod ${n0} 06555
-expect 06555 lstat ${n0} mode
-expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 65533
-expect 0555,65534,65533 lstat ${n0} mode,uid,gid
-expect 0 chmod ${n0} 06555
-expect 06555 lstat ${n0} mode
-expect 0 -u 65534 -g 65533,65532 chown ${n0} -1 -1
-expect 06555,65534,65533 lstat ${n0} mode,uid,gid
-expect 0 rmdir ${n0}
-
cd ${cdir}
expect 0 rmdir ${n2}
diff --git a/tests/granular/05.t b/tests/granular/05.t
index c42f51a90987f..23e897107bd67 100644
--- a/tests/granular/05.t
+++ b/tests/granular/05.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/granular/05.t 211352 2010-08-15 21:24:17Z pjd $
desc="NFSv4 granular permissions checking - DELETE and DELETE_CHILD with directories"
diff --git a/tests/link/00.t b/tests/link/00.t
index 1bcb32ad17ac9..940ffba63f2b4 100644
--- a/tests/link/00.t
+++ b/tests/link/00.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/link/00.t 211352 2010-08-15 21:24:17Z pjd $
desc="link creates hardlinks"
diff --git a/tests/link/01.t b/tests/link/01.t
index fe05aeba7119d..c3ddade584553 100644
--- a/tests/link/01.t
+++ b/tests/link/01.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/link/01.t 211474 2010-08-18 22:06:43Z pjd $
desc="link returns ENOTDIR if a component of either path prefix is not a directory"
diff --git a/tests/link/02.t b/tests/link/02.t
index ca3e092edf991..5ba8c50892bd5 100644
--- a/tests/link/02.t
+++ b/tests/link/02.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/link/02.t 211352 2010-08-15 21:24:17Z pjd $
desc="link returns ENAMETOOLONG if a component of either pathname exceeded {NAME_MAX} characters"
diff --git a/tests/link/03.t b/tests/link/03.t
index 22f8e55e0cb37..9efc137aad6d0 100644
--- a/tests/link/03.t
+++ b/tests/link/03.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/link/03.t 211352 2010-08-15 21:24:17Z pjd $
desc="link returns ENAMETOOLONG if an entire length of either path name exceeded {PATH_MAX} characters"
diff --git a/tests/link/04.t b/tests/link/04.t
index bb095396005ee..615722c377abf 100644
--- a/tests/link/04.t
+++ b/tests/link/04.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/link/04.t 211352 2010-08-15 21:24:17Z pjd $
desc="link returns ENOENT if a component of either path prefix does not exist"
diff --git a/tests/link/05.t b/tests/link/05.t
index 7db93fd96c674..5a18c2103e1d1 100644
--- a/tests/link/05.t
+++ b/tests/link/05.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/link/05.t 211352 2010-08-15 21:24:17Z pjd $
desc="link returns EMLINK if the link count of the file named by name1 would exceed 32767"
@@ -15,9 +16,9 @@ n1=`namegen`
n2=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 1m`
-newfs -i 1 /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 1m` || exit
+newfs -i 1 /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
expect 0 create ${n0}/${n1} 0644
i=1
while :; do
@@ -32,5 +33,5 @@ test_check $i -eq 32767
expect EMLINK link ${n0}/${n1} ${n0}/${n2}
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/link/06.t b/tests/link/06.t
index 73ab01e9ae15e..04f5110a0ba0b 100644
--- a/tests/link/06.t
+++ b/tests/link/06.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/link/06.t 211352 2010-08-15 21:24:17Z pjd $
desc="link returns EACCES when a component of either path prefix denies search permission"
diff --git a/tests/link/07.t b/tests/link/07.t
index 68495dd7c0b86..afe1b734c2094 100644
--- a/tests/link/07.t
+++ b/tests/link/07.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/link/07.t 211352 2010-08-15 21:24:17Z pjd $
desc="link returns EACCES when the requested link requires writing in a directory with a mode that denies write permission"
diff --git a/tests/link/08.t b/tests/link/08.t
index f4599d50f01b9..eed5a46c5edab 100644
--- a/tests/link/08.t
+++ b/tests/link/08.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/link/08.t 211352 2010-08-15 21:24:17Z pjd $
desc="link returns ELOOP if too many symbolic links were encountered in translating one of the pathnames"
diff --git a/tests/link/09.t b/tests/link/09.t
index 5f89655d36106..cef10d25f4656 100644
--- a/tests/link/09.t
+++ b/tests/link/09.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/link/09.t 211352 2010-08-15 21:24:17Z pjd $
desc="link returns ENOENT if the source file does not exist"
diff --git a/tests/link/10.t b/tests/link/10.t
index 03ebbd25ffdbb..1ff378b96335d 100644
--- a/tests/link/10.t
+++ b/tests/link/10.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/link/10.t 211474 2010-08-18 22:06:43Z pjd $
desc="link returns EEXIST if the destination file does exist"
diff --git a/tests/link/11.t b/tests/link/11.t
index 260342cd1d315..aee270a4234a3 100644
--- a/tests/link/11.t
+++ b/tests/link/11.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/link/11.t 211352 2010-08-15 21:24:17Z pjd $
desc="link returns EPERM if the source file is a directory"
diff --git a/tests/link/12.t b/tests/link/12.t
index a5408b6564181..047360309d85d 100644
--- a/tests/link/12.t
+++ b/tests/link/12.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/link/12.t 211352 2010-08-15 21:24:17Z pjd $
desc="link returns EPERM if the source file has its immutable or append-only flag set"
@@ -10,7 +11,7 @@ require chflags
case "${os}:${fs}" in
FreeBSD:ZFS)
- echo "1..27"
+ echo "1..28"
;;
FreeBSD:UFS)
echo "1..48"
@@ -31,12 +32,9 @@ expect 0 unlink ${n1}
expect 1 stat ${n0} nlink
expect 0 chflags ${n0} SF_IMMUTABLE
-todo FreeBSD:ZFS "Creating a hard link to a file protected by SF_IMMUTABLE should return EPERM."
expect EPERM link ${n0} ${n1}
-todo FreeBSD:ZFS "Creating a hard link to a file protected by SF_IMMUTABLE should return EPERM."
expect 1 stat ${n0} nlink
expect 0 chflags ${n0} none
-todo FreeBSD:ZFS "Creating a hard link to a file protected by SF_IMMUTABLE should return EPERM."
expect 0 link ${n0} ${n1}
expect 2 stat ${n0} nlink
expect 0 unlink ${n1}
@@ -49,24 +47,16 @@ expect 0 chflags ${n0} none
expect 0 unlink ${n1}
expect 1 stat ${n0} nlink
+expect 0 chflags ${n0} SF_APPEND
+expect EPERM link ${n0} ${n1}
+expect 0 chflags ${n0} none
+expect 0 link ${n0} ${n1}
+expect 2 stat ${n0} nlink
+expect 0 unlink ${n1}
+expect 1 stat ${n0} nlink
+
case "${os}:${fs}" in
-FreeBSD:ZFS)
- expect 0 chflags ${n0} SF_APPEND
- expect 0 link ${n0} ${n1}
- expect 2 stat ${n0} nlink
- expect 0 chflags ${n0} none
- expect 0 unlink ${n1}
- expect 1 stat ${n0} nlink
- ;;
FreeBSD:UFS)
- expect 0 chflags ${n0} SF_APPEND
- expect EPERM link ${n0} ${n1}
- expect 0 chflags ${n0} none
- expect 0 link ${n0} ${n1}
- expect 2 stat ${n0} nlink
- expect 0 unlink ${n1}
- expect 1 stat ${n0} nlink
-
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM link ${n0} ${n1}
expect 0 chflags ${n0} none
diff --git a/tests/link/13.t b/tests/link/13.t
index 2da8621f23cc1..437f65d781c24 100644
--- a/tests/link/13.t
+++ b/tests/link/13.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/link/13.t 211352 2010-08-15 21:24:17Z pjd $
desc="link returns EPERM if the parent directory of the destination file has its immutable flag set"
diff --git a/tests/link/14.t b/tests/link/14.t
index 3a05dc0d10bce..34038a0ef8bff 100644
--- a/tests/link/14.t
+++ b/tests/link/14.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/link/14.t 211352 2010-08-15 21:24:17Z pjd $
desc="link returns EXDEV if the source and the destination files are on different file systems"
@@ -15,9 +16,9 @@ n1=`namegen`
n2=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 1m`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 1m` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
expect 0 create ${n0}/${n1} 0644
expect EXDEV link ${n0}/${n1} ${n2}
expect 0 unlink ${n0}/${n1}
@@ -25,5 +26,5 @@ expect 0 create ${n1} 0644
expect EXDEV link ${n1} ${n0}/${n2}
expect 0 unlink ${n1}
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/link/15.t b/tests/link/15.t
index 972176bed08fd..cb41ad5033706 100644
--- a/tests/link/15.t
+++ b/tests/link/15.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/link/15.t 211352 2010-08-15 21:24:17Z pjd $
desc="link returns ENOSPC if the directory in which the entry for the new link is being placed cannot be extended because there is no space left on the file system containing the directory"
@@ -15,9 +16,9 @@ n1=`namegen`
n2=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 256k`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 512k` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
expect 0 create ${n0}/${n1} 0644
i=0
while :; do
@@ -29,5 +30,5 @@ while :; do
done
expect ENOSPC link ${n0}/${n1} ${n0}/${n2}
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/link/16.t b/tests/link/16.t
index 56485ec1bee9b..52c80ae7c54ba 100644
--- a/tests/link/16.t
+++ b/tests/link/16.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/link/16.t 211352 2010-08-15 21:24:17Z pjd $
desc="link returns EROFS if the requested link requires writing in a directory on a read-only file system"
@@ -15,9 +16,9 @@ n1=`namegen`
n2=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 1m`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 1m` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
expect 0 create ${n0}/${n1} 0644
expect 0 link ${n0}/${n1} ${n0}/${n2}
@@ -30,5 +31,5 @@ expect 0 unlink ${n0}/${n2}
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/link/17.t b/tests/link/17.t
index 9b7e6fc683660..4630373daa05b 100644
--- a/tests/link/17.t
+++ b/tests/link/17.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/link/17.t 211352 2010-08-15 21:24:17Z pjd $
desc="link returns EFAULT if one of the pathnames specified is outside the process's allocated address space"
diff --git a/tests/misc.sh b/tests/misc.sh
index 8978b5fcc6a9a..54710602a92ef 100755
--- a/tests/misc.sh
+++ b/tests/misc.sh
@@ -2,16 +2,39 @@
ntest=1
-case "${dir}" in
-/*)
- maindir="${dir}/../.."
- ;;
-*)
- maindir="`pwd`/${dir}/../.."
- ;;
-esac
+confdir=${dir:-$(dirname "$0")}
+maindir=${dir:-$(dirname "$0")}
+while [ ! -r "$confdir/conf" -a "$confdir" != / ]; do
+ confdir=$(cd $confdir/..; pwd)
+done
+while [ "$maindir" != / ]; do
+ if [ -f "$maindir/pjdfstest" -a -x "$maindir/pjdfstest" ]; then
+ break
+ fi
+ maindir=$(cd $maindir/../; pwd)
+done
fstest="${maindir}/pjdfstest"
-. ${maindir}/tests/conf
+if ! . ${confdir}/conf; then
+ echo "not ok - could not source configuration file"
+ exit 1
+fi
+if [ ! -x $fstest ]; then
+ echo "not ok - could not find pjdfstest app"
+ exit 1
+fi
+
+requires_root()
+{
+ case "$(id -u)" in
+ 0)
+ return 0
+ ;;
+ *)
+ echo "not ok ${ntest} not root"
+ return 1
+ ;;
+ esac
+}
expect()
{
@@ -41,8 +64,9 @@ jexpect()
s="${1}"
d="${2}"
e="${3}"
+
shift 3
- r=`jail -s ${s} / pjdfstest 127.0.0.1 /bin/sh -c "cd ${d} && ${fstest} $* 2>/dev/null" | tail -1`
+ r=`jail -s ${s} / pjdfstest 127.0.0.1 /bin/sh -c "cd ${d} && ${fstest} $* 2>/dev/null" 2>/dev/null | tail -1`
echo "${r}" | ${GREP} -Eq '^'${e}'$'
if [ $? -eq 0 ]; then
if [ -z "${todomsg}" ]; then
@@ -163,6 +187,27 @@ supported()
return 1
fi
;;
+ posix_fallocate)
+ if [ "${os}" != "FreeBSD" ]; then
+ return 1
+ fi
+ ;;
+ stat_st_birthtime)
+ case "${os}" in
+ Darwin|FreeBSD)
+ ;;
+ *)
+ return 1
+ ;;
+ esac
+ ;;
+ utimensat)
+ case ${os} in
+ Darwin)
+ return 1
+ ;;
+ esac
+ ;;
esac
return 0
}
@@ -175,6 +220,63 @@ require()
quick_exit
}
+if [ "${os}" = "FreeBSD" ]; then
+mountpoint()
+{
+ df $1 | tail -1 | awk '{ print $6 }'
+}
+
+mount_options()
+{
+ mount -p | awk '$2 == "'$(mountpoint .)'" { print $4 }' | sed -e 's/,/ /g'
+}
+
+nfsv4acls()
+{
+ if mount_options | grep -q nfsv4acls; then
+ return 0
+ fi
+ return 1
+}
+
+noexec()
+{
+ if mount_options | grep -q noexec; then
+ return 0
+ fi
+ return 1
+}
+
+nosuid()
+{
+ if mount_options | grep -q nosuid; then
+ return 0
+ fi
+ return 1
+}
+else
+mountpoint()
+{
+ return 1
+}
+mount_options()
+{
+ return 1
+}
+nfsv4acls()
+{
+ return 1
+}
+noexec()
+{
+ return 1
+}
+nosuid()
+{
+ return 1
+}
+fi
+
# usage:
# create_file <type> <name>
# create_file <type> <name> <mode>
@@ -211,11 +313,19 @@ create_file() {
;;
esac
if [ -n "${3}" -a -n "${4}" -a -n "${5}" ]; then
- expect 0 lchmod ${name} ${3}
+ if [ "${type}" = symlink ]; then
+ expect 0 lchmod ${name} ${3}
+ else
+ expect 0 chmod ${name} ${3}
+ fi
expect 0 lchown ${name} ${4} ${5}
elif [ -n "${3}" -a -n "${4}" ]; then
expect 0 lchown ${name} ${3} ${4}
elif [ -n "${3}" ]; then
- expect 0 lchmod ${name} ${3}
+ if [ "${type}" = symlink ]; then
+ expect 0 lchmod ${name} ${3}
+ else
+ expect 0 chmod ${name} ${3}
+ fi
fi
}
diff --git a/tests/mkdir/00.t b/tests/mkdir/00.t
index fa1cbc126ebe0..470b433bc47e4 100644
--- a/tests/mkdir/00.t
+++ b/tests/mkdir/00.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/00.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkdir creates directories"
diff --git a/tests/mkdir/01.t b/tests/mkdir/01.t
index c33ce1fe9a091..02a19584865d4 100644
--- a/tests/mkdir/01.t
+++ b/tests/mkdir/01.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/01.t 211474 2010-08-18 22:06:43Z pjd $
desc="mkdir returns ENOTDIR if a component of the path prefix is not a directory"
diff --git a/tests/mkdir/02.t b/tests/mkdir/02.t
index e877f20f4c105..8197e2ed546be 100644
--- a/tests/mkdir/02.t
+++ b/tests/mkdir/02.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/02.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkdir returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters"
diff --git a/tests/mkdir/03.t b/tests/mkdir/03.t
index 57ddd20a86274..bac61c662ec02 100644
--- a/tests/mkdir/03.t
+++ b/tests/mkdir/03.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/03.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkdir returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters"
diff --git a/tests/mkdir/04.t b/tests/mkdir/04.t
index 0917ef15516d1..da8fbaaee07a2 100644
--- a/tests/mkdir/04.t
+++ b/tests/mkdir/04.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/04.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkdir returns ENOENT if a component of the path prefix does not exist"
diff --git a/tests/mkdir/05.t b/tests/mkdir/05.t
index de351ca37ca7b..f633c920ae161 100644
--- a/tests/mkdir/05.t
+++ b/tests/mkdir/05.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/05.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkdir returns EACCES when search permission is denied for a component of the path prefix"
diff --git a/tests/mkdir/06.t b/tests/mkdir/06.t
index 2d2b8c22234b9..c5f69ff5988b5 100644
--- a/tests/mkdir/06.t
+++ b/tests/mkdir/06.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/06.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkdir returns EACCES when write permission is denied on the parent directory of the directory to be created"
diff --git a/tests/mkdir/07.t b/tests/mkdir/07.t
index 72ac2b69499f1..611bfdab637bb 100644
--- a/tests/mkdir/07.t
+++ b/tests/mkdir/07.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/07.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkdir returns ELOOP if too many symbolic links were encountered in translating the pathname"
diff --git a/tests/mkdir/08.t b/tests/mkdir/08.t
index 366f223a8074f..a48d31f2a666c 100644
--- a/tests/mkdir/08.t
+++ b/tests/mkdir/08.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/08.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkdir returns EPERM if the parent directory of the directory to be created has its immutable flag set"
diff --git a/tests/mkdir/09.t b/tests/mkdir/09.t
index 502672e73b708..a964c74d1246c 100644
--- a/tests/mkdir/09.t
+++ b/tests/mkdir/09.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/09.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkdir returns EROFS if the named file resides on a read-only file system"
@@ -14,9 +15,9 @@ n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 1m`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 1m` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
expect 0 mkdir ${n0}/${n1} 0755
expect 0 rmdir ${n0}/${n1}
mount -ur /dev/md${n}
@@ -25,5 +26,5 @@ mount -uw /dev/md${n}
expect 0 mkdir ${n0}/${n1} 0755
expect 0 rmdir ${n0}/${n1}
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/mkdir/10.t b/tests/mkdir/10.t
index 732dcb882562f..a8c4fefa7b576 100644
--- a/tests/mkdir/10.t
+++ b/tests/mkdir/10.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/10.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkdir returns EEXIST if the named file exists"
diff --git a/tests/mkdir/11.t b/tests/mkdir/11.t
index 0c400c16db96a..118ca3af88963 100644
--- a/tests/mkdir/11.t
+++ b/tests/mkdir/11.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/11.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkdir returns ENOSPC if there are no free inodes on the file system on which the directory is being created"
@@ -14,9 +15,9 @@ n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 256k`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 512k` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
i=0
while :; do
mkdir ${n0}/${i} >/dev/null 2>&1
@@ -27,5 +28,5 @@ while :; do
done
expect ENOSPC mkdir ${n0}/${n1} 0755
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/mkdir/12.t b/tests/mkdir/12.t
index 7c27f74264f65..47dea53ca3daf 100644
--- a/tests/mkdir/12.t
+++ b/tests/mkdir/12.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/12.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkdir returns EFAULT if the path argument points outside the process's allocated address space"
diff --git a/tests/mkfifo/00.t b/tests/mkfifo/00.t
index ad88e2836fbbf..59825172706eb 100644
--- a/tests/mkfifo/00.t
+++ b/tests/mkfifo/00.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/00.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkfifo creates fifo files"
diff --git a/tests/mkfifo/01.t b/tests/mkfifo/01.t
index fae5c23091bc5..b3156e95c528b 100644
--- a/tests/mkfifo/01.t
+++ b/tests/mkfifo/01.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/01.t 211474 2010-08-18 22:06:43Z pjd $
desc="mkfifo returns ENOTDIR if a component of the path prefix is not a directory"
diff --git a/tests/mkfifo/02.t b/tests/mkfifo/02.t
index e51bcd5fdff20..f6fb3f1f93dc2 100644
--- a/tests/mkfifo/02.t
+++ b/tests/mkfifo/02.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/02.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkfifo returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters"
diff --git a/tests/mkfifo/03.t b/tests/mkfifo/03.t
index 06265293517bc..397640a93fd66 100644
--- a/tests/mkfifo/03.t
+++ b/tests/mkfifo/03.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/03.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkfifo returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters"
diff --git a/tests/mkfifo/04.t b/tests/mkfifo/04.t
index 981015808a186..0e0a4b76f5cae 100644
--- a/tests/mkfifo/04.t
+++ b/tests/mkfifo/04.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/04.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkfifo returns ENOENT if a component of the path prefix does not exist"
diff --git a/tests/mkfifo/05.t b/tests/mkfifo/05.t
index a9510e2848412..bd3771b4a8c98 100644
--- a/tests/mkfifo/05.t
+++ b/tests/mkfifo/05.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/05.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkfifo returns EACCES when search permission is denied for a component of the path prefix"
diff --git a/tests/mkfifo/06.t b/tests/mkfifo/06.t
index a1fa76135152b..52a5c278e8a6b 100644
--- a/tests/mkfifo/06.t
+++ b/tests/mkfifo/06.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/06.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkfifo returns EACCES when write permission is denied on the parent directory of the file to be created"
diff --git a/tests/mkfifo/07.t b/tests/mkfifo/07.t
index 0ba1ac4bde307..1a11eb39321fa 100644
--- a/tests/mkfifo/07.t
+++ b/tests/mkfifo/07.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/07.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkfifo returns ELOOP if too many symbolic links were encountered in translating the pathname"
diff --git a/tests/mkfifo/08.t b/tests/mkfifo/08.t
index 7866c61362e58..7ac6f8b566db3 100644
--- a/tests/mkfifo/08.t
+++ b/tests/mkfifo/08.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/08.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkfifo returns EROFS if the named file resides on a read-only file system"
@@ -14,9 +15,9 @@ n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 1m`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 1m` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
mount -ur /dev/md${n}
@@ -25,5 +26,5 @@ mount -uw /dev/md${n}
expect 0 mkfifo ${n0}/${n1} 0644
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/mkfifo/09.t b/tests/mkfifo/09.t
index 15af5d1061802..80437d3325c9a 100644
--- a/tests/mkfifo/09.t
+++ b/tests/mkfifo/09.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/09.t 211474 2010-08-18 22:06:43Z pjd $
desc="mkfifo returns EEXIST if the named file exists"
diff --git a/tests/mkfifo/10.t b/tests/mkfifo/10.t
index 4c8bcab5ff21f..dfa4c61e997cc 100644
--- a/tests/mkfifo/10.t
+++ b/tests/mkfifo/10.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/10.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkfifo returns EPERM if the parent directory of the file to be created has its immutable flag set"
diff --git a/tests/mkfifo/11.t b/tests/mkfifo/11.t
index a82fe0f40cd7d..39cfea4e40f7e 100644
--- a/tests/mkfifo/11.t
+++ b/tests/mkfifo/11.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/11.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkfifo returns ENOSPC if there are no free inodes on the file system on which the file is being created"
@@ -14,9 +15,9 @@ n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 256k`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 512k` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
i=0
while :; do
mkfifo ${n0}/${i} >/dev/null 2>&1
@@ -27,5 +28,5 @@ while :; do
done
expect ENOSPC mkfifo ${n0}/${n1} 0644
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/mkfifo/12.t b/tests/mkfifo/12.t
index ad044b9f702c5..c7f8107bad841 100644
--- a/tests/mkfifo/12.t
+++ b/tests/mkfifo/12.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mkfifo/12.t 211352 2010-08-15 21:24:17Z pjd $
desc="mkfifo returns EFAULT if the path argument points outside the process's allocated address space"
diff --git a/tests/mknod/00.t b/tests/mknod/00.t
index 67f4046a6ffb8..f10aa7f1926a6 100644
--- a/tests/mknod/00.t
+++ b/tests/mknod/00.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/00.t 211352 2010-08-15 21:24:17Z pjd $
desc="mknod creates fifo files"
@@ -49,7 +50,7 @@ expect 0 -u 65534 -g 65533 mknod ${n0} f 0755 0 0
expect "65534,6553[35]" lstat ${n0} uid,gid
expect 0 unlink ${n0}
-# POSIX: Upon successful completion, mkfifo() shall mark for update the
+# POSIX: Upon successful completion, mknod() shall mark for update the
# st_atime, st_ctime, and st_mtime fields of the file. Also, the st_ctime and
# st_mtime fields of the directory that contains the new entry shall be marked
# for update.
diff --git a/tests/mknod/01.t b/tests/mknod/01.t
index 84a0a9731cd72..407da5aa82c76 100644
--- a/tests/mknod/01.t
+++ b/tests/mknod/01.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/01.t 211474 2010-08-18 22:06:43Z pjd $
desc="mknod returns ENOTDIR if a component of the path prefix is not a directory"
diff --git a/tests/mknod/02.t b/tests/mknod/02.t
index 4e864fe69f696..a923f5ace87eb 100644
--- a/tests/mknod/02.t
+++ b/tests/mknod/02.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/02.t 211352 2010-08-15 21:24:17Z pjd $
desc="mknod returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters"
diff --git a/tests/mknod/03.t b/tests/mknod/03.t
index d5c572cbf4600..e400f89c7d638 100644
--- a/tests/mknod/03.t
+++ b/tests/mknod/03.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/03.t 211352 2010-08-15 21:24:17Z pjd $
desc="mknod returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters"
diff --git a/tests/mknod/04.t b/tests/mknod/04.t
index 4b80208caffed..1f43e1d2a76c3 100644
--- a/tests/mknod/04.t
+++ b/tests/mknod/04.t
@@ -1,7 +1,8 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/04.t 211352 2010-08-15 21:24:17Z pjd $
-desc="mkfifo returns ENOENT if a component of the path prefix does not exist"
+desc="mknod returns ENOENT if a component of the path prefix does not exist"
dir=`dirname $0`
. ${dir}/../misc.sh
diff --git a/tests/mknod/05.t b/tests/mknod/05.t
index deafda6207501..5d5cbc086cefd 100644
--- a/tests/mknod/05.t
+++ b/tests/mknod/05.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/05.t 211352 2010-08-15 21:24:17Z pjd $
desc="mknod returns EACCES when search permission is denied for a component of the path prefix"
diff --git a/tests/mknod/06.t b/tests/mknod/06.t
index da7a5497b5a62..b6e49904d25aa 100644
--- a/tests/mknod/06.t
+++ b/tests/mknod/06.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/06.t 211352 2010-08-15 21:24:17Z pjd $
desc="mknod returns EACCES when write permission is denied on the parent directory of the file to be created"
diff --git a/tests/mknod/07.t b/tests/mknod/07.t
index 1b39cc7c6d94b..6aed4bbd6c693 100644
--- a/tests/mknod/07.t
+++ b/tests/mknod/07.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/07.t 211352 2010-08-15 21:24:17Z pjd $
desc="mknod returns ELOOP if too many symbolic links were encountered in translating the pathname"
diff --git a/tests/mknod/08.t b/tests/mknod/08.t
index a8055629de076..336993591a7e5 100644
--- a/tests/mknod/08.t
+++ b/tests/mknod/08.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/08.t 211474 2010-08-18 22:06:43Z pjd $
desc="mknod returns EEXIST if the named file exists"
diff --git a/tests/mknod/09.t b/tests/mknod/09.t
index 00c2a2f6d8b58..6156cb2560d0d 100644
--- a/tests/mknod/09.t
+++ b/tests/mknod/09.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/09.t 211352 2010-08-15 21:24:17Z pjd $
desc="mknod returns EPERM if the parent directory of the file to be created has its immutable flag set"
diff --git a/tests/mknod/10.t b/tests/mknod/10.t
index 5bf18d37adc45..16d6071a61385 100644
--- a/tests/mknod/10.t
+++ b/tests/mknod/10.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/10.t 211352 2010-08-15 21:24:17Z pjd $
desc="mknod returns EFAULT if the path argument points outside the process's allocated address space"
diff --git a/tests/mknod/11.t b/tests/mknod/11.t
index 309f71695f312..e4d2da80121ab 100644
--- a/tests/mknod/11.t
+++ b/tests/mknod/11.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/11.t 211352 2010-08-15 21:24:17Z pjd $
desc="mknod creates device files"
diff --git a/tests/open/00.t b/tests/open/00.t
index cf11a9290e8e6..1256761aa0c60 100644
--- a/tests/open/00.t
+++ b/tests/open/00.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/00.t 211352 2010-08-15 21:24:17Z pjd $
desc="open opens (and eventually creates) a file"
diff --git a/tests/open/01.t b/tests/open/01.t
index df17590113aba..d11c92521bc29 100644
--- a/tests/open/01.t
+++ b/tests/open/01.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/01.t 211474 2010-08-18 22:06:43Z pjd $
desc="open returns ENOTDIR if a component of the path prefix is not a directory"
diff --git a/tests/open/02.t b/tests/open/02.t
index adb3bb09d39b5..292a0073fba8e 100644
--- a/tests/open/02.t
+++ b/tests/open/02.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/02.t 211352 2010-08-15 21:24:17Z pjd $
desc="open returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters"
diff --git a/tests/open/03.t b/tests/open/03.t
index 89e67bb46eb27..9137cc7a45ff1 100644
--- a/tests/open/03.t
+++ b/tests/open/03.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/03.t 211352 2010-08-15 21:24:17Z pjd $
desc="open returns ENAMETOOLONG if an entire path name exceeded ${PATH_MAX} characters"
diff --git a/tests/open/04.t b/tests/open/04.t
index 84b0441f11d87..faaeaf24042e5 100644
--- a/tests/open/04.t
+++ b/tests/open/04.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/04.t 211352 2010-08-15 21:24:17Z pjd $
desc="open returns ENOENT if a component of the path name that must exist does not exist or O_CREAT is not set and the named file does not exist"
diff --git a/tests/open/05.t b/tests/open/05.t
index 1b69c61333c3f..d3c6b7e82af13 100644
--- a/tests/open/05.t
+++ b/tests/open/05.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/05.t 211352 2010-08-15 21:24:17Z pjd $
desc="open returns EACCES when search permission is denied for a component of the path prefix"
diff --git a/tests/open/06.t b/tests/open/06.t
index b33e6404e70bb..75445f5f0b574 100644
--- a/tests/open/06.t
+++ b/tests/open/06.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/06.t 211352 2010-08-15 21:24:17Z pjd $
desc="open returns EACCES when the required permissions (for reading and/or writing) are denied for the given flags"
diff --git a/tests/open/07.t b/tests/open/07.t
index edc4be13649b9..49e5b521c0377 100644
--- a/tests/open/07.t
+++ b/tests/open/07.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/07.t 211352 2010-08-15 21:24:17Z pjd $
desc="open returns EACCES when O_TRUNC is specified and write permission is denied"
diff --git a/tests/open/08.t b/tests/open/08.t
index f47ff87204193..e3235bc5b684b 100644
--- a/tests/open/08.t
+++ b/tests/open/08.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/08.t 211352 2010-08-15 21:24:17Z pjd $
desc="open returns EACCES when O_CREAT is specified, the file does not exist, and the directory in which it is to be created does not permit writing"
diff --git a/tests/open/09.t b/tests/open/09.t
index b76c70da8190e..5eab2f6d728a8 100644
--- a/tests/open/09.t
+++ b/tests/open/09.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/09.t 211352 2010-08-15 21:24:17Z pjd $
desc="O_CREAT is specified, the file does not exist, and the directory in which it is to be created has its immutable flag set"
diff --git a/tests/open/10.t b/tests/open/10.t
index bd6fdd25241fc..57eb6f90e62a6 100644
--- a/tests/open/10.t
+++ b/tests/open/10.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/10.t 211352 2010-08-15 21:24:17Z pjd $
desc="open returns EPERM when the named file has its immutable flag set and the file is to be modified"
diff --git a/tests/open/11.t b/tests/open/11.t
index e4a3a2d45e8fd..3449ead38b835 100644
--- a/tests/open/11.t
+++ b/tests/open/11.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/11.t 211352 2010-08-15 21:24:17Z pjd $
desc="open returns EPERM when the named file has its append-only flag set, the file is to be modified, and O_TRUNC is specified or O_APPEND is not specified"
diff --git a/tests/open/12.t b/tests/open/12.t
index d38309d4a1189..289c93bcd4f56 100644
--- a/tests/open/12.t
+++ b/tests/open/12.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/12.t 211352 2010-08-15 21:24:17Z pjd $
desc="open returns ELOOP if too many symbolic links were encountered in translating the pathname"
diff --git a/tests/open/13.t b/tests/open/13.t
index 64bb0b8f825f6..b37bf663fb32d 100644
--- a/tests/open/13.t
+++ b/tests/open/13.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/13.t 211352 2010-08-15 21:24:17Z pjd $
desc="open returns EISDIR when trying to open a directory for writing"
diff --git a/tests/open/14.t b/tests/open/14.t
index a9c637f4cc0de..9e085d6d88cef 100644
--- a/tests/open/14.t
+++ b/tests/open/14.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/14.t 211352 2010-08-15 21:24:17Z pjd $
desc="open returns EROFS if the named file resides on a read-only file system, and the file is to be modified"
@@ -14,9 +15,9 @@ n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 1m`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 1m` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
expect 0 create ${n0}/${n1} 0644
expect 0 open ${n0}/${n1} O_WRONLY
expect 0 open ${n0}/${n1} O_RDWR
@@ -28,5 +29,5 @@ expect EROFS open ${n0}/${n1} O_RDONLY,O_TRUNC
mount -uw /dev/md${n}
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/open/15.t b/tests/open/15.t
index 1e00db130fe4c..336f99f434281 100644
--- a/tests/open/15.t
+++ b/tests/open/15.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/15.t 211352 2010-08-15 21:24:17Z pjd $
desc="open returns EROFS when O_CREAT is specified and the named file would reside on a read-only file system"
@@ -14,14 +15,14 @@ n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 1m`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 1m` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
expect 0 open ${n0}/${n1} O_RDONLY,O_CREAT 0644
expect 0 unlink ${n0}/${n1}
mount -ur /dev/md${n}
expect EROFS open ${n0}/${n1} O_RDONLY,O_CREAT 0644
mount -uw /dev/md${n}
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/open/16.t b/tests/open/16.t
index 598ed895a68e6..ed674ab3911cb 100644
--- a/tests/open/16.t
+++ b/tests/open/16.t
@@ -1,19 +1,25 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/16.t 219621 2011-03-13 19:35:13Z pjd $
-desc="open returns ELOOP when O_NOFOLLOW was specified and the target is a symbolic link"
-
dir=`dirname $0`
. ${dir}/../misc.sh
+if [ "${os}" = "FreeBSD" ]; then
+ error=EMLINK
+else
+ error=ELOOP
+fi
+desc="open returns $error when O_NOFOLLOW was specified and the target is a symbolic link"
+
echo "1..6"
n0=`namegen`
n1=`namegen`
expect 0 symlink ${n0} ${n1}
-expect ELOOP open ${n1} O_RDONLY,O_CREAT,O_NOFOLLOW 0644
-expect ELOOP open ${n1} O_RDONLY,O_NOFOLLOW
-expect ELOOP open ${n1} O_WRONLY,O_NOFOLLOW
-expect ELOOP open ${n1} O_RDWR,O_NOFOLLOW
+expect $error open ${n1} O_RDONLY,O_CREAT,O_NOFOLLOW 0644
+expect $error open ${n1} O_RDONLY,O_NOFOLLOW
+expect $error open ${n1} O_WRONLY,O_NOFOLLOW
+expect $error open ${n1} O_RDWR,O_NOFOLLOW
expect 0 unlink ${n1}
diff --git a/tests/open/17.t b/tests/open/17.t
index e5888fc176f28..27ac9a8c3576c 100644
--- a/tests/open/17.t
+++ b/tests/open/17.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/17.t 211352 2010-08-15 21:24:17Z pjd $
desc="open returns ENXIO when O_NONBLOCK is set, the named file is a fifo, O_WRONLY is set, and no process has the file open for reading"
diff --git a/tests/open/18.t b/tests/open/18.t
index 6d0713b43a897..8fecfdea1e5d1 100644
--- a/tests/open/18.t
+++ b/tests/open/18.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/18.t 211352 2010-08-15 21:24:17Z pjd $
desc="open returns EWOULDBLOCK when O_NONBLOCK and one of O_SHLOCK or O_EXLOCK is specified and the file is locked"
diff --git a/tests/open/19.t b/tests/open/19.t
index 29f2a3689f02a..4bc2df2a4313e 100644
--- a/tests/open/19.t
+++ b/tests/open/19.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/19.t 211352 2010-08-15 21:24:17Z pjd $
desc="open returns ENOSPC when O_CREAT is specified, the file does not exist, and there are no free inodes on the file system on which the file is being created"
@@ -14,9 +15,9 @@ n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 256k`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 512k` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
i=0
while :; do
touch ${n0}/${i} >/dev/null 2>&1
@@ -27,5 +28,5 @@ while :; do
done
expect ENOSPC open ${n0}/${i} O_RDONLY,O_CREAT 0644
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/open/20.t b/tests/open/20.t
index de80b6122b7d4..974f8b5c935cd 100644
--- a/tests/open/20.t
+++ b/tests/open/20.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/20.t 211352 2010-08-15 21:24:17Z pjd $
desc="open returns ETXTBSY when the file is a pure procedure (shared text) file that is being executed and the open() system call requests write access"
@@ -7,6 +8,7 @@ dir=`dirname $0`
. ${dir}/../misc.sh
[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
+noexec && quick_exit
echo "1..4"
diff --git a/tests/open/21.t b/tests/open/21.t
index 4a2422cfa6aa6..f8436da963b18 100644
--- a/tests/open/21.t
+++ b/tests/open/21.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/21.t 211352 2010-08-15 21:24:17Z pjd $
desc="open returns EFAULT if the path argument points outside the process's allocated address space"
diff --git a/tests/open/22.t b/tests/open/22.t
index 55d4b9b3f8a38..b0444affa488a 100644
--- a/tests/open/22.t
+++ b/tests/open/22.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/22.t 211352 2010-08-15 21:24:17Z pjd $
desc="open returns EEXIST when O_CREAT and O_EXCL were specified and the file exists"
diff --git a/tests/open/23.t b/tests/open/23.t
index 4728c18896cd3..78709d75a1866 100644
--- a/tests/open/23.t
+++ b/tests/open/23.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/23.t 211352 2010-08-15 21:24:17Z pjd $
desc="open may return EINVAL when an attempt was made to open a descriptor with an illegal combination of O_RDONLY, O_WRONLY, and O_RDWR"
diff --git a/tests/open/24.t b/tests/open/24.t
index ca709f2212149..c899be00f363f 100644
--- a/tests/open/24.t
+++ b/tests/open/24.t
@@ -1,17 +1,32 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/open/24.t 211352 2010-08-15 21:24:17Z pjd $
-desc="open returns EOPNOTSUPP when trying to open UNIX domain socket"
-
dir=`dirname $0`
. ${dir}/../misc.sh
+# POSIX doesn't explicitly state the errno for open(2)'ing sockets.
+case ${os} in
+Darwin|FreeBSD)
+ expected_error=EOPNOTSUPP
+ ;;
+Linux)
+ expected_error=ENXIO
+ ;;
+*)
+ echo "1..0 # SKIP: unsupported OS: ${os}"
+ exit 0
+ ;;
+esac
+
+desc="open returns $expected_error when trying to open UNIX domain socket"
+
echo "1..5"
n0=`namegen`
expect 0 bind ${n0}
-expect "EOPNOTSUPP" open ${n0} O_RDONLY
-expect "EOPNOTSUPP" open ${n0} O_WRONLY
-expect "EOPNOTSUPP" open ${n0} O_RDWR
+expect $expected_error open ${n0} O_RDONLY
+expect $expected_error open ${n0} O_WRONLY
+expect $expected_error open ${n0} O_RDWR
expect 0 unlink ${n0}
diff --git a/tests/rename/00.t b/tests/rename/00.t
index 2126a86a54881..df76de119e60e 100644
--- a/tests/rename/00.t
+++ b/tests/rename/00.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/00.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename changes file name"
diff --git a/tests/rename/01.t b/tests/rename/01.t
index dbb9c0660d41d..836b60434eb34 100644
--- a/tests/rename/01.t
+++ b/tests/rename/01.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/01.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename returns ENAMETOOLONG if a component of either pathname exceeded {NAME_MAX} characters"
diff --git a/tests/rename/02.t b/tests/rename/02.t
index 23425bada559d..b7176f395862c 100644
--- a/tests/rename/02.t
+++ b/tests/rename/02.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/02.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename returns ENAMETOOLONG if an entire length of either path name exceeded {PATH_MAX} characters"
diff --git a/tests/rename/03.t b/tests/rename/03.t
index fb1d16f10d108..8e33079fa4f6e 100644
--- a/tests/rename/03.t
+++ b/tests/rename/03.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/03.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename returns ENOENT if a component of the 'from' path does not exist, or a path prefix of 'to' does not exist"
diff --git a/tests/rename/04.t b/tests/rename/04.t
index 19d1791a71a81..940574e1ad934 100644
--- a/tests/rename/04.t
+++ b/tests/rename/04.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/04.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename returns EACCES when a component of either path prefix denies search permission"
diff --git a/tests/rename/05.t b/tests/rename/05.t
index 52deac153b8c6..5ee0e4917daba 100644
--- a/tests/rename/05.t
+++ b/tests/rename/05.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/05.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename returns EACCES when the requested link requires writing in a directory with a mode that denies write permission"
diff --git a/tests/rename/06.t b/tests/rename/06.t
index ffcf61e83a5ce..4ed418b2a9693 100644
--- a/tests/rename/06.t
+++ b/tests/rename/06.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/06.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename returns EPERM if the file pointed at by the 'from' argument has its immutable, undeletable or append-only flag set"
diff --git a/tests/rename/07.t b/tests/rename/07.t
index 522e67df91818..297f952add9df 100644
--- a/tests/rename/07.t
+++ b/tests/rename/07.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/07.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename returns EPERM if the parent directory of the file pointed at by the 'from' argument has its immutable or append-only flag set"
diff --git a/tests/rename/08.t b/tests/rename/08.t
index beffb41f8785c..84f25364816bd 100644
--- a/tests/rename/08.t
+++ b/tests/rename/08.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/08.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename returns EPERM if the parent directory of the file pointed at by the 'to' argument has its immutable flag set"
diff --git a/tests/rename/09.t b/tests/rename/09.t
index 299ff64c57e0c..de401caea4618 100644
--- a/tests/rename/09.t
+++ b/tests/rename/09.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/09.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename returns EACCES or EPERM if the directory containing 'from' is marked sticky, and neither the containing directory nor 'from' are owned by the effective user ID"
diff --git a/tests/rename/10.t b/tests/rename/10.t
index 268c3b647de10..91c7843582c00 100644
--- a/tests/rename/10.t
+++ b/tests/rename/10.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/10.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename returns EACCES or EPERM if the file pointed at by the 'to' argument exists, the directory containing 'to' is marked sticky, and neither the containing directory nor 'to' are owned by the effective user ID"
diff --git a/tests/rename/11.t b/tests/rename/11.t
index 3bcd97ed18f3d..3816d0808d9b9 100644
--- a/tests/rename/11.t
+++ b/tests/rename/11.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/11.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename returns ELOOP if too many symbolic links were encountered in translating one of the pathnames"
diff --git a/tests/rename/12.t b/tests/rename/12.t
index c8939fe85ebf1..5c122e6a96ce5 100644
--- a/tests/rename/12.t
+++ b/tests/rename/12.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/12.t 211474 2010-08-18 22:06:43Z pjd $
desc="rename returns ENOTDIR if a component of either path prefix is not a directory"
diff --git a/tests/rename/13.t b/tests/rename/13.t
index 00b0bfb6f577b..7e06cc9490842 100644
--- a/tests/rename/13.t
+++ b/tests/rename/13.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/13.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename returns ENOTDIR when the 'from' argument is a directory, but 'to' is not a directory"
diff --git a/tests/rename/14.t b/tests/rename/14.t
index 251a1bd663936..d050db9a1c5a3 100644
--- a/tests/rename/14.t
+++ b/tests/rename/14.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/14.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename returns EISDIR when the 'to' argument is a directory, but 'from' is not a directory"
diff --git a/tests/rename/15.t b/tests/rename/15.t
index 4fc9afbf49bc3..5a8401361d9da 100644
--- a/tests/rename/15.t
+++ b/tests/rename/15.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/15.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename returns EXDEV if the link named by 'to' and the file named by 'from' are on different file systems"
@@ -15,9 +16,9 @@ n1=`namegen`
n2=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 1m`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 1m` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
for type in regular dir fifo block char socket symlink; do
create_file ${type} ${n0}/${n1}
@@ -30,5 +31,5 @@ for type in regular dir fifo block char socket symlink; do
done
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/rename/16.t b/tests/rename/16.t
index 898c95a70a782..ec14a97f74975 100644
--- a/tests/rename/16.t
+++ b/tests/rename/16.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/16.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename returns EROFS if the requested link requires writing in a directory on a read-only file system"
@@ -15,9 +16,9 @@ n1=`namegen`
n2=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 1m`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 1m` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
expect 0 create ${n0}/${n1} 0644
mount -ur /dev/md${n}
@@ -28,5 +29,5 @@ expect EROFS rename ${n2} ${n0}/${n2}
expect 0 unlink ${n2}
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/rename/17.t b/tests/rename/17.t
index 6deb7b704f06e..790ea1c18e518 100644
--- a/tests/rename/17.t
+++ b/tests/rename/17.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/17.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename returns EFAULT if one of the pathnames specified is outside the process's allocated address space"
diff --git a/tests/rename/18.t b/tests/rename/18.t
index 8a9594ec4127c..342596352ad9a 100644
--- a/tests/rename/18.t
+++ b/tests/rename/18.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/18.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename returns EINVAL when the 'from' argument is a parent directory of 'to'"
diff --git a/tests/rename/19.t b/tests/rename/19.t
index 2cd95615e42b1..787dff694b643 100644
--- a/tests/rename/19.t
+++ b/tests/rename/19.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/19.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename returns EINVAL/EBUSY when an attempt is made to rename '.' or '..'"
diff --git a/tests/rename/20.t b/tests/rename/20.t
index 8ec37cf7d4ccc..b587278e5ab77 100644
--- a/tests/rename/20.t
+++ b/tests/rename/20.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/20.t 211352 2010-08-15 21:24:17Z pjd $
desc="rename returns EEXIST or ENOTEMPTY if the 'to' argument is a directory and is not empty"
diff --git a/tests/rename/21.t b/tests/rename/21.t
index bba1467069da1..0489c5c1fc08a 100644
--- a/tests/rename/21.t
+++ b/tests/rename/21.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/21.t 211352 2010-08-15 21:24:17Z pjd $
desc="write access to subdirectory is required to move it to another directory"
diff --git a/tests/rmdir/00.t b/tests/rmdir/00.t
index 9e75be6b9884a..872d423c8e802 100644
--- a/tests/rmdir/00.t
+++ b/tests/rmdir/00.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/00.t 211352 2010-08-15 21:24:17Z pjd $
desc="rmdir removes directories"
diff --git a/tests/rmdir/01.t b/tests/rmdir/01.t
index b89ffefbe7631..bf5fa7a6b982a 100644
--- a/tests/rmdir/01.t
+++ b/tests/rmdir/01.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/01.t 211352 2010-08-15 21:24:17Z pjd $
desc="rmdir returns ENOTDIR if a component of the path is not a directory"
diff --git a/tests/rmdir/02.t b/tests/rmdir/02.t
index eb8a774bf2400..46d504003febb 100644
--- a/tests/rmdir/02.t
+++ b/tests/rmdir/02.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/02.t 211352 2010-08-15 21:24:17Z pjd $
desc="rmdir returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters"
diff --git a/tests/rmdir/03.t b/tests/rmdir/03.t
index 3d5a11a3611dd..d3c5153fcaa99 100644
--- a/tests/rmdir/03.t
+++ b/tests/rmdir/03.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/03.t 211352 2010-08-15 21:24:17Z pjd $
desc="rmdir returns ENAMETOOLONG if an entire path name exceeded ${PATH_MAX} characters"
diff --git a/tests/rmdir/04.t b/tests/rmdir/04.t
index d5abc31cfd18d..a9a06dc327a34 100644
--- a/tests/rmdir/04.t
+++ b/tests/rmdir/04.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/04.t 211352 2010-08-15 21:24:17Z pjd $
desc="rmdir returns ENOENT if the named directory does not exist"
diff --git a/tests/rmdir/05.t b/tests/rmdir/05.t
index eb984533d0570..b6237215ee2eb 100644
--- a/tests/rmdir/05.t
+++ b/tests/rmdir/05.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/05.t 211352 2010-08-15 21:24:17Z pjd $
desc="rmdir returns ELOOP if too many symbolic links were encountered in translating the pathname"
diff --git a/tests/rmdir/06.t b/tests/rmdir/06.t
index 64a6ac85fe49f..371649cb49299 100644
--- a/tests/rmdir/06.t
+++ b/tests/rmdir/06.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/06.t 211474 2010-08-18 22:06:43Z pjd $
desc="rmdir returns EEXIST or ENOTEMPTY the named directory contains files other than '.' and '..' in it"
diff --git a/tests/rmdir/07.t b/tests/rmdir/07.t
index 10a78a71e9d59..1191fd46074c9 100644
--- a/tests/rmdir/07.t
+++ b/tests/rmdir/07.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/07.t 211352 2010-08-15 21:24:17Z pjd $
desc="rmdir returns EACCES when search permission is denied for a component of the path prefix"
diff --git a/tests/rmdir/08.t b/tests/rmdir/08.t
index fe70c8683d0b0..2999ff6dd4475 100644
--- a/tests/rmdir/08.t
+++ b/tests/rmdir/08.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/08.t 211352 2010-08-15 21:24:17Z pjd $
desc="rmdir returns EACCES when write permission is denied on the directory containing the link to be removed"
diff --git a/tests/rmdir/09.t b/tests/rmdir/09.t
index 8b0276c980ed4..095d9330f6ee7 100644
--- a/tests/rmdir/09.t
+++ b/tests/rmdir/09.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/09.t 211352 2010-08-15 21:24:17Z pjd $
desc="rmdir returns EPERM if the named directory has its immutable, undeletable or append-only flag set"
diff --git a/tests/rmdir/10.t b/tests/rmdir/10.t
index 5d2e37ef45574..5c088d578503b 100644
--- a/tests/rmdir/10.t
+++ b/tests/rmdir/10.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/10.t 211352 2010-08-15 21:24:17Z pjd $
desc="rmdir returns EPERM if the parent directory of the named file has its immutable or append-only flag set"
diff --git a/tests/rmdir/11.t b/tests/rmdir/11.t
index b8e0591354006..fd6b6e21f90b9 100644
--- a/tests/rmdir/11.t
+++ b/tests/rmdir/11.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/11.t 211352 2010-08-15 21:24:17Z pjd $
desc="rmdir returns EACCES or EPERM if the directory containing the directory to be removed is marked sticky, and neither the containing directory nor the directory to be removed are owned by the effective user ID"
diff --git a/tests/rmdir/12.t b/tests/rmdir/12.t
index 57d144da58f2e..cd0bc911c31b0 100644
--- a/tests/rmdir/12.t
+++ b/tests/rmdir/12.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/12.t 211352 2010-08-15 21:24:17Z pjd $
desc="rmdir returns EINVAL if the last component of the path is '.' and EEXIST or ENOTEMPTY if the last component of the path is '..'"
diff --git a/tests/rmdir/13.t b/tests/rmdir/13.t
index 3b12fc5872d19..a4cd55d65fd85 100644
--- a/tests/rmdir/13.t
+++ b/tests/rmdir/13.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/13.t 211352 2010-08-15 21:24:17Z pjd $
desc="rmdir returns EBUSY if the directory to be removed is the mount point for a mounted file system"
@@ -13,10 +14,10 @@ echo "1..3"
n0=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 1m`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 1m` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
expect EBUSY rmdir ${n0}
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/rmdir/14.t b/tests/rmdir/14.t
index bc72920e2e54f..de8e9697101a6 100644
--- a/tests/rmdir/14.t
+++ b/tests/rmdir/14.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/14.t 211352 2010-08-15 21:24:17Z pjd $
desc="rmdir returns EROFS if the named file resides on a read-only file system"
@@ -14,14 +15,14 @@ n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 1m`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 1m` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
expect 0 mkdir ${n0}/${n1} 0755
mount -ur /dev/md${n}
expect EROFS rmdir ${n0}/${n1}
mount -uw /dev/md${n}
expect 0 rmdir ${n0}/${n1}
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/rmdir/15.t b/tests/rmdir/15.t
index 5390403bcb3ef..a81ab2b5aeaa8 100644
--- a/tests/rmdir/15.t
+++ b/tests/rmdir/15.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/rmdir/15.t 211352 2010-08-15 21:24:17Z pjd $
desc="rmdir returns EFAULT if the path argument points outside the process's allocated address space"
diff --git a/tests/symlink/00.t b/tests/symlink/00.t
index 1f2693938a35e..2fcd08e4883c4 100644
--- a/tests/symlink/00.t
+++ b/tests/symlink/00.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/00.t 211352 2010-08-15 21:24:17Z pjd $
desc="symlink creates symbolic links"
diff --git a/tests/symlink/01.t b/tests/symlink/01.t
index 3a40b54a45c2f..70a099245cfc3 100644
--- a/tests/symlink/01.t
+++ b/tests/symlink/01.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/01.t 211352 2010-08-15 21:24:17Z pjd $
desc="symlink returns ENOTDIR if a component of the name2 path prefix is not a directory"
diff --git a/tests/symlink/02.t b/tests/symlink/02.t
index 4b81f169f7a65..e1a7c2af50968 100644
--- a/tests/symlink/02.t
+++ b/tests/symlink/02.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/02.t 211352 2010-08-15 21:24:17Z pjd $
desc="symlink returns ENAMETOOLONG if a component of the name2 pathname exceeded {NAME_MAX} characters"
diff --git a/tests/symlink/03.t b/tests/symlink/03.t
index 68ecfbdfecbcf..3982b09dcf4b0 100644
--- a/tests/symlink/03.t
+++ b/tests/symlink/03.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/03.t 211352 2010-08-15 21:24:17Z pjd $
desc="symlink returns ENAMETOOLONG if an entire length of either path name exceeded {PATH_MAX} characters"
diff --git a/tests/symlink/04.t b/tests/symlink/04.t
index ca1c8eedf48b7..fcb805cb097ef 100644
--- a/tests/symlink/04.t
+++ b/tests/symlink/04.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/04.t 211352 2010-08-15 21:24:17Z pjd $
desc="symlink returns ENOENT if a component of the name2 path prefix does not exist"
diff --git a/tests/symlink/05.t b/tests/symlink/05.t
index 801e46714a965..012d4e931c140 100644
--- a/tests/symlink/05.t
+++ b/tests/symlink/05.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/05.t 211352 2010-08-15 21:24:17Z pjd $
desc="symlink returns EACCES when a component of the name2 path prefix denies search permission"
diff --git a/tests/symlink/06.t b/tests/symlink/06.t
index db61ad01c3929..02e9accfc79f5 100644
--- a/tests/symlink/06.t
+++ b/tests/symlink/06.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/06.t 211352 2010-08-15 21:24:17Z pjd $
desc="symlink returns EACCES if the parent directory of the file to be created denies write permission"
diff --git a/tests/symlink/07.t b/tests/symlink/07.t
index c6aedc0570e0e..edc13bda03c64 100644
--- a/tests/symlink/07.t
+++ b/tests/symlink/07.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/07.t 211352 2010-08-15 21:24:17Z pjd $
desc="symlink returns ELOOP if too many symbolic links were encountered in translating the name2 path name"
diff --git a/tests/symlink/08.t b/tests/symlink/08.t
index ef7915dbe72bd..001fffc9c5c37 100644
--- a/tests/symlink/08.t
+++ b/tests/symlink/08.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/08.t 211474 2010-08-18 22:06:43Z pjd $
desc="symlink returns EEXIST if the name2 argument already exists"
diff --git a/tests/symlink/09.t b/tests/symlink/09.t
index 6292aaf7649f4..6469997492224 100644
--- a/tests/symlink/09.t
+++ b/tests/symlink/09.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/09.t 211352 2010-08-15 21:24:17Z pjd $
desc="symlink returns EPERM if the parent directory of the file named by name2 has its immutable flag set"
diff --git a/tests/symlink/10.t b/tests/symlink/10.t
index 34dfa2a337e49..500ccd81695f8 100644
--- a/tests/symlink/10.t
+++ b/tests/symlink/10.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/10.t 211352 2010-08-15 21:24:17Z pjd $
desc="symlink returns EROFS if the file name2 would reside on a read-only file system"
@@ -15,9 +16,9 @@ n1=`namegen`
n2=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 1m`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 1m` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
expect 0 symlink test ${n0}/${n1}
expect 0 unlink ${n0}/${n1}
@@ -28,5 +29,5 @@ expect 0 symlink test ${n0}/${n1}
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/symlink/11.t b/tests/symlink/11.t
index 956a2d4124c1a..b1be674370ad1 100644
--- a/tests/symlink/11.t
+++ b/tests/symlink/11.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/11.t 211352 2010-08-15 21:24:17Z pjd $
desc="symlink returns ENOSPC if there are no free inodes on the file system on which the symbolic link is being created"
@@ -14,9 +15,9 @@ n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 256k`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 512k` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
i=0
while :; do
ln -s test ${n0}/${i} >/dev/null 2>&1
@@ -27,5 +28,5 @@ while :; do
done
expect ENOSPC symlink test ${n0}/${n1}
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/symlink/12.t b/tests/symlink/12.t
index 2c699050e673e..7d6263be1079a 100644
--- a/tests/symlink/12.t
+++ b/tests/symlink/12.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/12.t 211352 2010-08-15 21:24:17Z pjd $
desc="symlink returns EFAULT if one of the pathnames specified is outside the process's allocated address space"
diff --git a/tests/truncate/00.t b/tests/truncate/00.t
index 6a77a8f796b02..b9e0c31f5b407 100644
--- a/tests/truncate/00.t
+++ b/tests/truncate/00.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/00.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate descrease/increase file size"
diff --git a/tests/truncate/01.t b/tests/truncate/01.t
index a8e95ac60181b..7360a57f66188 100644
--- a/tests/truncate/01.t
+++ b/tests/truncate/01.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/01.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns ENOTDIR if a component of the path prefix is not a directory"
diff --git a/tests/truncate/02.t b/tests/truncate/02.t
index 83de38d3244f7..823d01c2147a8 100644
--- a/tests/truncate/02.t
+++ b/tests/truncate/02.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/02.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters"
diff --git a/tests/truncate/03.t b/tests/truncate/03.t
index 41e98625ba4f5..d3d3ab3d57ae5 100644
--- a/tests/truncate/03.t
+++ b/tests/truncate/03.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/03.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters"
diff --git a/tests/truncate/04.t b/tests/truncate/04.t
index cd1cfc66b2b0a..ba7c4e5e81abe 100644
--- a/tests/truncate/04.t
+++ b/tests/truncate/04.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/04.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns ENOENT if the named file does not exist"
diff --git a/tests/truncate/05.t b/tests/truncate/05.t
index f12881581bce7..adafe9355ce77 100644
--- a/tests/truncate/05.t
+++ b/tests/truncate/05.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/05.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns EACCES when search permission is denied for a component of the path prefix"
diff --git a/tests/truncate/06.t b/tests/truncate/06.t
index 1ce516fa74a65..45b55c8ebc65c 100644
--- a/tests/truncate/06.t
+++ b/tests/truncate/06.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/06.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns EACCES if the named file is not writable by the user"
diff --git a/tests/truncate/07.t b/tests/truncate/07.t
index 44f87e7ea8590..52c3f6cb0a907 100644
--- a/tests/truncate/07.t
+++ b/tests/truncate/07.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/07.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns ELOOP if too many symbolic links were encountered in translating the pathname"
diff --git a/tests/truncate/08.t b/tests/truncate/08.t
index 6f205ef965f2d..70f39273204cc 100644
--- a/tests/truncate/08.t
+++ b/tests/truncate/08.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/08.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns EPERM if the named file has its immutable or append-only flag set"
diff --git a/tests/truncate/09.t b/tests/truncate/09.t
index d7e082ddbe0ee..c0a805c54cc73 100644
--- a/tests/truncate/09.t
+++ b/tests/truncate/09.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/09.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns EISDIR if the named file is a directory"
diff --git a/tests/truncate/10.t b/tests/truncate/10.t
index 08893a3854398..c8b8eaade6b38 100644
--- a/tests/truncate/10.t
+++ b/tests/truncate/10.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/10.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns EROFS if the named file resides on a read-only file system"
@@ -14,9 +15,9 @@ n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 1m`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 1m` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
expect 0 create ${n0}/${n1} 0644
expect 0 truncate ${n0}/${n1} 123
expect 123 stat ${n0}/${n1} size
@@ -28,5 +29,5 @@ expect 0 truncate ${n0}/${n1} 1234
expect 1234 stat ${n0}/${n1} size
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/truncate/11.t b/tests/truncate/11.t
index b00d7b89c16db..2b28dfde5108f 100644
--- a/tests/truncate/11.t
+++ b/tests/truncate/11.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/11.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns ETXTBSY the file is a pure procedure (shared text) file that is being executed"
@@ -7,6 +8,7 @@ dir=`dirname $0`
. ${dir}/../misc.sh
[ "${os}" = "FreeBSD" ] || quick_exit
+noexec && quick_exit
echo "1..2"
diff --git a/tests/truncate/12.t b/tests/truncate/12.t
index 1825456a7b132..98f3daeaf4610 100644
--- a/tests/truncate/12.t
+++ b/tests/truncate/12.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/12.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns EFBIG or EINVAL if the length argument was greater than the maximum file size"
diff --git a/tests/truncate/13.t b/tests/truncate/13.t
index 7c9f0d4e14ec0..97a27aec54793 100644
--- a/tests/truncate/13.t
+++ b/tests/truncate/13.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/13.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns EINVAL if the length argument was less than 0"
diff --git a/tests/truncate/14.t b/tests/truncate/14.t
index a238771264f9e..a6d4ed55767c4 100644
--- a/tests/truncate/14.t
+++ b/tests/truncate/14.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/14.t 211352 2010-08-15 21:24:17Z pjd $
desc="truncate returns EFAULT if the path argument points outside the process's allocated address space"
diff --git a/tests/unlink/00.t b/tests/unlink/00.t
index 0b9b1f1b59cf0..cb01a8343ebdd 100644
--- a/tests/unlink/00.t
+++ b/tests/unlink/00.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/00.t 211352 2010-08-15 21:24:17Z pjd $
desc="unlink removes regular files, symbolic links, fifos and sockets"
diff --git a/tests/unlink/01.t b/tests/unlink/01.t
index 7e29671ecb70a..a7d4f04cff9bf 100644
--- a/tests/unlink/01.t
+++ b/tests/unlink/01.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/01.t 211352 2010-08-15 21:24:17Z pjd $
desc="unlink returns ENOTDIR if a component of the path prefix is not a directory"
diff --git a/tests/unlink/02.t b/tests/unlink/02.t
index e624d987e8136..a7b906463be75 100644
--- a/tests/unlink/02.t
+++ b/tests/unlink/02.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/02.t 211352 2010-08-15 21:24:17Z pjd $
desc="unlink returns ENAMETOOLONG if a component of a pathname exceeded {NAME_MAX} characters"
diff --git a/tests/unlink/03.t b/tests/unlink/03.t
index f4c939e721e62..168166587451c 100644
--- a/tests/unlink/03.t
+++ b/tests/unlink/03.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/03.t 211352 2010-08-15 21:24:17Z pjd $
desc="unlink returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} characters"
diff --git a/tests/unlink/04.t b/tests/unlink/04.t
index 0717eaad01b90..f8f59500c68d0 100644
--- a/tests/unlink/04.t
+++ b/tests/unlink/04.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/04.t 211352 2010-08-15 21:24:17Z pjd $
desc="unlink returns ENOENT if the named file does not exist"
diff --git a/tests/unlink/05.t b/tests/unlink/05.t
index 91dccf90afea5..44434e005c491 100644
--- a/tests/unlink/05.t
+++ b/tests/unlink/05.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/05.t 211352 2010-08-15 21:24:17Z pjd $
desc="unlink returns EACCES when search permission is denied for a component of the path prefix"
diff --git a/tests/unlink/06.t b/tests/unlink/06.t
index 293742966c0e0..f04e7d2b6f08a 100644
--- a/tests/unlink/06.t
+++ b/tests/unlink/06.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/06.t 211352 2010-08-15 21:24:17Z pjd $
desc="unlink returns EACCES when write permission is denied on the directory containing the link to be removed"
diff --git a/tests/unlink/07.t b/tests/unlink/07.t
index e63eafa6e7a45..84560f2e4af4a 100644
--- a/tests/unlink/07.t
+++ b/tests/unlink/07.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/07.t 211352 2010-08-15 21:24:17Z pjd $
desc="unlink returns ELOOP if too many symbolic links were encountered in translating the pathname"
diff --git a/tests/unlink/08.t b/tests/unlink/08.t
index 666400cd2a2e2..14859720c4f93 100644
--- a/tests/unlink/08.t
+++ b/tests/unlink/08.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/08.t 211352 2010-08-15 21:24:17Z pjd $
desc="unlink may return EPERM if the named file is a directory"
diff --git a/tests/unlink/09.t b/tests/unlink/09.t
index dbc202a6954d4..b7ad78ee1bbc1 100644
--- a/tests/unlink/09.t
+++ b/tests/unlink/09.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/09.t 211352 2010-08-15 21:24:17Z pjd $
desc="unlink returns EPERM if the named file has its immutable, undeletable or append-only flag set"
diff --git a/tests/unlink/10.t b/tests/unlink/10.t
index 9ca1d5bc3fb1c..890bae7a38be4 100644
--- a/tests/unlink/10.t
+++ b/tests/unlink/10.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/10.t 211352 2010-08-15 21:24:17Z pjd $
desc="unlink returns EPERM if the parent directory of the named file has its immutable or append-only flag set"
diff --git a/tests/unlink/11.t b/tests/unlink/11.t
index d7d71d842d0d4..259c50d8097cc 100644
--- a/tests/unlink/11.t
+++ b/tests/unlink/11.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/11.t 211352 2010-08-15 21:24:17Z pjd $
desc="unlink returns EACCES or EPERM if the directory containing the file is marked sticky, and neither the containing directory nor the file to be removed are owned by the effective user ID"
diff --git a/tests/unlink/12.t b/tests/unlink/12.t
index 8f0c81ab6b124..69d574aea7cba 100644
--- a/tests/unlink/12.t
+++ b/tests/unlink/12.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/12.t 211352 2010-08-15 21:24:17Z pjd $
desc="unlink returns EROFS if the named file resides on a read-only file system"
@@ -14,14 +15,14 @@ n0=`namegen`
n1=`namegen`
expect 0 mkdir ${n0} 0755
-n=`mdconfig -a -n -t malloc -s 1m`
-newfs /dev/md${n} >/dev/null
-mount /dev/md${n} ${n0}
+n=`mdconfig -a -n -t malloc -s 1m` || exit
+newfs /dev/md${n} >/dev/null || exit
+mount /dev/md${n} ${n0} || exit
expect 0 create ${n0}/${n1} 0644
mount -ur /dev/md${n}
expect EROFS unlink ${n0}/${n1}
mount -uw /dev/md${n}
expect 0 unlink ${n0}/${n1}
umount /dev/md${n}
-mdconfig -d -u ${n}
+mdconfig -d -u ${n} || exit
expect 0 rmdir ${n0}
diff --git a/tests/unlink/13.t b/tests/unlink/13.t
index c424b7ed0094b..4d0268fe90948 100644
--- a/tests/unlink/13.t
+++ b/tests/unlink/13.t
@@ -1,4 +1,5 @@
#!/bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
# $FreeBSD: head/tools/regression/pjdfstest/tests/unlink/13.t 211352 2010-08-15 21:24:17Z pjd $
desc="unlink returns EFAULT if the path argument points outside the process's allocated address space"
diff --git a/tests/utimensat/00.t b/tests/utimensat/00.t
new file mode 100644
index 0000000000000..5a755851800ca
--- /dev/null
+++ b/tests/utimensat/00.t
@@ -0,0 +1,36 @@
+#! /bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
+# $FreeBSD$
+
+desc="utimensat changes timestamps on any type of file"
+
+dir=`dirname $0`
+. ${dir}/../misc.sh
+
+require "utimensat"
+
+echo "1..32"
+
+n0=`namegen`
+n1=`namegen`
+
+expect 0 mkdir ${n1} 0755
+cdir=`pwd`
+cd ${n1}
+
+DATE1=1900000000 #Sun Mar 17 11:46:40 MDT 2030
+DATE2=1950000000 #Fri Oct 17 04:40:00 MDT 2031
+for type in regular dir fifo block char socket; do
+ create_file ${type} ${n0}
+ expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE2 0 0
+ expect $DATE1 lstat ${n0} atime
+ expect $DATE2 lstat ${n0} mtime
+ if [ "${type}" = "dir" ]; then
+ expect 0 rmdir ${n0}
+ else
+ expect 0 unlink ${n0}
+ fi
+done
+
+cd ${cdir}
+expect 0 rmdir ${n1}
diff --git a/tests/utimensat/01.t b/tests/utimensat/01.t
new file mode 100644
index 0000000000000..0de42ca51b26d
--- /dev/null
+++ b/tests/utimensat/01.t
@@ -0,0 +1,56 @@
+#! /bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
+# $FreeBSD$
+
+desc="utimensat with UTIME_NOW will set the will set typestamps to now"
+
+dir=`dirname $0`
+. ${dir}/../misc.sh
+
+require "utimensat"
+
+echo "1..7"
+
+n0=`namegen`
+n1=`namegen`
+TIME_MARGIN=300 # Allow up to a 5 minute delta between the timestamps
+
+expect 0 mkdir ${n1} 0755
+cdir=`pwd`
+cd ${n1}
+
+
+create_file regular ${n0}
+old_mtime=`$fstest lstat ${n0} mtime`
+old_atime=`$fstest lstat ${n0} atime`
+sleep 1 # Ensure that future timestamps will be different than this one
+
+expect 0 open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_NOW 0 UTIME_NOW 0
+new_mtime=`$fstest lstat ${n0} mtime`
+new_atime=`$fstest lstat ${n0} atime`
+delta_mtime=$(( $new_mtime - $old_mtime ))
+delta_atime=$(( $new_atime - $old_atime ))
+
+if [ "$delta_mtime" -gt 0 ]; then
+ if [ "$delta_mtime" -lt $TIME_MARGIN ]; then
+ echo "ok 4"
+ else
+ echo "not ok 4 new mtime is implausibly far in the future"
+ fi
+else
+ echo "not ok 4 mtime was not updated"
+fi
+if [ "$delta_atime" -gt 0 ]; then
+ if [ "$delta_atime" -lt $TIME_MARGIN ]; then
+ echo "ok 5"
+ else
+ echo "not ok 5 new atime is implausibly far in the future"
+ fi
+else
+ echo "not ok 5 atime was not updated"
+fi
+ntest=$((ntest+2))
+expect 0 unlink ${n0}
+
+cd ${cdir}
+expect 0 rmdir ${n1}
diff --git a/tests/utimensat/02.t b/tests/utimensat/02.t
new file mode 100644
index 0000000000000..993a5b2279249
--- /dev/null
+++ b/tests/utimensat/02.t
@@ -0,0 +1,35 @@
+#! /bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
+# $FreeBSD$
+
+desc="utimensat with UTIME_OMIT will leave the time unchanged"
+
+dir=`dirname $0`
+. ${dir}/../misc.sh
+
+require "utimensat"
+
+echo "1..10"
+
+n0=`namegen`
+n1=`namegen`
+DATE1=1900000000 #Sun Mar 17 11:46:40 MDT 2030
+DATE2=1950000000 #Fri Oct 17 04:40:00 MDT 2031
+
+expect 0 mkdir ${n1} 0755
+cdir=`pwd`
+cd ${n1}
+
+create_file regular ${n0}
+orig_mtime=`$fstest lstat ${n0} mtime`
+expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 0 UTIME_OMIT 0
+expect $DATE1 lstat ${n0} atime
+expect $orig_mtime lstat ${n0} mtime
+
+expect 0 open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_OMIT $DATE2 0 0
+expect $DATE1 lstat ${n0} atime
+expect $DATE2 lstat ${n0} mtime
+expect 0 unlink ${n0}
+
+cd ${cdir}
+expect 0 rmdir ${n1}
diff --git a/tests/utimensat/03.t b/tests/utimensat/03.t
new file mode 100644
index 0000000000000..f27cdc3c079f4
--- /dev/null
+++ b/tests/utimensat/03.t
@@ -0,0 +1,39 @@
+#! /bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
+# $FreeBSD$
+
+desc="utimensat can update birthtimes"
+
+dir=`dirname $0`
+. ${dir}/../misc.sh
+
+require "utimensat"
+
+require stat_st_birthtime
+
+echo "1..12"
+
+n0=`namegen`
+n1=`namegen`
+DATE1=100000000 #Sat Mar 3 02:46:40 MST 1973
+DATE2=200000000 #Mon May 3 13:33:20 MDT 1976
+
+expect 0 mkdir ${n1} 0755
+cdir=`pwd`
+cd ${n1}
+
+create_file regular ${n0}
+expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE1 0 0
+expect $DATE1 lstat ${n0} atime
+expect $DATE1 lstat ${n0} mtime
+expect $DATE1 lstat ${n0} birthtime
+
+expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE2 0 $DATE2 0 0
+expect $DATE2 lstat ${n0} atime
+expect $DATE2 lstat ${n0} mtime
+expect $DATE1 lstat ${n0} birthtime
+
+expect 0 unlink ${n0}
+
+cd ${cdir}
+expect 0 rmdir ${n1}
diff --git a/tests/utimensat/04.t b/tests/utimensat/04.t
new file mode 100644
index 0000000000000..d3efe950d82ae
--- /dev/null
+++ b/tests/utimensat/04.t
@@ -0,0 +1,36 @@
+#! /bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
+# $FreeBSD$
+
+desc="utimensat can set mtime < atime or vice versa"
+
+dir=`dirname $0`
+. ${dir}/../misc.sh
+
+require "utimensat"
+
+echo "1..10"
+
+n0=`namegen`
+n1=`namegen`
+DATE1=100000000 #Sat Mar 3 02:46:40 MST 1973
+DATE2=200000000 #Mon May 3 13:33:20 MDT 1976
+
+expect 0 mkdir ${n1} 0755
+cdir=`pwd`
+cd ${n1}
+
+
+create_file regular ${n0}
+expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE2 0 0
+expect $DATE1 lstat ${n0} atime
+expect $DATE2 lstat ${n0} mtime
+
+expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE2 0 $DATE1 0 0
+expect $DATE2 lstat ${n0} atime
+expect $DATE1 lstat ${n0} mtime
+
+expect 0 unlink ${n0}
+
+cd ${cdir}
+expect 0 rmdir ${n1}
diff --git a/tests/utimensat/05.t b/tests/utimensat/05.t
new file mode 100644
index 0000000000000..0e205591380bf
--- /dev/null
+++ b/tests/utimensat/05.t
@@ -0,0 +1,53 @@
+#! /bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
+# $FreeBSD$
+
+desc="utimensat can follow symlinks"
+
+dir=`dirname $0`
+. ${dir}/../misc.sh
+
+require "utimensat"
+
+echo "1..16"
+
+n0=`namegen`
+n1=`namegen`
+n2=`namegen`
+DATE1=1900000000 #Sun Mar 17 11:46:40 MDT 2030
+DATE2=1950000000 #Fri Oct 17 04:40:00 MDT 2031
+DATE3=1960000000 #Mon Feb 9 21:26:40 MST 2032
+DATE4=1970000000 #Fri Jun 4 16:13:20 MDT 2032
+DATE5=1980000000 #Tue Sep 28 10:00:00 MDT 2032
+DATE6=1990000000 #Sat Jan 22 02:46:40 MST 2033
+
+expect 0 mkdir ${n1} 0755
+cdir=`pwd`
+cd ${n1}
+
+
+create_file regular ${n0}
+ln -s ${n0} ${n2}
+expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE2 0 0
+
+expect 0 open . O_RDONLY : utimensat 0 ${n2} $DATE3 0 $DATE4 0 AT_SYMLINK_NOFOLLOW
+expect $DATE1 lstat ${n0} atime
+expect $DATE2 lstat ${n0} mtime
+expect $DATE3 lstat ${n2} atime
+expect $DATE4 lstat ${n2} mtime
+
+expect 0 open . O_RDONLY : utimensat 0 ${n2} $DATE5 0 $DATE6 0 0
+expect $DATE5 lstat ${n0} atime
+expect $DATE6 lstat ${n0} mtime
+# If atime is disabled on the current mount, then ${n2}'s atime should still be
+# $DATE3. However, if atime is enabled, then ${n2}'s atime will be the current
+# system time. For this test, it's sufficient to simply check that it didn't
+# get set to DATE5
+test_check "$DATE5" -ne `"$fstest" lstat ${n2} atime`
+expect $DATE4 lstat ${n2} mtime
+
+expect 0 unlink ${n0}
+expect 0 unlink ${n2}
+
+cd ${cdir}
+expect 0 rmdir ${n1}
diff --git a/tests/utimensat/06.t b/tests/utimensat/06.t
new file mode 100644
index 0000000000000..3170d89174b0c
--- /dev/null
+++ b/tests/utimensat/06.t
@@ -0,0 +1,45 @@
+#! /bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
+# $FreeBSD$
+
+desc="utimensat with UTIME_NOW will work if the caller has write permission"
+
+dir=`dirname $0`
+. ${dir}/../misc.sh
+
+require "utimensat"
+
+echo "1..13"
+
+n0=`namegen`
+n1=`namegen`
+UID_NOBODY=`id -u nobody`
+GID_NOBODY=`id -g nobody`
+UID_ROOT=`id -u root`
+GID_ROOT=`id -g root`
+
+expect 0 mkdir ${n1} 0755
+cdir=`pwd`
+cd ${n1}
+
+create_file regular ${n0} 0644
+# First check that nobody can't update the timestamps
+expect EACCES -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_NOW 0 UTIME_NOW 0
+
+# Now check that the owner can update the timestamps
+expect 0 chown ${n0} $UID_NOBODY $GID_NOBODY
+expect 0 chmod ${n0} 0444
+expect 0 -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_NOW 0 UTIME_NOW 0
+
+# Now check that the superuser can update the timestamps
+expect 0 -u $UID_ROOT open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_OMIT 0 UTIME_OMIT 0
+
+# Now check that anyone with write permission can update the timestamps
+expect 0 chown ${n0} $UID_ROOT $GID_ROOT
+expect 0 chmod ${n0} 0666
+expect 0 -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_NOW 0 UTIME_NOW 0
+
+expect 0 unlink ${n0}
+
+cd ${cdir}
+expect 0 rmdir ${n1}
diff --git a/tests/utimensat/07.t b/tests/utimensat/07.t
new file mode 100644
index 0000000000000..b194f081f2ffe
--- /dev/null
+++ b/tests/utimensat/07.t
@@ -0,0 +1,51 @@
+#! /bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
+# $FreeBSD$
+
+desc="utimensat will work if the caller is the owner or root"
+
+dir=`dirname $0`
+. ${dir}/../misc.sh
+
+require "utimensat"
+
+echo "1..17"
+
+n0=`namegen`
+n1=`namegen`
+DATE1=1900000000 #Sun Mar 17 11:46:40 MDT 2030
+DATE2=1950000000 #Fri Oct 17 04:40:00 MDT 2031
+UID_NOBODY=`id -u nobody`
+GID_NOBODY=`id -g nobody`
+UID_ROOT=`id -u root`
+GID_ROOT=`id -g root`
+
+expect 0 mkdir ${n1} 0755
+cdir=`pwd`
+cd ${n1}
+
+create_file regular ${n0} 0644 $UID_ROOT $GID_ROOT
+# First check that nobody can't update the timestamps
+expect EPERM -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_OMIT $DATE2 0 0
+expect EPERM -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 0 UTIME_OMIT 0
+expect EPERM -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE2 0 0
+
+# Now check that a nonowner with write permission can't update the timestamps
+expect 0 chmod ${n0} 0666
+expect EPERM -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_OMIT $DATE2 0 0
+expect EPERM -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 0 UTIME_OMIT 0
+expect EPERM -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE2 0 0
+
+# Now check that the owner can update the timestamps
+expect 0 chown ${n0} $UID_NOBODY $GID_NOBODY
+expect 0 chmod ${n0} 0444
+expect 0 -u $UID_NOBODY open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE2 0
+
+# Now check that the superuser can update the timestamps
+expect 0 -u $UID_ROOT open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE2 0 0
+
+
+expect 0 unlink ${n0}
+
+cd ${cdir}
+expect 0 rmdir ${n1}
diff --git a/tests/utimensat/08.t b/tests/utimensat/08.t
new file mode 100644
index 0000000000000..aca8b1c26aaef
--- /dev/null
+++ b/tests/utimensat/08.t
@@ -0,0 +1,40 @@
+#! /bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
+# $FreeBSD$
+
+desc="utimensat can set timestamps with subsecond precision"
+
+dir=`dirname $0`
+. ${dir}/../misc.sh
+
+require "utimensat"
+
+echo "1..9"
+
+n0=`namegen`
+n1=`namegen`
+# Different file systems have different timestamp resolutions. Check that they
+# can do 0.1 second, but don't bother checking the finest resolution.
+DATE1=100000000 #Sat Mar 3 02:46:40 MST 1973
+DATE1_NS=100000000
+DATE2=200000000 #Mon May 3 13:33:20 MDT 1976
+DATE2_NS=200000000
+
+expect 0 mkdir ${n1} 0755
+cdir=`pwd`
+cd ${n1}
+
+create_file regular ${n0} 0644
+expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE1 $DATE1_NS $DATE2 $DATE2_NS 0
+expect $DATE1_NS lstat ${n0} atime_ns
+expect $DATE2_NS lstat ${n0} mtime_ns
+if supported "stat_st_birthtime"; then
+ expect $DATE2_NS lstat ${n0} birthtime_ns
+else
+ test_check true
+fi
+
+expect 0 unlink ${n0}
+
+cd ${cdir}
+expect 0 rmdir ${n1}
diff --git a/tests/utimensat/09.t b/tests/utimensat/09.t
new file mode 100644
index 0000000000000..ec7acbe911bc0
--- /dev/null
+++ b/tests/utimensat/09.t
@@ -0,0 +1,35 @@
+#! /bin/sh
+# vim: filetype=sh noexpandtab ts=8 sw=8
+# $FreeBSD$
+
+desc="utimensat is y2038 compliant"
+
+dir=`dirname $0`
+. ${dir}/../misc.sh
+
+require "utimensat"
+
+echo "1..7"
+
+require utimensat
+
+n0=`namegen`
+n1=`namegen`
+DATE1=2147483648 # 2^31, ie Mon Jan 18 20:14:08 MST 2038
+DATE2=4294967296 # 2^32, ie Sat Feb 6 23:28:16 MST 2106
+
+expect 0 mkdir ${n1} 0755
+cdir=`pwd`
+cd ${n1}
+
+
+create_file regular ${n0}
+expect 0 open . O_RDONLY : utimensat 0 ${n0} $DATE1 0 $DATE2 0 0
+expect $DATE1 lstat ${n0} atime
+expect $DATE2 lstat ${n0} mtime
+
+
+expect 0 unlink ${n0}
+
+cd ${cdir}
+expect 0 rmdir ${n1}
diff --git a/travis/build.sh b/travis/build.sh
new file mode 100755
index 0000000000000..eafcc4f85a4dc
--- /dev/null
+++ b/travis/build.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+set -e
+
+cd $(dirname $0)/..
+autoreconf -ifs
+./configure
+make
diff --git a/travis/test.sh b/travis/test.sh
new file mode 100755
index 0000000000000..66c6b11171081
--- /dev/null
+++ b/travis/test.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+set -ex
+
+cd $(dirname $0)/..
+
+df .
+uname -a
+
+case "$(uname)" in
+Darwin)
+ sw_vers -productVersion
+ mount
+ # FIXME: OSX has test issues that need to be addressed per Issue #13.
+ exit 0
+ ;;
+FreeBSD)
+ mount -p
+ ;;
+Linux)
+ for release_file in /etc/lsb-release /etc/os-release; do
+ echo "$release_file.. ->"
+ cat $release_file
+ done
+ mount
+ ;;
+esac
+
+sudo prove -rv .