Pull down pjdfstest 0.1

The summary of changes is as follows..

Generic changes::
- Added configure support [2].
- Check for lchmod filesystem support with create_file(..); for
  testcases that require lchmod, skip the testcase -- otherwise
  use chmod directly [1].
- Added Travis CI integration [2].
- Added utimensat testcases [1].

Linux support::
- Fixed Linux support to pass on later supported versions of
  Fedora/Ubuntu [2].
- Conditionally enable posix_fallocate(2) support [2].

OSX support::
- Fixed compilation on OSX [2].
- Added partial OSX support (the test run isn't fully green yet)
  [2].

Obtained from:	https://github.com/pjd/pjdfstest/tree/0.1
Submitted by:	asomers [1], ngie [2]
This commit is contained in:
Enji Cooper 2017-06-28 08:48:09 +00:00
parent 9a56205fc9
commit a5b450a49b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/pjdfstest/dist/; revision=320447
svn path=/vendor/pjdfstest/0.1/; revision=320449; tag=vendor/pjdfstest/0.1
244 changed files with 1637 additions and 384 deletions

19
.gitignore vendored Normal file
View File

@ -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

19
.travis.yml Normal file
View File

@ -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

3
AUTHORS Normal file
View File

@ -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

27
COPYING Normal file
View File

@ -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.

0
ChangeLog Normal file
View File

5
Makefile.am Normal file
View File

@ -0,0 +1,5 @@
AM_CFLAGS= -Wall -Werror
bin_PROGRAMS= pjdfstest
pjdfstest_SOURCES= pjdfstest.c

0
NEWS Normal file
View File

67
README
View File

@ -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:
============
Introduction
============
# 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
pjdfstest is a test suite that helps exercise POSIX system calls.
That's all. Enjoy.
pjdfstest supports the following operating systems/filesystems:
Currently supported operating systems: FreeBSD, Solaris.
Currently supported file system types: UFS, ZFS.
- Supported Operating Systems: FreeBSD, Linux, Solaris
- Supported Filesystems: ext4, UFS, ZFS
--
Pawel Jakub Dawidek <pawel@dawidek.net>
==================
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

107
configure.ac Normal file
View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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%%/*}"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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}

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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}

View File

@ -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"

View File

@ -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

View File

@ -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`

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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}

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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}

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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}

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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
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} 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:UFS)
expect 0 chflags ${n0} UF_IMMUTABLE
expect EPERM link ${n0} ${n1}
expect 0 chflags ${n0} none

View File

@ -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"

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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"

View File

@ -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
}

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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}

View File

@ -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"

Some files were not shown because too many files have changed in this diff Show More