diff options
author | ngie <ngie@FreeBSD.org> | 2014-12-05 11:44:18 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2014-12-05 11:44:18 +0000 |
commit | 2ceba1b1340a12cfe78aa2589bb0bba87f7b33d9 (patch) | |
tree | e08795fd1d98cb1be488d6510c6b57e60398f2fa /contrib/pjdfstest/tests/symlink | |
parent | f88754a36c36675f66d041b57d0da1b2ea102c62 (diff) | |
download | FreeBSD-src-2ceba1b1340a12cfe78aa2589bb0bba87f7b33d9.zip FreeBSD-src-2ceba1b1340a12cfe78aa2589bb0bba87f7b33d9.tar.gz |
MFC r272057,r272083,r272084,r272087,r274016:
r272057:
Import pjdfstest from ^/vendor/pjdfstest/abf03c3a47745d4521b0e4aa141317553ca48f91
- Remove tools/regression/pjdfstest
- Add upgrade directions for contrib/pjdfstest
- Add a note to UPDATING for the move (the reachover Makefiles are coming
soon)
Functional differences:
- ftruncate testcases are added from upstream (github)
Non-functional differences:
- The copyright for the project has been updated to 2012
- pjd's contact information has been updated
Discussed with: -testing, jmmv, pjd
Sponsored by: EMC / Isilon Storage Division
r272083:
Expect ELOOP on Darwin/Linux with "O_NOFOLLOW was specified and the target is a
symbolic link" case. Assume EMLINK on the rest of the OSes (FreeBSD, Solaris,
etc)
Sponsored by: EMC / Isilon Storage Division
r272084:
Fix the executed testplan count
Sponsored by: EMC / Isilon Storage Division
r272087:
Increase the memory disk size in the following testcases to avoid mount
failures, which would cause cascade failures in the rest of the test
run:
link/15.t, open/19.t, mkdir/11.t, mkfifo/11.t, symlink/11.t
Fail quickly in all of the testcases if mdconfig, mount, umount, etc
fails to avoid issues similar to this in the future
Submitted by: Casey Peel <cpeel@isilon.com>
Sponsored by: EMC / Isilon Storage Division
r274016:
Integrate pjdfstest test suite execution into kyua
pjdfstest execution is opt-in and must be done as root due to some of the
assumptions made by the test suite and lack of error checking in the non-root
case
A description of how to execute pjdfstest with kyua is provided in
share/pjdfstest/README
Phabric: D824 (an earlier prototype patch)
Relnotes: yes
Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'contrib/pjdfstest/tests/symlink')
-rw-r--r-- | contrib/pjdfstest/tests/symlink/00.t | 32 | ||||
-rw-r--r-- | contrib/pjdfstest/tests/symlink/01.t | 18 | ||||
-rw-r--r-- | contrib/pjdfstest/tests/symlink/02.t | 22 | ||||
-rw-r--r-- | contrib/pjdfstest/tests/symlink/03.t | 22 | ||||
-rw-r--r-- | contrib/pjdfstest/tests/symlink/04.t | 16 | ||||
-rw-r--r-- | contrib/pjdfstest/tests/symlink/05.t | 34 | ||||
-rw-r--r-- | contrib/pjdfstest/tests/symlink/06.t | 34 | ||||
-rw-r--r-- | contrib/pjdfstest/tests/symlink/07.t | 19 | ||||
-rw-r--r-- | contrib/pjdfstest/tests/symlink/08.t | 21 | ||||
-rw-r--r-- | contrib/pjdfstest/tests/symlink/09.t | 66 | ||||
-rw-r--r-- | contrib/pjdfstest/tests/symlink/10.t | 32 | ||||
-rw-r--r-- | contrib/pjdfstest/tests/symlink/11.t | 31 | ||||
-rw-r--r-- | contrib/pjdfstest/tests/symlink/12.t | 18 |
13 files changed, 365 insertions, 0 deletions
diff --git a/contrib/pjdfstest/tests/symlink/00.t b/contrib/pjdfstest/tests/symlink/00.t new file mode 100644 index 0000000..1f26939 --- /dev/null +++ b/contrib/pjdfstest/tests/symlink/00.t @@ -0,0 +1,32 @@ +#!/bin/sh +# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/00.t 211352 2010-08-15 21:24:17Z pjd $ + +desc="symlink creates symbolic links" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..14" + +n0=`namegen` +n1=`namegen` + +expect 0 create ${n0} 0644 +expect regular,0644 lstat ${n0} type,mode +expect 0 symlink ${n0} ${n1} +expect symlink lstat ${n1} type +expect regular,0644 stat ${n1} type,mode +expect 0 unlink ${n0} +expect ENOENT stat ${n1} type,mode +expect 0 unlink ${n1} + +expect 0 mkdir ${n0} 0755 +time=`${fstest} stat ${n0} ctime` +sleep 1 +expect 0 symlink test ${n0}/${n1} +mtime=`${fstest} stat ${n0} mtime` +test_check $time -lt $mtime +ctime=`${fstest} stat ${n0} ctime` +test_check $time -lt $ctime +expect 0 unlink ${n0}/${n1} +expect 0 rmdir ${n0} diff --git a/contrib/pjdfstest/tests/symlink/01.t b/contrib/pjdfstest/tests/symlink/01.t new file mode 100644 index 0000000..3a40b54 --- /dev/null +++ b/contrib/pjdfstest/tests/symlink/01.t @@ -0,0 +1,18 @@ +#!/bin/sh +# $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" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..5" + +n0=`namegen` +n1=`namegen` + +expect 0 mkdir ${n0} 0755 +expect 0 create ${n0}/${n1} 0644 +expect ENOTDIR symlink test ${n0}/${n1}/test +expect 0 unlink ${n0}/${n1} +expect 0 rmdir ${n0} diff --git a/contrib/pjdfstest/tests/symlink/02.t b/contrib/pjdfstest/tests/symlink/02.t new file mode 100644 index 0000000..4b81f16 --- /dev/null +++ b/contrib/pjdfstest/tests/symlink/02.t @@ -0,0 +1,22 @@ +#!/bin/sh +# $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" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..7" + +n0=`namegen` +nx=`namegen_max` +nxx="${nx}x" + +expect 0 symlink ${nx} ${n0} +expect 0 unlink ${n0} +expect 0 symlink ${n0} ${nx} +expect 0 unlink ${nx} + +expect ENAMETOOLONG symlink ${n0} ${nxx} +expect 0 symlink ${nxx} ${n0} +expect 0 unlink ${n0} diff --git a/contrib/pjdfstest/tests/symlink/03.t b/contrib/pjdfstest/tests/symlink/03.t new file mode 100644 index 0000000..68ecfbd --- /dev/null +++ b/contrib/pjdfstest/tests/symlink/03.t @@ -0,0 +1,22 @@ +#!/bin/sh +# $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" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..6" + +n0=`namegen` +nx=`dirgen_max` +nxx="${nx}x" + +mkdir -p "${nx%/*}" +expect 0 symlink ${nx} ${n0} +expect 0 unlink ${n0} +expect 0 symlink ${n0} ${nx} +expect 0 unlink ${nx} +expect ENAMETOOLONG symlink ${n0} ${nxx} +expect ENAMETOOLONG symlink ${nxx} ${n0} +rm -rf "${nx%%/*}" diff --git a/contrib/pjdfstest/tests/symlink/04.t b/contrib/pjdfstest/tests/symlink/04.t new file mode 100644 index 0000000..ca1c8ee --- /dev/null +++ b/contrib/pjdfstest/tests/symlink/04.t @@ -0,0 +1,16 @@ +#!/bin/sh +# $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" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..3" + +n0=`namegen` +n1=`namegen` + +expect 0 mkdir ${n0} 0755 +expect ENOENT symlink test ${n0}/${n1}/test +expect 0 rmdir ${n0} diff --git a/contrib/pjdfstest/tests/symlink/05.t b/contrib/pjdfstest/tests/symlink/05.t new file mode 100644 index 0000000..801e467 --- /dev/null +++ b/contrib/pjdfstest/tests/symlink/05.t @@ -0,0 +1,34 @@ +#!/bin/sh +# $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" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..12" + +n0=`namegen` +n1=`namegen` +n2=`namegen` + +expect 0 mkdir ${n0} 0755 +cdir=`pwd` +cd ${n0} + +expect 0 mkdir ${n1} 0755 +expect 0 chown ${n1} 65534 65534 + +expect 0 -u 65534 -g 65534 symlink test ${n1}/${n2} +expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} + +expect 0 chmod ${n1} 0644 +expect EACCES -u 65534 -g 65534 symlink test ${n1}/${n2} +expect 0 chmod ${n1} 0755 +expect 0 -u 65534 -g 65534 symlink test ${n1}/${n2} +expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} + +expect 0 rmdir ${n1} + +cd ${cdir} +expect 0 rmdir ${n0} diff --git a/contrib/pjdfstest/tests/symlink/06.t b/contrib/pjdfstest/tests/symlink/06.t new file mode 100644 index 0000000..db61ad0 --- /dev/null +++ b/contrib/pjdfstest/tests/symlink/06.t @@ -0,0 +1,34 @@ +#!/bin/sh +# $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" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..12" + +n0=`namegen` +n1=`namegen` +n2=`namegen` + +expect 0 mkdir ${n0} 0755 +cdir=`pwd` +cd ${n0} + +expect 0 mkdir ${n1} 0755 +expect 0 chown ${n1} 65534 65534 + +expect 0 -u 65534 -g 65534 symlink test ${n1}/${n2} +expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} + +expect 0 chmod ${n1} 0555 +expect EACCES -u 65534 -g 65534 symlink test ${n1}/${n2} +expect 0 chmod ${n1} 0755 +expect 0 -u 65534 -g 65534 symlink test ${n1}/${n2} +expect 0 unlink ${n1}/${n2} + +expect 0 rmdir ${n1} + +cd ${cdir} +expect 0 rmdir ${n0} diff --git a/contrib/pjdfstest/tests/symlink/07.t b/contrib/pjdfstest/tests/symlink/07.t new file mode 100644 index 0000000..c6aedc0 --- /dev/null +++ b/contrib/pjdfstest/tests/symlink/07.t @@ -0,0 +1,19 @@ +#!/bin/sh +# $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" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..6" + +n0=`namegen` +n1=`namegen` + +expect 0 symlink ${n0} ${n1} +expect 0 symlink ${n1} ${n0} +expect ELOOP symlink test ${n0}/test +expect ELOOP symlink test ${n1}/test +expect 0 unlink ${n0} +expect 0 unlink ${n1} diff --git a/contrib/pjdfstest/tests/symlink/08.t b/contrib/pjdfstest/tests/symlink/08.t new file mode 100644 index 0000000..ef7915d --- /dev/null +++ b/contrib/pjdfstest/tests/symlink/08.t @@ -0,0 +1,21 @@ +#!/bin/sh +# $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" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..21" + +n0=`namegen` + +for type in regular dir fifo block char socket symlink; do + create_file ${type} ${n0} + expect EEXIST symlink test ${n0} + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0} + else + expect 0 unlink ${n0} + fi +done diff --git a/contrib/pjdfstest/tests/symlink/09.t b/contrib/pjdfstest/tests/symlink/09.t new file mode 100644 index 0000000..6292aaf --- /dev/null +++ b/contrib/pjdfstest/tests/symlink/09.t @@ -0,0 +1,66 @@ +#!/bin/sh +# $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" + +dir=`dirname $0` +. ${dir}/../misc.sh + +require chflags + +case "${os}:${fs}" in +FreeBSD:ZFS) + echo "1..17" + ;; +FreeBSD:UFS) + echo "1..30" + ;; +*) + quick_exit +esac + +n0=`namegen` +n1=`namegen` + +expect 0 mkdir ${n0} 0755 + +expect 0 symlink test ${n0}/${n1} +expect 0 unlink ${n0}/${n1} + +expect 0 chflags ${n0} SF_IMMUTABLE +expect EPERM symlink test ${n0}/${n1} +expect 0 chflags ${n0} none +expect 0 symlink test ${n0}/${n1} +expect 0 unlink ${n0}/${n1} + +expect 0 chflags ${n0} SF_NOUNLINK +expect 0 symlink test ${n0}/${n1} +expect 0 chflags ${n0} none +expect 0 unlink ${n0}/${n1} + +expect 0 chflags ${n0} SF_APPEND +expect 0 symlink test ${n0}/${n1} +expect 0 chflags ${n0} none +expect 0 unlink ${n0}/${n1} + +case "${os}:${fs}" in +FreeBSD:UFS) + expect 0 chflags ${n0} UF_IMMUTABLE + expect EPERM symlink test ${n0}/${n1} + expect 0 chflags ${n0} none + expect 0 symlink test ${n0}/${n1} + expect 0 unlink ${n0}/${n1} + + expect 0 chflags ${n0} UF_NOUNLINK + expect 0 symlink test ${n0}/${n1} + expect 0 chflags ${n0} none + expect 0 unlink ${n0}/${n1} + + expect 0 chflags ${n0} UF_APPEND + expect 0 symlink test ${n0}/${n1} + expect 0 chflags ${n0} none + expect 0 unlink ${n0}/${n1} + ;; +esac + +expect 0 rmdir ${n0} diff --git a/contrib/pjdfstest/tests/symlink/10.t b/contrib/pjdfstest/tests/symlink/10.t new file mode 100644 index 0000000..47a6eb4 --- /dev/null +++ b/contrib/pjdfstest/tests/symlink/10.t @@ -0,0 +1,32 @@ +#!/bin/sh +# $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" + +dir=`dirname $0` +. ${dir}/../misc.sh + +[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit + +echo "1..7" + +n0=`namegen` +n1=`namegen` +n2=`namegen` + +expect 0 mkdir ${n0} 0755 +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} +mount -ur /dev/md${n} +expect EROFS symlink test ${n0}/${n1} +mount -uw /dev/md${n} +expect 0 symlink test ${n0}/${n1} +expect 0 unlink ${n0}/${n1} + +umount /dev/md${n} +mdconfig -d -u ${n} || exit +expect 0 rmdir ${n0} diff --git a/contrib/pjdfstest/tests/symlink/11.t b/contrib/pjdfstest/tests/symlink/11.t new file mode 100644 index 0000000..e9f78e8 --- /dev/null +++ b/contrib/pjdfstest/tests/symlink/11.t @@ -0,0 +1,31 @@ +#!/bin/sh +# $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" + +dir=`dirname $0` +. ${dir}/../misc.sh + +[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit + +echo "1..3" + +n0=`namegen` +n1=`namegen` + +expect 0 mkdir ${n0} 0755 +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 + if [ $? -ne 0 ]; then + break + fi + i=`expr $i + 1` +done +expect ENOSPC symlink test ${n0}/${n1} +umount /dev/md${n} +mdconfig -d -u ${n} || exit +expect 0 rmdir ${n0} diff --git a/contrib/pjdfstest/tests/symlink/12.t b/contrib/pjdfstest/tests/symlink/12.t new file mode 100644 index 0000000..2c69905 --- /dev/null +++ b/contrib/pjdfstest/tests/symlink/12.t @@ -0,0 +1,18 @@ +#!/bin/sh +# $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" + +dir=`dirname $0` +. ${dir}/../misc.sh + +echo "1..6" + +n0=`namegen` + +expect EFAULT symlink NULL ${n0} +expect EFAULT symlink DEADCODE ${n0} +expect EFAULT symlink test NULL +expect EFAULT symlink test DEADCODE +expect EFAULT symlink NULL DEADCODE +expect EFAULT symlink DEADCODE NULL |