From owner-svn-src-all@FreeBSD.ORG Wed Aug 11 17:34:59 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1078C1065678; Wed, 11 Aug 2010 17:34:59 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F205D8FC1D; Wed, 11 Aug 2010 17:34:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7BHYwIZ023572; Wed, 11 Aug 2010 17:34:58 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7BHYwA0023551; Wed, 11 Aug 2010 17:34:58 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201008111734.o7BHYwA0023551@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 11 Aug 2010 17:34:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211186 - in head/tools/regression/fstest/tests: chflags link mkdir open rename X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Aug 2010 17:34:59 -0000 Author: pjd Date: Wed Aug 11 17:34:58 2010 New Revision: 211186 URL: http://svn.freebsd.org/changeset/base/211186 Log: - Use loops where possible to avoid code duplication. - Don't pass uid and gid to create_file() if not needed. - 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/link/00.t head/tools/regression/fstest/tests/mkdir/10.t head/tools/regression/fstest/tests/open/22.t head/tools/regression/fstest/tests/rename/00.t head/tools/regression/fstest/tests/rename/06.t head/tools/regression/fstest/tests/rename/07.t head/tools/regression/fstest/tests/rename/08.t head/tools/regression/fstest/tests/rename/13.t head/tools/regression/fstest/tests/rename/14.t head/tools/regression/fstest/tests/rename/15.t head/tools/regression/fstest/tests/rename/20.t Modified: head/tools/regression/fstest/tests/chflags/00.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/00.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/chflags/00.t Wed Aug 11 17:34:58 2010 (r211186) @@ -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..780" + echo "1..742" ;; FreeBSD:ZFS) allflags="UF_NODUMP,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" userflags="UF_NODUMP" systemflags="SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK" - echo "1..520" + echo "1..482" ;; *) quick_exit @@ -37,7 +37,7 @@ cdir=`pwd` cd ${n2} for type in regular dir fifo block char socket; do - create_file ${type} ${n0} 0 0 + create_file ${type} ${n0} expect none stat ${n0} flags expect 0 chflags ${n0} ${allflags} expect ${allflags} stat ${n0} flags @@ -53,7 +53,7 @@ for type in regular dir fifo block char expect 0 unlink ${n0} fi - create_file ${type} ${n0} 0 0 + create_file ${type} ${n0} expect none stat ${n0} flags expect 0 lchflags ${n0} ${allflags} expect ${allflags} stat ${n0} flags @@ -111,7 +111,7 @@ expect 0 unlink ${n0} # successful chflags(2) updates ctime. for type in regular dir fifo block char socket symlink; do if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} 0 0 + create_file ${type} ${n0} for flag in `echo ${allflags},none | tr ',' ' '`; do ctime1=`${fstest} stat ${n0} ctime` sleep 1 @@ -126,7 +126,7 @@ for type in regular dir fifo block char fi fi - create_file ${type} ${n0} 0 0 + create_file ${type} ${n0} for flag in `echo ${allflags},none | tr ',' ' '`; do ctime1=`${fstest} lstat ${n0} ctime` sleep 1 @@ -144,7 +144,7 @@ done # unsuccessful chflags(2) does not update ctime. for type in regular dir fifo block char socket symlink; do if [ "${type}" != "symlink" ]; then - create_file ${type} ${n0} 0 0 + create_file ${type} ${n0} for flag in `echo ${allflags},none | tr ',' ' '`; do ctime1=`${fstest} stat ${n0} ctime` sleep 1 @@ -159,7 +159,7 @@ for type in regular dir fifo block char fi fi - create_file ${type} ${n0} 0 0 + create_file ${type} ${n0} for flag in `echo ${allflags},none | tr ',' ' '`; do ctime1=`${fstest} lstat ${n0} ctime` sleep 1 Modified: head/tools/regression/fstest/tests/chflags/10.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/10.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/chflags/10.t Wed Aug 11 17:34:58 2010 (r211186) @@ -8,7 +8,7 @@ dir=`dirname $0` require chflags -echo "1..210" +echo "1..197" n0=`namegen` n1=`namegen` @@ -20,7 +20,7 @@ cd ${n0} for type in regular dir fifo block char socket symlink; do if [ "${type}" != "symlink" ]; then - create_file ${type} ${n1} 0 0 + create_file ${type} ${n1} 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} @@ -35,7 +35,7 @@ for type in regular dir fifo block char fi fi - create_file ${type} ${n1} 0 0 + create_file ${type} ${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} Modified: head/tools/regression/fstest/tests/chflags/11.t ============================================================================== --- head/tools/regression/fstest/tests/chflags/11.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/chflags/11.t Wed Aug 11 17:34:58 2010 (r211186) @@ -8,7 +8,7 @@ dir=`dirname $0` require chflags_SF_SNAPSHOT -echo "1..158" +echo "1..145" n0=`namegen` n1=`namegen` @@ -20,7 +20,7 @@ cd ${n0} for type in regular dir fifo block char socket symlink; do if [ "${type}" != "symlink" ]; then - create_file ${type} ${n1} 0 0 + create_file ${type} ${n1} expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT expect none stat ${n1} flags expect EPERM chflags ${n1} SF_SNAPSHOT @@ -37,7 +37,7 @@ for type in regular dir fifo block char fi fi - create_file ${type} ${n1} 0 0 + create_file ${type} ${n1} expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT expect none lstat ${n1} flags expect EPERM lchflags ${n1} SF_SNAPSHOT Modified: head/tools/regression/fstest/tests/link/00.t ============================================================================== --- head/tools/regression/fstest/tests/link/00.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/link/00.t Wed Aug 11 17:34:58 2010 (r211186) @@ -6,7 +6,7 @@ desc="link creates hardlinks" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..217" +echo "1..202" n0=`namegen` n1=`namegen` @@ -18,7 +18,7 @@ cdir=`pwd` cd ${n3} for type in regular fifo block char socket; do - create_file ${type} ${n0} 0 0 + create_file ${type} ${n0} expect ${type},1 lstat ${n0} type,nlink expect 0 link ${n0} ${n1} @@ -55,7 +55,7 @@ done # successful link(2) updates ctime. for type in regular fifo block char socket; do - create_file ${type} ${n0} 0 0 + create_file ${type} ${n0} ctime1=`${fstest} stat ${n0} ctime` dctime1=`${fstest} stat . ctime` dmtime1=`${fstest} stat . mtime` @@ -73,7 +73,7 @@ done # unsuccessful link(2) does not update ctime. for type in regular fifo block char socket; do - create_file ${type} ${n0} 0 0 + create_file ${type} ${n0} expect 0 -- chown ${n0} 65534 -1 ctime1=`${fstest} stat ${n0} ctime` dctime1=`${fstest} stat . ctime` Modified: head/tools/regression/fstest/tests/mkdir/10.t ============================================================================== --- head/tools/regression/fstest/tests/mkdir/10.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/mkdir/10.t Wed Aug 11 17:34:58 2010 (r211186) @@ -10,30 +10,12 @@ echo "1..21" n0=`namegen` -expect 0 mkdir ${n0} 0755 -expect EEXIST mkdir ${n0} 0755 -expect 0 rmdir ${n0} - -expect 0 create ${n0} 0644 -expect EEXIST mkdir ${n0} 0755 -expect 0 unlink ${n0} - -expect 0 symlink test ${n0} -expect EEXIST mkdir ${n0} 0755 -expect 0 unlink ${n0} - -expect 0 mkfifo ${n0} 0644 -expect EEXIST mkdir ${n0} 0755 -expect 0 unlink ${n0} - -expect 0 mknod ${n0} b 0644 1 2 -expect EEXIST mkdir ${n0} 0755 -expect 0 unlink ${n0} - -expect 0 mknod ${n0} c 0644 1 2 -expect EEXIST mkdir ${n0} 0755 -expect 0 unlink ${n0} - -expect 0 bind ${n0} -expect EEXIST mkdir ${n0} 0755 -expect 0 unlink ${n0} +for type in regular dir fifo block char socket symlink; do + create_file ${type} ${n0} + expect EEXIST mkdir ${n0} 0755 + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0} + else + expect 0 unlink ${n0} + fi +done Modified: head/tools/regression/fstest/tests/open/22.t ============================================================================== --- head/tools/regression/fstest/tests/open/22.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/open/22.t Wed Aug 11 17:34:58 2010 (r211186) @@ -10,30 +10,12 @@ echo "1..21" n0=`namegen` -expect 0 create ${n0} 0644 -expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 -expect 0 unlink ${n0} - -expect 0 mkdir ${n0} 0755 -expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 -expect 0 rmdir ${n0} - -expect 0 mkfifo ${n0} 0644 -expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 -expect 0 unlink ${n0} - -expect 0 symlink test ${n0} -expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 -expect 0 unlink ${n0} - -expect 0 mknod ${n0} b 0644 1 2 -expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 -expect 0 unlink ${n0} - -expect 0 mknod ${n0} c 0644 1 2 -expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 -expect 0 unlink ${n0} - -expect 0 bind ${n0} -expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 -expect 0 unlink ${n0} +for type in regular dir fifo block char socket symlink; do + create_file ${type} ${n0} + expect EEXIST open ${n0} O_CREAT,O_EXCL 0644 + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0} + else + expect 0 unlink ${n0} + fi +done Modified: head/tools/regression/fstest/tests/rename/00.t ============================================================================== --- head/tools/regression/fstest/tests/rename/00.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/rename/00.t Wed Aug 11 17:34:58 2010 (r211186) @@ -6,7 +6,7 @@ desc="rename changes file name" dir=`dirname $0` . ${dir}/../misc.sh -echo "1..145" +echo "1..150" n0=`namegen` n1=`namegen` @@ -17,21 +17,23 @@ expect 0 mkdir ${n3} 0755 cdir=`pwd` cd ${n3} -expect 0 create ${n0} 0644 -expect regular,0644,1 lstat ${n0} type,mode,nlink -inode=`${fstest} lstat ${n0} inode` -expect 0 rename ${n0} ${n1} -expect ENOENT lstat ${n0} type,mode,nlink -expect regular,${inode},0644,1 lstat ${n1} type,inode,mode,nlink -expect 0 link ${n1} ${n0} -expect regular,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect regular,${inode},0644,2 lstat ${n1} type,inode,mode,nlink -expect 0 rename ${n1} ${n2} -expect regular,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect ENOENT lstat ${n1} type,mode,nlink -expect regular,${inode},0644,2 lstat ${n2} type,inode,mode,nlink -expect 0 unlink ${n0} -expect 0 unlink ${n2} +for type in regular fifo block char socket; do + create_file ${type} ${n0} 0644 + expect ${type},0644,1 lstat ${n0} type,mode,nlink + inode=`${fstest} lstat ${n0} inode` + expect 0 rename ${n0} ${n1} + expect ENOENT lstat ${n0} type,mode,nlink + expect ${type},${inode},0644,1 lstat ${n1} type,inode,mode,nlink + expect 0 link ${n1} ${n0} + expect ${type},${inode},0644,2 lstat ${n0} type,inode,mode,nlink + expect ${type},${inode},0644,2 lstat ${n1} type,inode,mode,nlink + expect 0 rename ${n1} ${n2} + expect ${type},${inode},0644,2 lstat ${n0} type,inode,mode,nlink + expect ENOENT lstat ${n1} type,mode,nlink + expect ${type},${inode},0644,2 lstat ${n2} type,inode,mode,nlink + expect 0 unlink ${n0} + expect 0 unlink ${n2} +done expect 0 mkdir ${n0} 0755 expect dir,0755 lstat ${n0} type,mode @@ -41,70 +43,6 @@ expect ENOENT lstat ${n0} type,mode expect dir,${inode},0755 lstat ${n1} type,inode,mode expect 0 rmdir ${n1} -expect 0 mkfifo ${n0} 0644 -expect fifo,0644,1 lstat ${n0} type,mode,nlink -inode=`${fstest} lstat ${n0} inode` -expect 0 rename ${n0} ${n1} -expect ENOENT lstat ${n0} type,mode,nlink -expect fifo,${inode},0644,1 lstat ${n1} type,inode,mode,nlink -expect 0 link ${n1} ${n0} -expect fifo,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect fifo,${inode},0644,2 lstat ${n1} type,inode,mode,nlink -expect 0 rename ${n1} ${n2} -expect fifo,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect ENOENT lstat ${n1} type,mode,nlink -expect fifo,${inode},0644,2 lstat ${n2} type,inode,mode,nlink -expect 0 unlink ${n0} -expect 0 unlink ${n2} - -expect 0 mknod ${n0} b 0644 1 2 -expect block,0644,1 lstat ${n0} type,mode,nlink -inode=`${fstest} lstat ${n0} inode` -expect 0 rename ${n0} ${n1} -expect ENOENT lstat ${n0} type,mode,nlink -expect block,${inode},0644,1 lstat ${n1} type,inode,mode,nlink -expect 0 link ${n1} ${n0} -expect block,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect block,${inode},0644,2 lstat ${n1} type,inode,mode,nlink -expect 0 rename ${n1} ${n2} -expect block,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect ENOENT lstat ${n1} type,mode,nlink -expect block,${inode},0644,2 lstat ${n2} type,inode,mode,nlink -expect 0 unlink ${n0} -expect 0 unlink ${n2} - -expect 0 mknod ${n0} c 0644 1 2 -expect char,0644,1 lstat ${n0} type,mode,nlink -inode=`${fstest} lstat ${n0} inode` -expect 0 rename ${n0} ${n1} -expect ENOENT lstat ${n0} type,mode,nlink -expect char,${inode},0644,1 lstat ${n1} type,inode,mode,nlink -expect 0 link ${n1} ${n0} -expect char,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect char,${inode},0644,2 lstat ${n1} type,inode,mode,nlink -expect 0 rename ${n1} ${n2} -expect char,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect ENOENT lstat ${n1} type,mode,nlink -expect char,${inode},0644,2 lstat ${n2} type,inode,mode,nlink -expect 0 unlink ${n0} -expect 0 unlink ${n2} - -expect 0 -U 0133 bind ${n0} -expect socket,0644,1 lstat ${n0} type,mode,nlink -inode=`${fstest} lstat ${n0} inode` -expect 0 rename ${n0} ${n1} -expect ENOENT lstat ${n0} type,mode,nlink -expect socket,${inode},0644,1 lstat ${n1} type,inode,mode,nlink -expect 0 link ${n1} ${n0} -expect socket,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect socket,${inode},0644,2 lstat ${n1} type,inode,mode,nlink -expect 0 rename ${n1} ${n2} -expect socket,${inode},0644,2 lstat ${n0} type,inode,mode,nlink -expect ENOENT lstat ${n1} type,mode,nlink -expect socket,${inode},0644,2 lstat ${n2} type,inode,mode,nlink -expect 0 unlink ${n0} -expect 0 unlink ${n2} - expect 0 create ${n0} 0644 rinode=`${fstest} lstat ${n0} inode` expect regular,0644 lstat ${n0} type,mode @@ -120,118 +58,34 @@ expect 0 unlink ${n0} expect 0 unlink ${n2} # successful rename(2) updates ctime. -expect 0 create ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n1} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n1} - -expect 0 mkdir ${n0} 0755 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n1} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 rmdir ${n1} - -expect 0 mkfifo ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n1} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n1} - -expect 0 mknod ${n0} b 0644 1 2 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n1} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n1} - -expect 0 mknod ${n0} c 0644 1 2 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n1} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n1} - -expect 0 bind ${n0} -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect 0 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n1} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n1} - -expect 0 symlink ${n2} ${n0} -ctime1=`${fstest} lstat ${n0} ctime` -sleep 1 -expect 0 rename ${n0} ${n1} -ctime2=`${fstest} lstat ${n1} ctime` -test_check $ctime1 -lt $ctime2 -expect 0 unlink ${n1} +for type in regular dir fifo block char socket symlink; do + create_file ${type} ${n0} + ctime1=`${fstest} lstat ${n0} ctime` + sleep 1 + expect 0 rename ${n0} ${n1} + ctime2=`${fstest} lstat ${n1} ctime` + test_check $ctime1 -lt $ctime2 + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1} + else + expect 0 unlink ${n1} + fi +done # unsuccessful link(2) does not update ctime. -expect 0 create ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -expect 0 mkdir ${n0} 0755 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 rmdir ${n0} - -expect 0 mkfifo ${n0} 0644 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -expect 0 mknod ${n0} b 0644 1 2 -ctime1=`${fstest} stat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 rename ${n0} ${n1} -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 EACCES -u 65534 rename ${n0} ${n1} -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 EACCES -u 65534 rename ${n0} ${n1} -ctime2=`${fstest} stat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} - -expect 0 symlink ${n2} ${n0} -ctime1=`${fstest} lstat ${n0} ctime` -sleep 1 -expect EACCES -u 65534 rename ${n0} ${n1} -ctime2=`${fstest} lstat ${n0} ctime` -test_check $ctime1 -eq $ctime2 -expect 0 unlink ${n0} +for type in regular dir fifo block char socket symlink; do + create_file ${type} ${n0} + ctime1=`${fstest} lstat ${n0} ctime` + sleep 1 + expect EACCES -u 65534 rename ${n0} ${n1} + ctime2=`${fstest} lstat ${n0} ctime` + test_check $ctime1 -eq $ctime2 + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0} + else + expect 0 unlink ${n0} + fi +done cd ${cdir} expect 0 rmdir ${n3} Modified: head/tools/regression/fstest/tests/rename/06.t ============================================================================== --- head/tools/regression/fstest/tests/rename/06.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/rename/06.t Wed Aug 11 17:34:58 2010 (r211186) @@ -11,11 +11,11 @@ require chflags case "${os}:${fs}" in FreeBSD:ZFS) flags="SF_IMMUTABLE SF_NOUNLINK SF_APPEND" - echo "1..105" + echo "1..195" ;; FreeBSD:UFS) flags="SF_IMMUTABLE SF_NOUNLINK SF_APPEND UF_IMMUTABLE UF_NOUNLINK UF_APPEND" - echo "1..189" + echo "1..351" ;; *) quick_exit @@ -24,86 +24,38 @@ esac n0=`namegen` n1=`namegen` -expect 0 create ${n0} 0644 -for flag in ${flags}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0} ${n1} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n1} ${n0} +for type in regular dir fifo block char socket symlink; do + if [ "${type}" != "symlink" ]; then + create_file ${type} ${n0} + for flag in ${flags}; do + expect 0 chflags ${n0} ${flag} + expect ${flag} stat ${n0} flags + [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." + expect EPERM rename ${n0} ${n1} + [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." + expect ENOENT rename ${n1} ${n0} + done + expect 0 chflags ${n0} none + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0} + else + expect 0 unlink ${n0} + fi + fi + + create_file ${type} ${n0} + for flag in ${flags}; do + expect 0 lchflags ${n0} ${flag} + expect ${flag} lstat ${n0} flags + [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." + expect EPERM rename ${n0} ${n1} + [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." + expect ENOENT rename ${n1} ${n0} + done + expect 0 lchflags ${n0} none + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0} + else + expect 0 unlink ${n0} + fi done -expect 0 chflags ${n0} none -expect 0 unlink ${n0} - -expect 0 mkdir ${n0} 0755 -for flag in ${flags}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a directory protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0} ${n1} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a directory protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n1} ${n0} -done -expect 0 chflags ${n0} none -expect 0 rmdir ${n0} - -expect 0 mkfifo ${n0} 0644 -for flag in ${flags}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a fifo protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0} ${n1} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a fifo protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n1} ${n0} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0} - -expect 0 mknod ${n0} b 0644 1 2 -for flag in ${flags}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a device protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0} ${n1} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a device protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n1} ${n0} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0} - -expect 0 mknod ${n0} c 0644 1 2 -for flag in ${flags}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a device protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0} ${n1} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a device protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n1} ${n0} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0} - -expect 0 bind ${n0} -for flag in ${flags}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a socket protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0} ${n1} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a socket protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n1} ${n0} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0} - -expect 0 symlink ${n1} ${n0} -for flag in ${flags}; do - expect 0 lchflags ${n0} ${flag} - expect ${flag} lstat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a symlink protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0} ${n1} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a symlink protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n1} ${n0} -done -expect 0 lchflags ${n0} none -expect 0 unlink ${n0} Modified: head/tools/regression/fstest/tests/rename/07.t ============================================================================== --- head/tools/regression/fstest/tests/rename/07.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/rename/07.t Wed Aug 11 17:34:58 2010 (r211186) @@ -29,158 +29,38 @@ n2=`namegen` expect 0 mkdir ${n0} 0755 -expect 0 create ${n0}/${n1} 0644 -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0}/${n1} ${n2} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n2} ${n0}/${n1} +for type in regular dir fifo block char socket symlink; do + create_file ${type} ${n0}/${n1} + for flag in ${flags1}; do + expect 0 chflags ${n0} ${flag} + expect ${flag} stat ${n0} flags + [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." + expect EPERM rename ${n0}/${n1} ${n2} + [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." + expect ENOENT rename ${n2} ${n0}/${n1} + done + expect 0 chflags ${n0} none + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0}/${n1} + else + expect 0 unlink ${n0}/${n1} + fi +done + +for type in regular dir fifo block char socket symlink; do + create_file ${type} ${n0}/${n1} + for flag in ${flags2}; do + expect 0 chflags ${n0} ${flag} + expect ${flag} stat ${n0} flags + expect 0 rename ${n0}/${n1} ${n2} + expect 0 rename ${n2} ${n0}/${n1} + done + expect 0 chflags ${n0} none + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n0}/${n1} + else + expect 0 unlink ${n0}/${n1} + fi done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 mkdir ${n0}/${n1} 0755 -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0}/${n1} ${n2} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 rmdir ${n0}/${n1} - -expect 0 mkfifo ${n0}/${n1} 0644 -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0}/${n1} ${n2} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 mknod ${n0}/${n1} b 0644 1 2 -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0}/${n1} ${n2} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 mknod ${n0}/${n1} c 0644 1 2 -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0}/${n1} ${n2} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 bind ${n0}/${n1} -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0}/${n1} ${n2} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 symlink ${n2} ${n0}/${n1} -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect EPERM rename ${n0}/${n1} ${n2} - [ "${flag}" = "SF_APPEND" ] && todo FreeBSD:ZFS "Renaming a file protected by SF_APPEND should return EPERM." - expect ENOENT rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 create ${n0}/${n1} 0644 -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n0}/${n1} ${n2} - expect 0 rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 mkdir ${n0}/${n1} 0755 -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n0}/${n1} ${n2} - expect 0 rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 rmdir ${n0}/${n1} - -expect 0 mkfifo ${n0}/${n1} 0644 -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n0}/${n1} ${n2} - expect 0 rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 mknod ${n0}/${n1} b 0644 1 2 -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n0}/${n1} ${n2} - expect 0 rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 mknod ${n0}/${n1} c 0644 1 2 -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n0}/${n1} ${n2} - expect 0 rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 bind ${n0}/${n1} -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n0}/${n1} ${n2} - expect 0 rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} - -expect 0 symlink ${n2} ${n0}/${n1} -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n0}/${n1} ${n2} - expect 0 rename ${n2} ${n0}/${n1} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n0}/${n1} expect 0 rmdir ${n0} Modified: head/tools/regression/fstest/tests/rename/08.t ============================================================================== --- head/tools/regression/fstest/tests/rename/08.t Wed Aug 11 17:33:32 2010 (r211185) +++ head/tools/regression/fstest/tests/rename/08.t Wed Aug 11 17:34:58 2010 (r211186) @@ -12,12 +12,12 @@ case "${os}:${fs}" in FreeBSD:ZFS) flags1="SF_IMMUTABLE" flags2="SF_NOUNLINK SF_APPEND" - echo "1..110" + echo "1..128" ;; FreeBSD:UFS) flags1="SF_IMMUTABLE UF_IMMUTABLE" flags2="SF_NOUNLINK SF_APPEND UF_NOUNLINK UF_APPEND" - echo "1..188" + echo "1..219" ;; *) quick_exit @@ -29,118 +29,35 @@ n2=`namegen` expect 0 mkdir ${n0} 0755 -expect 0 create ${n1} 0644 -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect EPERM rename ${n1} ${n0}/${n2} +for type in regular dir fifo block char socket symlink; do + create_file ${type} ${n1} + for flag in ${flags1}; do + expect 0 chflags ${n0} ${flag} + expect ${flag} stat ${n0} flags + expect EPERM rename ${n1} ${n0}/${n2} + done + expect 0 chflags ${n0} none + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1} + else + expect 0 unlink ${n1} + fi +done + +for type in regular dir fifo block char socket symlink; do + create_file ${type} ${n1} + for flag in ${flags2}; do + expect 0 chflags ${n0} ${flag} + expect ${flag} stat ${n0} flags + expect 0 rename ${n1} ${n0}/${n2} + expect 0 chflags ${n0} none + expect 0 rename ${n0}/${n2} ${n1} + done + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1} + else + expect 0 unlink ${n1} + fi done -expect 0 chflags ${n0} none -expect 0 unlink ${n1} - -expect 0 mkdir ${n1} 0755 -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect EPERM rename ${n1} ${n0}/${n2} -done -expect 0 chflags ${n0} none -expect 0 rmdir ${n1} - -expect 0 mkfifo ${n1} 0644 -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect EPERM rename ${n1} ${n0}/${n2} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n1} - -expect 0 mknod ${n1} c 0644 1 2 -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect EPERM rename ${n1} ${n0}/${n2} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n1} - -expect 0 bind ${n1} -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect EPERM rename ${n1} ${n0}/${n2} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n1} - -expect 0 symlink ${n2} ${n1} -for flag in ${flags1}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect EPERM rename ${n1} ${n0}/${n2} -done -expect 0 chflags ${n0} none -expect 0 unlink ${n1} - -expect 0 create ${n1} 0644 -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n1} ${n0}/${n2} - expect 0 chflags ${n0} none - expect 0 rename ${n0}/${n2} ${n1} -done -expect 0 unlink ${n1} - -expect 0 mkdir ${n1} 0755 -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n1} ${n0}/${n2} - expect 0 chflags ${n0} none - expect 0 rename ${n0}/${n2} ${n1} -done -expect 0 rmdir ${n1} - -expect 0 mkfifo ${n1} 0644 -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n1} ${n0}/${n2} - expect 0 chflags ${n0} none - expect 0 rename ${n0}/${n2} ${n1} -done -expect 0 unlink ${n1} - -expect 0 mknod ${n1} c 0644 1 2 -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n1} ${n0}/${n2} - expect 0 chflags ${n0} none - expect 0 rename ${n0}/${n2} ${n1} -done -expect 0 unlink ${n1} - -expect 0 bind ${n1} -for flag in ${flags2}; do - expect 0 chflags ${n0} ${flag} - expect ${flag} stat ${n0} flags - expect 0 rename ${n1} ${n0}/${n2} - expect 0 chflags ${n0} none - expect 0 rename ${n0}/${n2} ${n1} *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***