svn commit: r211180 - in head/tools/regression/fstest/tests:
chflags chown link rename
Pawel Jakub Dawidek
pjd at FreeBSD.org
Wed Aug 11 16:34:44 UTC 2010
Author: pjd
Date: Wed Aug 11 16:34:44 2010
New Revision: 211180
URL: http://svn.freebsd.org/changeset/base/211180
Log:
More and more tests.
Modified:
head/tools/regression/fstest/tests/chflags/00.t
head/tools/regression/fstest/tests/chflags/10.t
head/tools/regression/fstest/tests/chflags/11.t
head/tools/regression/fstest/tests/chown/00.t
head/tools/regression/fstest/tests/link/00.t
head/tools/regression/fstest/tests/rename/09.t
head/tools/regression/fstest/tests/rename/10.t
head/tools/regression/fstest/tests/rename/21.t
Modified: head/tools/regression/fstest/tests/chflags/00.t
==============================================================================
--- head/tools/regression/fstest/tests/chflags/00.t Wed Aug 11 16:34:26 2010 (r211179)
+++ head/tools/regression/fstest/tests/chflags/00.t Wed Aug 11 16:34:44 2010 (r211180)
@@ -14,14 +14,14 @@ FreeBSD:UFS)
userflags="UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE"
systemflags="SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK"
- echo "1..247"
+ echo "1..780"
;;
FreeBSD:ZFS)
allflags="UF_NODUMP,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK"
userflags="UF_NODUMP"
systemflags="SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK"
- echo "1..167"
+ echo "1..520"
;;
*)
quick_exit
@@ -36,41 +36,39 @@ expect 0 mkdir ${n2} 0755
cdir=`pwd`
cd ${n2}
-expect 0 create ${n0} 0644
-expect none stat ${n0} flags
-expect 0 chflags ${n0} ${allflags}
-expect ${allflags} stat ${n0} flags
-expect 0 chflags ${n0} ${userflags}
-expect ${userflags} stat ${n0} flags
-expect 0 chflags ${n0} ${systemflags}
-expect ${systemflags} stat ${n0} flags
-expect 0 chflags ${n0} none
-expect none stat ${n0} flags
-expect 0 unlink ${n0}
-
-expect 0 mkdir ${n0} 0644
-expect none stat ${n0} flags
-expect 0 chflags ${n0} ${allflags}
-expect ${allflags} stat ${n0} flags
-expect 0 chflags ${n0} ${userflags}
-expect ${userflags} stat ${n0} flags
-expect 0 chflags ${n0} ${systemflags}
-expect ${systemflags} stat ${n0} flags
-expect 0 chflags ${n0} none
-expect none stat ${n0} flags
-expect 0 rmdir ${n0}
-
-expect 0 mkfifo ${n0} 0644
-expect none stat ${n0} flags
-expect 0 chflags ${n0} ${allflags}
-expect ${allflags} stat ${n0} flags
-expect 0 chflags ${n0} ${userflags}
-expect ${userflags} stat ${n0} flags
-expect 0 chflags ${n0} ${systemflags}
-expect ${systemflags} stat ${n0} flags
-expect 0 chflags ${n0} none
-expect none stat ${n0} flags
-expect 0 unlink ${n0}
+for type in regular dir fifo block char socket; do
+ create_file ${type} ${n0} 0 0
+ expect none stat ${n0} flags
+ expect 0 chflags ${n0} ${allflags}
+ expect ${allflags} stat ${n0} flags
+ expect 0 chflags ${n0} ${userflags}
+ expect ${userflags} stat ${n0} flags
+ expect 0 chflags ${n0} ${systemflags}
+ expect ${systemflags} stat ${n0} flags
+ expect 0 chflags ${n0} none
+ expect none stat ${n0} flags
+ if [ "${type}" = "dir" ]; then
+ expect 0 rmdir ${n0}
+ else
+ expect 0 unlink ${n0}
+ fi
+
+ create_file ${type} ${n0} 0 0
+ expect none stat ${n0} flags
+ expect 0 lchflags ${n0} ${allflags}
+ expect ${allflags} stat ${n0} flags
+ expect 0 lchflags ${n0} ${userflags}
+ expect ${userflags} stat ${n0} flags
+ expect 0 lchflags ${n0} ${systemflags}
+ expect ${systemflags} stat ${n0} flags
+ expect 0 lchflags ${n0} none
+ expect none stat ${n0} flags
+ if [ "${type}" = "dir" ]; then
+ expect 0 rmdir ${n0}
+ else
+ expect 0 unlink ${n0}
+ fi
+done
expect 0 create ${n0} 0644
expect 0 symlink ${n0} ${n1}
@@ -111,86 +109,70 @@ expect 0 unlink ${n1}
expect 0 unlink ${n0}
# successful chflags(2) updates ctime.
-expect 0 create ${n0} 0644
-for flag in `echo ${allflags},none | tr ',' ' '`; do
- ctime1=`${fstest} stat ${n0} ctime`
- sleep 1
- expect 0 chflags ${n0} ${flag}
- ctime2=`${fstest} stat ${n0} ctime`
- test_check $ctime1 -lt $ctime2
+for type in regular dir fifo block char socket symlink; do
+ if [ "${type}" != "symlink" ]; then
+ create_file ${type} ${n0} 0 0
+ for flag in `echo ${allflags},none | tr ',' ' '`; do
+ ctime1=`${fstest} stat ${n0} ctime`
+ sleep 1
+ expect 0 chflags ${n0} ${flag}
+ ctime2=`${fstest} stat ${n0} ctime`
+ test_check $ctime1 -lt $ctime2
+ done
+ if [ "${type}" = "dir" ]; then
+ expect 0 rmdir ${n0}
+ else
+ expect 0 unlink ${n0}
+ fi
+ fi
+
+ create_file ${type} ${n0} 0 0
+ for flag in `echo ${allflags},none | tr ',' ' '`; do
+ ctime1=`${fstest} lstat ${n0} ctime`
+ sleep 1
+ expect 0 lchflags ${n0} ${flag}
+ ctime2=`${fstest} lstat ${n0} ctime`
+ test_check $ctime1 -lt $ctime2
+ done
+ if [ "${type}" = "dir" ]; then
+ expect 0 rmdir ${n0}
+ else
+ expect 0 unlink ${n0}
+ fi
done
-expect 0 unlink ${n0}
-
-expect 0 mkdir ${n0} 0755
-for flag in `echo ${allflags},none | tr ',' ' '`; do
- ctime1=`${fstest} stat ${n0} ctime`
- sleep 1
- expect 0 chflags ${n0} ${flag}
- ctime2=`${fstest} stat ${n0} ctime`
- test_check $ctime1 -lt $ctime2
-done
-expect 0 rmdir ${n0}
-
-expect 0 mkfifo ${n0} 0644
-for flag in `echo ${allflags},none | tr ',' ' '`; do
- ctime1=`${fstest} stat ${n0} ctime`
- sleep 1
- expect 0 chflags ${n0} ${flag}
- ctime2=`${fstest} stat ${n0} ctime`
- test_check $ctime1 -lt $ctime2
-done
-expect 0 unlink ${n0}
-
-expect 0 symlink ${n1} ${n0}
-for flag in `echo ${allflags},none | tr ',' ' '`; do
- ctime1=`${fstest} lstat ${n0} ctime`
- sleep 1
- expect 0 lchflags ${n0} ${flag}
- ctime2=`${fstest} lstat ${n0} ctime`
- test_check $ctime1 -lt $ctime2
-done
-expect 0 unlink ${n0}
# unsuccessful chflags(2) does not update ctime.
-expect 0 create ${n0} 0644
-for flag in `echo ${allflags},none | tr ',' ' '`; do
- ctime1=`${fstest} stat ${n0} ctime`
- sleep 1
- expect EPERM -u 65534 chflags ${n0} ${flag}
- ctime2=`${fstest} stat ${n0} ctime`
- test_check $ctime1 -eq $ctime2
-done
-expect 0 unlink ${n0}
-
-expect 0 mkdir ${n0} 0755
-for flag in `echo ${allflags},none | tr ',' ' '`; do
- ctime1=`${fstest} stat ${n0} ctime`
- sleep 1
- expect EPERM -u 65534 chflags ${n0} ${flag}
- ctime2=`${fstest} stat ${n0} ctime`
- test_check $ctime1 -eq $ctime2
+for type in regular dir fifo block char socket symlink; do
+ if [ "${type}" != "symlink" ]; then
+ create_file ${type} ${n0} 0 0
+ for flag in `echo ${allflags},none | tr ',' ' '`; do
+ ctime1=`${fstest} stat ${n0} ctime`
+ sleep 1
+ expect EPERM -u 65534 chflags ${n0} ${flag}
+ ctime2=`${fstest} stat ${n0} ctime`
+ test_check $ctime1 -eq $ctime2
+ done
+ if [ "${type}" = "dir" ]; then
+ expect 0 rmdir ${n0}
+ else
+ expect 0 unlink ${n0}
+ fi
+ fi
+
+ create_file ${type} ${n0} 0 0
+ for flag in `echo ${allflags},none | tr ',' ' '`; do
+ ctime1=`${fstest} lstat ${n0} ctime`
+ sleep 1
+ expect EPERM -u 65534 lchflags ${n0} ${flag}
+ ctime2=`${fstest} lstat ${n0} ctime`
+ test_check $ctime1 -eq $ctime2
+ done
+ if [ "${type}" = "dir" ]; then
+ expect 0 rmdir ${n0}
+ else
+ expect 0 unlink ${n0}
+ fi
done
-expect 0 rmdir ${n0}
-
-expect 0 mkfifo ${n0} 0644
-for flag in `echo ${allflags},none | tr ',' ' '`; do
- ctime1=`${fstest} stat ${n0} ctime`
- sleep 1
- expect EPERM -u 65534 chflags ${n0} ${flag}
- ctime2=`${fstest} stat ${n0} ctime`
- test_check $ctime1 -eq $ctime2
-done
-expect 0 unlink ${n0}
-
-expect 0 symlink ${n1} ${n0}
-for flag in `echo ${allflags},none | tr ',' ' '`; do
- ctime1=`${fstest} lstat ${n0} ctime`
- sleep 1
- expect EPERM -u 65534 lchflags ${n0} ${flag}
- ctime2=`${fstest} lstat ${n0} ctime`
- test_check $ctime1 -eq $ctime2
-done
-expect 0 unlink ${n0}
cd ${cdir}
expect 0 rmdir ${n2}
Modified: head/tools/regression/fstest/tests/chflags/10.t
==============================================================================
--- head/tools/regression/fstest/tests/chflags/10.t Wed Aug 11 16:34:26 2010 (r211179)
+++ head/tools/regression/fstest/tests/chflags/10.t Wed Aug 11 16:34:44 2010 (r211180)
@@ -8,7 +8,7 @@ dir=`dirname $0`
require chflags
-echo "1..62"
+echo "1..210"
n0=`namegen`
n1=`namegen`
@@ -18,45 +18,37 @@ expect 0 mkdir ${n0} 0755
cdir=`pwd`
cd ${n0}
-expect 0 create ${n1} 0644
-expect 0 chown ${n1} 65534 65534
-for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
- expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag}
- expect none stat ${n1} flags
- expect EPERM -u 65534 -g 65534 chflags ${n1} ${flag}
- expect none stat ${n1} flags
+for type in regular dir fifo block char socket symlink; do
+ if [ "${type}" != "symlink" ]; then
+ create_file ${type} ${n1} 0 0
+ expect 0 chown ${n1} 65534 65534
+ for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
+ expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag}
+ expect none stat ${n1} flags
+ expect EPERM -u 65534 -g 65534 chflags ${n1} ${flag}
+ expect none stat ${n1} flags
+ done
+ if [ "${type}" = "dir" ]; then
+ expect 0 rmdir ${n1}
+ else
+ expect 0 unlink ${n1}
+ fi
+ fi
+
+ create_file ${type} ${n1} 0 0
+ expect 0 lchown ${n1} 65534 65534
+ for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
+ expect EPERM -u 65533 -g 65533 lchflags ${n1} ${flag}
+ expect none lstat ${n1} flags
+ expect EPERM -u 65534 -g 65534 lchflags ${n1} ${flag}
+ expect none lstat ${n1} flags
+ done
+ if [ "${type}" = "dir" ]; then
+ expect 0 rmdir ${n1}
+ else
+ expect 0 unlink ${n1}
+ fi
done
-expect 0 unlink ${n1}
-
-expect 0 mkdir ${n1} 0755
-expect 0 chown ${n1} 65534 65534
-for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
- expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag}
- expect none stat ${n1} flags
- expect EPERM -u 65534 -g 65534 chflags ${n1} ${flag}
- expect none stat ${n1} flags
-done
-expect 0 rmdir ${n1}
-
-expect 0 mkfifo ${n1} 0644
-expect 0 chown ${n1} 65534 65534
-for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
- expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag}
- expect none stat ${n1} flags
- expect EPERM -u 65534 -g 65534 chflags ${n1} ${flag}
- expect none stat ${n1} flags
-done
-expect 0 unlink ${n1}
-
-expect 0 symlink ${n2} ${n1}
-expect 0 lchown ${n1} 65534 65534
-for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
- expect EPERM -u 65533 -g 65533 lchflags ${n1} ${flag}
- expect none lstat ${n1} flags
- expect EPERM -u 65534 -g 65534 lchflags ${n1} ${flag}
- expect none lstat ${n1} flags
-done
-expect 0 unlink ${n1}
cd ${cdir}
expect 0 rmdir ${n0}
Modified: head/tools/regression/fstest/tests/chflags/11.t
==============================================================================
--- head/tools/regression/fstest/tests/chflags/11.t Wed Aug 11 16:34:26 2010 (r211179)
+++ head/tools/regression/fstest/tests/chflags/11.t Wed Aug 11 16:34:44 2010 (r211180)
@@ -8,7 +8,7 @@ dir=`dirname $0`
require chflags_SF_SNAPSHOT
-echo "1..46"
+echo "1..158"
n0=`namegen`
n1=`namegen`
@@ -18,53 +18,41 @@ expect 0 mkdir ${n0} 0755
cdir=`pwd`
cd ${n0}
-expect 0 create ${n1} 0644
-expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT
-expect none stat ${n1} flags
-expect EPERM chflags ${n1} SF_SNAPSHOT
-expect none stat ${n1} flags
-expect 0 chown ${n1} 65534 65534
-expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT
-expect none stat ${n1} flags
-expect EPERM chflags ${n1} SF_SNAPSHOT
-expect none stat ${n1} flags
-expect 0 unlink ${n1}
-
-expect 0 mkdir ${n1} 0644
-expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT
-expect none stat ${n1} flags
-expect EPERM chflags ${n1} SF_SNAPSHOT
-expect none stat ${n1} flags
-expect 0 chown ${n1} 65534 65534
-expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT
-expect none stat ${n1} flags
-expect EPERM chflags ${n1} SF_SNAPSHOT
-expect none stat ${n1} flags
-expect 0 rmdir ${n1}
-
-expect 0 mkfifo ${n1} 0644
-expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT
-expect none stat ${n1} flags
-expect EPERM chflags ${n1} SF_SNAPSHOT
-expect none stat ${n1} flags
-expect 0 chown ${n1} 65534 65534
-expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT
-expect none stat ${n1} flags
-expect EPERM chflags ${n1} SF_SNAPSHOT
-expect none stat ${n1} flags
-expect 0 unlink ${n1}
-
-expect 0 symlink ${n2} ${n1}
-expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT
-expect none lstat ${n1} flags
-expect EPERM lchflags ${n1} SF_SNAPSHOT
-expect none lstat ${n1} flags
-expect 0 lchown ${n1} 65534 65534
-expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT
-expect none lstat ${n1} flags
-expect EPERM lchflags ${n1} SF_SNAPSHOT
-expect none lstat ${n1} flags
-expect 0 unlink ${n1}
+for type in regular dir fifo block char socket symlink; do
+ if [ "${type}" != "symlink" ]; then
+ create_file ${type} ${n1} 0 0
+ expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT
+ expect none stat ${n1} flags
+ expect EPERM chflags ${n1} SF_SNAPSHOT
+ expect none stat ${n1} flags
+ expect 0 chown ${n1} 65534 65534
+ expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT
+ expect none stat ${n1} flags
+ expect EPERM chflags ${n1} SF_SNAPSHOT
+ expect none stat ${n1} flags
+ if [ "${type}" = "dir" ]; then
+ expect 0 rmdir ${n1}
+ else
+ expect 0 unlink ${n1}
+ fi
+ fi
+
+ create_file ${type} ${n1} 0 0
+ expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT
+ expect none lstat ${n1} flags
+ expect EPERM lchflags ${n1} SF_SNAPSHOT
+ expect none lstat ${n1} flags
+ expect 0 lchown ${n1} 65534 65534
+ expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT
+ expect none lstat ${n1} flags
+ expect EPERM lchflags ${n1} SF_SNAPSHOT
+ expect none lstat ${n1} flags
+ if [ "${type}" = "dir" ]; then
+ expect 0 rmdir ${n1}
+ else
+ expect 0 unlink ${n1}
+ fi
+done
cd ${cdir}
expect 0 rmdir ${n0}
Modified: head/tools/regression/fstest/tests/chown/00.t
==============================================================================
--- head/tools/regression/fstest/tests/chown/00.t Wed Aug 11 16:34:26 2010 (r211179)
+++ head/tools/regression/fstest/tests/chown/00.t Wed Aug 11 16:34:44 2010 (r211180)
@@ -7,9 +7,9 @@ dir=`dirname $0`
. ${dir}/../misc.sh
if supported lchmod; then
- echo "1..186"
+ echo "1..264"
else
- echo "1..171"
+ echo "1..249"
fi
n0=`namegen`
@@ -21,28 +21,49 @@ cdir=`pwd`
cd ${n2}
# super-user can always modify ownership
-# 2
+
expect 0 create ${n0} 0644
expect 0 chown ${n0} 123 456
expect 123,456 lstat ${n0} uid,gid
expect 0 chown ${n0} 0 0
expect 0,0 lstat ${n0} uid,gid
expect 0 unlink ${n0}
-# 8
+
expect 0 mkfifo ${n0} 0644
expect 0 chown ${n0} 123 456
expect 123,456 lstat ${n0} uid,gid
expect 0 chown ${n0} 0 0
expect 0,0 lstat ${n0} uid,gid
expect 0 unlink ${n0}
-# 14
+
+expect 0 mknod ${n0} b 0644 1 2
+expect 0 chown ${n0} 123 456
+expect 123,456 lstat ${n0} uid,gid
+expect 0 chown ${n0} 0 0
+expect 0,0 lstat ${n0} uid,gid
+expect 0 unlink ${n0}
+
+expect 0 mknod ${n0} c 0644 1 2
+expect 0 chown ${n0} 123 456
+expect 123,456 lstat ${n0} uid,gid
+expect 0 chown ${n0} 0 0
+expect 0,0 lstat ${n0} uid,gid
+expect 0 unlink ${n0}
+
+expect 0 bind ${n0}
+expect 0 chown ${n0} 123 456
+expect 123,456 lstat ${n0} uid,gid
+expect 0 chown ${n0} 0 0
+expect 0,0 lstat ${n0} uid,gid
+expect 0 unlink ${n0}
+
expect 0 mkdir ${n0} 0755
expect 0 chown ${n0} 123 456
expect 123,456 lstat ${n0} uid,gid
expect 0 chown ${n0} 0 0
expect 0,0 lstat ${n0} uid,gid
expect 0 rmdir ${n0}
-# 20
+
expect 0 create ${n0} 0644
expect 0 symlink ${n0} ${n1}
expect 0 chown ${n1} 123 456
@@ -57,7 +78,7 @@ expect 0 unlink ${n1}
# non-super-user can modify file group if he is owner of a file and
# gid he is setting is in his groups list.
-# 31
+
expect 0 create ${n0} 0644
expect 0 chown ${n0} 65534 65533
expect 65534,65533 lstat ${n0} uid,gid
@@ -69,14 +90,14 @@ expect 0 unlink ${n0}
# chown(2) return 0 if user is not owner of a file, but chown(2) is called
# with both uid and gid equal to -1.
-# 39
+
expect 0 create ${n0} 0644
expect 0 chown ${n0} 65534 65533
expect 0 -u 65532 -g 65531 -- chown ${n0} -1 -1
expect 0 unlink ${n0}
# when super-user calls chown(2), set-uid and set-gid bits may be removed.
-# 43
+
expect 0 create ${n0} 0644
expect 0 chown ${n0} 65534 65533
expect 0 chmod ${n0} 06555
@@ -84,7 +105,7 @@ expect 06555 lstat ${n0} mode
expect 0 chown ${n0} 65532 65531
expect "06555|0555" lstat ${n0} mode
expect 0 unlink ${n0}
-# 50
+
expect 0 create ${n0} 0644
expect 0 chown ${n0} 0 0
expect 0 chmod ${n0} 06555
@@ -92,7 +113,7 @@ expect 06555 lstat ${n0} mode
expect 0 chown ${n0} 65534 65533
expect "06555|0555" lstat ${n0} mode
expect 0 unlink ${n0}
-# 57
+
expect 0 create ${n0} 0644
expect 0 chown ${n0} 65534 65533
expect 0 chmod ${n0} 06555
@@ -103,7 +124,7 @@ expect 0 unlink ${n0}
# 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.
-# 64
+
expect 0 create ${n0} 0644
expect 0 chown ${n0} 65534 65533
expect 0 chmod ${n0} 06555
@@ -119,7 +140,7 @@ expect 06555 lstat ${n0} mode
expect 0 -u 65534 -g 65533,65532 -- chown ${n0} -1 -1
expect "06555,65534,65533|0555,65534,65533" lstat ${n0} mode,uid,gid
expect 0 unlink ${n0}
-# 79
+
expect 0 mkdir ${n0} 0755
expect 0 chown ${n0} 65534 65533
expect 0 chmod ${n0} 06555
@@ -135,7 +156,7 @@ 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}
-# 94
+
if supported lchmod; then
expect 0 symlink ${n1} ${n0}
expect 0 lchown ${n0} 65534 65533
@@ -155,7 +176,7 @@ if supported lchmod; then
fi
# successfull chown(2) call (except uid and gid equal to -1) updates ctime.
-# 109
+
expect 0 create ${n0} 0644
ctime1=`${fstest} stat ${n0} ctime`
sleep 1
@@ -164,7 +185,7 @@ expect 65534,65533 lstat ${n0} uid,gid
ctime2=`${fstest} stat ${n0} ctime`
test_check $ctime1 -lt $ctime2
expect 0 unlink ${n0}
-# 114
+
expect 0 mkdir ${n0} 0755
ctime1=`${fstest} stat ${n0} ctime`
sleep 1
@@ -173,7 +194,7 @@ expect 65534,65533 lstat ${n0} uid,gid
ctime2=`${fstest} stat ${n0} ctime`
test_check $ctime1 -lt $ctime2
expect 0 rmdir ${n0}
-# 119
+
expect 0 mkfifo ${n0} 0644
ctime1=`${fstest} stat ${n0} ctime`
sleep 1
@@ -182,7 +203,34 @@ expect 65534,65533 lstat ${n0} uid,gid
ctime2=`${fstest} stat ${n0} ctime`
test_check $ctime1 -lt $ctime2
expect 0 unlink ${n0}
-# 124
+
+expect 0 mknod ${n0} b 0644 1 2
+ctime1=`${fstest} stat ${n0} ctime`
+sleep 1
+expect 0 chown ${n0} 65534 65533
+expect 65534,65533 lstat ${n0} uid,gid
+ctime2=`${fstest} stat ${n0} ctime`
+test_check $ctime1 -lt $ctime2
+expect 0 unlink ${n0}
+
+expect 0 mknod ${n0} c 0644 1 2
+ctime1=`${fstest} stat ${n0} ctime`
+sleep 1
+expect 0 chown ${n0} 65534 65533
+expect 65534,65533 lstat ${n0} uid,gid
+ctime2=`${fstest} stat ${n0} ctime`
+test_check $ctime1 -lt $ctime2
+expect 0 unlink ${n0}
+
+expect 0 bind ${n0}
+ctime1=`${fstest} stat ${n0} ctime`
+sleep 1
+expect 0 chown ${n0} 65534 65533
+expect 65534,65533 lstat ${n0} uid,gid
+ctime2=`${fstest} stat ${n0} ctime`
+test_check $ctime1 -lt $ctime2
+expect 0 unlink ${n0}
+
expect 0 symlink ${n1} ${n0}
ctime1=`${fstest} lstat ${n0} ctime`
sleep 1
@@ -191,7 +239,7 @@ expect 65534,65533 lstat ${n0} uid,gid
ctime2=`${fstest} lstat ${n0} ctime`
test_check $ctime1 -lt $ctime2
expect 0 unlink ${n0}
-# 129
+
expect 0 create ${n0} 0644
expect 0 chown ${n0} 65534 65533
ctime1=`${fstest} stat ${n0} ctime`
@@ -201,7 +249,7 @@ expect 65534,65532 lstat ${n0} uid,gid
ctime2=`${fstest} stat ${n0} ctime`
test_check $ctime1 -lt $ctime2
expect 0 unlink ${n0}
-# 135
+
expect 0 mkdir ${n0} 0755
expect 0 chown ${n0} 65534 65533
ctime1=`${fstest} stat ${n0} ctime`
@@ -211,7 +259,7 @@ expect 65534,65532 lstat ${n0} uid,gid
ctime2=`${fstest} stat ${n0} ctime`
test_check $ctime1 -lt $ctime2
expect 0 rmdir ${n0}
-# 141
+
expect 0 mkfifo ${n0} 0644
expect 0 chown ${n0} 65534 65533
ctime1=`${fstest} stat ${n0} ctime`
@@ -222,7 +270,40 @@ expect 65534,65532 lstat ${n0} uid,gid
ctime2=`${fstest} stat ${n0} ctime`
test_check $ctime1 -lt $ctime2
expect 0 unlink ${n0}
-# 148
+
+expect 0 mknod ${n0} b 0644 1 2
+expect 0 chown ${n0} 65534 65533
+ctime1=`${fstest} stat ${n0} ctime`
+sleep 1
+expect 0 chown ${n0} 65534 65533
+expect 0 -u 65534 -g 65532 chown ${n0} 65534 65532
+expect 65534,65532 lstat ${n0} uid,gid
+ctime2=`${fstest} stat ${n0} ctime`
+test_check $ctime1 -lt $ctime2
+expect 0 unlink ${n0}
+
+expect 0 mknod ${n0} c 0644 1 2
+expect 0 chown ${n0} 65534 65533
+ctime1=`${fstest} stat ${n0} ctime`
+sleep 1
+expect 0 chown ${n0} 65534 65533
+expect 0 -u 65534 -g 65532 chown ${n0} 65534 65532
+expect 65534,65532 lstat ${n0} uid,gid
+ctime2=`${fstest} stat ${n0} ctime`
+test_check $ctime1 -lt $ctime2
+expect 0 unlink ${n0}
+
+expect 0 bind ${n0}
+expect 0 chown ${n0} 65534 65533
+ctime1=`${fstest} stat ${n0} ctime`
+sleep 1
+expect 0 chown ${n0} 65534 65533
+expect 0 -u 65534 -g 65532 chown ${n0} 65534 65532
+expect 65534,65532 lstat ${n0} uid,gid
+ctime2=`${fstest} stat ${n0} ctime`
+test_check $ctime1 -lt $ctime2
+expect 0 unlink ${n0}
+
expect 0 symlink ${n1} ${n0}
expect 0 lchown ${n0} 65534 65533
ctime1=`${fstest} lstat ${n0} ctime`
@@ -232,7 +313,7 @@ expect 65534,65532 lstat ${n0} uid,gid
ctime2=`${fstest} lstat ${n0} ctime`
test_check $ctime1 -lt $ctime2
expect 0 unlink ${n0}
-# 154
+
expect 0 create ${n0} 0644
ctime1=`${fstest} stat ${n0} ctime`
sleep 1
@@ -241,7 +322,7 @@ ctime2=`${fstest} stat ${n0} ctime`
todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated."
test_check $ctime1 -eq $ctime2
expect 0 unlink ${n0}
-# 158
+
expect 0 mkdir ${n0} 0644
ctime1=`${fstest} stat ${n0} ctime`
sleep 1
@@ -250,7 +331,7 @@ ctime2=`${fstest} stat ${n0} ctime`
todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated."
test_check $ctime1 -eq $ctime2
expect 0 rmdir ${n0}
-# 162
+
expect 0 mkfifo ${n0} 0644
ctime1=`${fstest} stat ${n0} ctime`
sleep 1
@@ -259,7 +340,34 @@ ctime2=`${fstest} stat ${n0} ctime`
todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated."
test_check $ctime1 -eq $ctime2
expect 0 unlink ${n0}
-# 166
+
+expect 0 mknod ${n0} b 0644 1 2
+ctime1=`${fstest} stat ${n0} ctime`
+sleep 1
+expect 0 -- chown ${n0} -1 -1
+ctime2=`${fstest} stat ${n0} ctime`
+todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated."
+test_check $ctime1 -eq $ctime2
+expect 0 unlink ${n0}
+
+expect 0 mknod ${n0} c 0644 1 2
+ctime1=`${fstest} stat ${n0} ctime`
+sleep 1
+expect 0 -- chown ${n0} -1 -1
+ctime2=`${fstest} stat ${n0} ctime`
+todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated."
+test_check $ctime1 -eq $ctime2
+expect 0 unlink ${n0}
+
+expect 0 bind ${n0}
+ctime1=`${fstest} stat ${n0} ctime`
+sleep 1
+expect 0 -- chown ${n0} -1 -1
+ctime2=`${fstest} stat ${n0} ctime`
+todo Linux "According to POSIX: If both owner and group are -1, the times need not be updated."
+test_check $ctime1 -eq $ctime2
+expect 0 unlink ${n0}
+
expect 0 symlink ${n1} ${n0}
ctime1=`${fstest} lstat ${n0} ctime`
sleep 1
@@ -270,7 +378,7 @@ test_check $ctime1 -eq $ctime2
expect 0 unlink ${n0}
# unsuccessful chown(2) does not update ctime.
-# 170
+
expect 0 create ${n0} 0644
ctime1=`${fstest} stat ${n0} ctime`
sleep 1
@@ -278,7 +386,7 @@ expect EPERM -u 65534 -- chown ${n0} 655
ctime2=`${fstest} stat ${n0} ctime`
test_check $ctime1 -eq $ctime2
expect 0 unlink ${n0}
-# 174
+
expect 0 mkdir ${n0} 0755
ctime1=`${fstest} stat ${n0} ctime`
sleep 1
@@ -286,7 +394,7 @@ expect EPERM -u 65534 -g 65534 -- chown
ctime2=`${fstest} stat ${n0} ctime`
test_check $ctime1 -eq $ctime2
expect 0 rmdir ${n0}
-# 178
+
expect 0 mkfifo ${n0} 0644
ctime1=`${fstest} stat ${n0} ctime`
sleep 1
@@ -294,7 +402,31 @@ expect EPERM -u 65534 -g 65534 chown ${n
ctime2=`${fstest} stat ${n0} ctime`
test_check $ctime1 -eq $ctime2
expect 0 unlink ${n0}
-# 182
+
+expect 0 mknod ${n0} b 0644 1 2
+ctime1=`${fstest} stat ${n0} ctime`
+sleep 1
+expect EPERM -u 65534 -g 65534 chown ${n0} 65534 65534
+ctime2=`${fstest} stat ${n0} ctime`
+test_check $ctime1 -eq $ctime2
+expect 0 unlink ${n0}
+
+expect 0 mknod ${n0} c 0644 1 2
+ctime1=`${fstest} stat ${n0} ctime`
+sleep 1
+expect EPERM -u 65534 -g 65534 chown ${n0} 65534 65534
+ctime2=`${fstest} stat ${n0} ctime`
+test_check $ctime1 -eq $ctime2
+expect 0 unlink ${n0}
+
+expect 0 bind ${n0}
+ctime1=`${fstest} stat ${n0} ctime`
+sleep 1
+expect EPERM -u 65534 -g 65534 chown ${n0} 65534 65534
+ctime2=`${fstest} stat ${n0} ctime`
+test_check $ctime1 -eq $ctime2
+expect 0 unlink ${n0}
+
expect 0 symlink ${n1} ${n0}
ctime1=`${fstest} lstat ${n0} ctime`
sleep 1
@@ -303,6 +435,5 @@ ctime2=`${fstest} lstat ${n0} ctime`
test_check $ctime1 -eq $ctime2
expect 0 unlink ${n0}
-# 186
cd ${cdir}
expect 0 rmdir ${n2}
Modified: head/tools/regression/fstest/tests/link/00.t
==============================================================================
--- head/tools/regression/fstest/tests/link/00.t Wed Aug 11 16:34:26 2010 (r211179)
+++ head/tools/regression/fstest/tests/link/00.t Wed Aug 11 16:34:44 2010 (r211180)
@@ -6,7 +6,7 @@ desc="link creates hardlinks"
dir=`dirname $0`
. ${dir}/../misc.sh
-echo "1..82"
+echo "1..217"
n0=`namegen`
n1=`namegen`
@@ -17,135 +17,77 @@ expect 0 mkdir ${n3} 0755
cdir=`pwd`
cd ${n3}
-expect 0 create ${n0} 0644
-expect regular,0644,1 lstat ${n0} type,mode,nlink
-
-expect 0 link ${n0} ${n1}
-expect regular,0644,2 lstat ${n0} type,mode,nlink
-expect regular,0644,2 lstat ${n1} type,mode,nlink
-
-expect 0 link ${n1} ${n2}
-expect regular,0644,3 lstat ${n0} type,mode,nlink
-expect regular,0644,3 lstat ${n1} type,mode,nlink
-expect regular,0644,3 lstat ${n2} type,mode,nlink
-
-expect 0 chmod ${n1} 0201
-expect 0 chown ${n1} 65534 65533
-
-expect regular,0201,3,65534,65533 lstat ${n0} type,mode,nlink,uid,gid
-expect regular,0201,3,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
-expect regular,0201,3,65534,65533 lstat ${n2} type,mode,nlink,uid,gid
-
-expect 0 unlink ${n0}
-expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
-expect regular,0201,2,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
-expect regular,0201,2,65534,65533 lstat ${n2} type,mode,nlink,uid,gid
-
-expect 0 unlink ${n2}
-expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
-expect regular,0201,1,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
-expect ENOENT lstat ${n2} type,mode,nlink,uid,gid
-
-expect 0 unlink ${n1}
-expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
-expect ENOENT lstat ${n1} type,mode,nlink,uid,gid
-expect ENOENT lstat ${n2} type,mode,nlink,uid,gid
-
-expect 0 mkfifo ${n0} 0644
-expect fifo,0644,1 lstat ${n0} type,mode,nlink
-
-expect 0 link ${n0} ${n1}
-expect fifo,0644,2 lstat ${n0} type,mode,nlink
-expect fifo,0644,2 lstat ${n1} type,mode,nlink
-
-expect 0 link ${n1} ${n2}
-expect fifo,0644,3 lstat ${n0} type,mode,nlink
-expect fifo,0644,3 lstat ${n1} type,mode,nlink
-expect fifo,0644,3 lstat ${n2} type,mode,nlink
-
-expect 0 chmod ${n1} 0201
-expect 0 chown ${n1} 65534 65533
-
-expect fifo,0201,3,65534,65533 lstat ${n0} type,mode,nlink,uid,gid
-expect fifo,0201,3,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
-expect fifo,0201,3,65534,65533 lstat ${n2} type,mode,nlink,uid,gid
-
-expect 0 unlink ${n0}
-expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
-expect fifo,0201,2,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
-expect fifo,0201,2,65534,65533 lstat ${n2} type,mode,nlink,uid,gid
-
-expect 0 unlink ${n2}
-expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
-expect fifo,0201,1,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
-expect ENOENT lstat ${n2} type,mode,nlink,uid,gid
-
-expect 0 unlink ${n1}
-expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
-expect ENOENT lstat ${n1} type,mode,nlink,uid,gid
-expect ENOENT lstat ${n2} type,mode,nlink,uid,gid
+for type in regular fifo block char socket; do
+ create_file ${type} ${n0} 0 0
+ expect ${type},1 lstat ${n0} type,nlink
+
+ expect 0 link ${n0} ${n1}
+ expect ${type},2 lstat ${n0} type,nlink
+ expect ${type},2 lstat ${n1} type,nlink
+
+ expect 0 link ${n1} ${n2}
+ expect ${type},3 lstat ${n0} type,nlink
+ expect ${type},3 lstat ${n1} type,nlink
+ expect ${type},3 lstat ${n2} type,nlink
+
+ expect 0 chmod ${n1} 0201
+ expect 0 chown ${n1} 65534 65533
+
+ expect ${type},0201,3,65534,65533 lstat ${n0} type,mode,nlink,uid,gid
+ expect ${type},0201,3,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
+ expect ${type},0201,3,65534,65533 lstat ${n2} type,mode,nlink,uid,gid
+
+ expect 0 unlink ${n0}
+ expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
+ expect ${type},0201,2,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
+ expect ${type},0201,2,65534,65533 lstat ${n2} type,mode,nlink,uid,gid
+
+ expect 0 unlink ${n2}
+ expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
+ expect ${type},0201,1,65534,65533 lstat ${n1} type,mode,nlink,uid,gid
+ expect ENOENT lstat ${n2} type,mode,nlink,uid,gid
+
+ expect 0 unlink ${n1}
+ expect ENOENT lstat ${n0} type,mode,nlink,uid,gid
+ expect ENOENT lstat ${n1} type,mode,nlink,uid,gid
+ expect ENOENT lstat ${n2} type,mode,nlink,uid,gid
+done
# successful link(2) updates ctime.
-expect 0 create ${n0} 0644
-ctime1=`${fstest} stat ${n0} ctime`
-dctime1=`${fstest} stat . ctime`
-dmtime1=`${fstest} stat . mtime`
-sleep 1
-expect 0 link ${n0} ${n1}
-ctime2=`${fstest} stat ${n0} ctime`
-test_check $ctime1 -lt $ctime2
-dctime2=`${fstest} stat . ctime`
-test_check $dctime1 -lt $dctime2
-dmtime2=`${fstest} stat . mtime`
-test_check $dctime1 -lt $dmtime2
-expect 0 unlink ${n0}
-expect 0 unlink ${n1}
-
-expect 0 mkfifo ${n0} 0644
-ctime1=`${fstest} stat ${n0} ctime`
-dctime1=`${fstest} stat . ctime`
-dmtime1=`${fstest} stat . mtime`
-sleep 1
-expect 0 link ${n0} ${n1}
-ctime2=`${fstest} stat ${n0} ctime`
-test_check $ctime1 -lt $ctime2
-dctime2=`${fstest} stat . ctime`
-test_check $dctime1 -lt $dctime2
-dmtime2=`${fstest} stat . mtime`
-test_check $dctime1 -lt $dmtime2
-expect 0 unlink ${n0}
-expect 0 unlink ${n1}
+for type in regular fifo block char socket; do
+ create_file ${type} ${n0} 0 0
+ ctime1=`${fstest} stat ${n0} ctime`
+ dctime1=`${fstest} stat . ctime`
+ dmtime1=`${fstest} stat . mtime`
+ sleep 1
+ expect 0 link ${n0} ${n1}
+ ctime2=`${fstest} stat ${n0} ctime`
+ test_check $ctime1 -lt $ctime2
+ dctime2=`${fstest} stat . ctime`
+ test_check $dctime1 -lt $dctime2
+ dmtime2=`${fstest} stat . mtime`
+ test_check $dctime1 -lt $dmtime2
+ expect 0 unlink ${n0}
+ expect 0 unlink ${n1}
+done
# unsuccessful link(2) does not update ctime.
-expect 0 create ${n0} 0644
-expect 0 -- chown ${n0} 65534 -1
-ctime1=`${fstest} stat ${n0} ctime`
-dctime1=`${fstest} stat . ctime`
-dmtime1=`${fstest} stat . mtime`
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list