Date: Tue, 17 Aug 2010 06:08:10 +0000 (UTC) From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r211410 - head/tools/regression/pjdfstest/tests/chown Message-ID: <201008170608.o7H68ArB020505@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pjd Date: Tue Aug 17 06:08:09 2010 New Revision: 211410 URL: http://svn.freebsd.org/changeset/base/211410 Log: More tests, especially for lchown(2). Modified: head/tools/regression/pjdfstest/tests/chown/01.t head/tools/regression/pjdfstest/tests/chown/04.t head/tools/regression/pjdfstest/tests/chown/05.t head/tools/regression/pjdfstest/tests/chown/06.t head/tools/regression/pjdfstest/tests/chown/07.t head/tools/regression/pjdfstest/tests/chown/10.t Modified: head/tools/regression/pjdfstest/tests/chown/01.t ============================================================================== --- head/tools/regression/pjdfstest/tests/chown/01.t Tue Aug 17 02:50:12 2010 (r211409) +++ head/tools/regression/pjdfstest/tests/chown/01.t Tue Aug 17 06:08:09 2010 (r211410) @@ -6,7 +6,7 @@ desc="chown returns ENOTDIR if a compone dir=`dirname $0` . ${dir}/../misc.sh -echo "1..5" +echo "1..6" n0=`namegen` n1=`namegen` @@ -14,5 +14,6 @@ n1=`namegen` expect 0 mkdir ${n0} 0755 expect 0 create ${n0}/${n1} 0644 expect ENOTDIR chown ${n0}/${n1}/test 65534 65534 +expect ENOTDIR lchown ${n0}/${n1}/test 65534 65534 expect 0 unlink ${n0}/${n1} expect 0 rmdir ${n0} Modified: head/tools/regression/pjdfstest/tests/chown/04.t ============================================================================== --- head/tools/regression/pjdfstest/tests/chown/04.t Tue Aug 17 02:50:12 2010 (r211409) +++ head/tools/regression/pjdfstest/tests/chown/04.t Tue Aug 17 06:08:09 2010 (r211410) @@ -6,12 +6,18 @@ desc="chown returns ENOENT if the named dir=`dirname $0` . ${dir}/../misc.sh -echo "1..4" +echo "1..9" n0=`namegen` n1=`namegen` +n2=`namegen` expect 0 mkdir ${n0} 0755 expect ENOENT chown ${n0}/${n1}/test 65534 65534 expect ENOENT chown ${n0}/${n1} 65534 65534 +expect ENOENT lchown ${n0}/${n1}/test 65534 65534 +expect ENOENT lchown ${n0}/${n1} 65534 65534 +expect 0 symlink ${n2} ${n0}/${n1} +expect ENOENT chown ${n0}/${n1} 65534 65534 +expect 0 unlink ${n0}/${n1} expect 0 rmdir ${n0} Modified: head/tools/regression/pjdfstest/tests/chown/05.t ============================================================================== --- head/tools/regression/pjdfstest/tests/chown/05.t Tue Aug 17 02:50:12 2010 (r211409) +++ head/tools/regression/pjdfstest/tests/chown/05.t Tue Aug 17 06:08:09 2010 (r211410) @@ -6,7 +6,7 @@ desc="chown returns EACCES when search p dir=`dirname $0` . ${dir}/../misc.sh -echo "1..15" +echo "1..18" n0=`namegen` n1=`namegen` @@ -22,11 +22,14 @@ expect 0 -u 65534 -g 65533,65534 -- chow expect 65534,65533 -u 65534 -g 65534 stat ${n1}/${n2} uid,gid expect 0 chmod ${n1} 0644 expect EACCES -u 65534 -g 65533,65534 -- chown ${n1}/${n2} -1 65534 +expect EACCES -u 65534 -g 65533,65534 -- lchown ${n1}/${n2} -1 65534 expect 0 chmod ${n1} 0755 expect 65534,65533 -u 65534 -g 65534 stat ${n1}/${n2} uid,gid expect 0 -u 65534 -g 65533,65534 -- chown ${n1}/${n2} -1 65534 expect 65534,65534 -u 65534 -g 65534 stat ${n1}/${n2} uid,gid -expect 0 -u 65534 -g 65534 unlink ${n1}/${n2} +expect 0 -u 65534 -g 65533,65534 -- lchown ${n1}/${n2} -1 65533 +expect 65534,65533 -u 65534 -g 65533 stat ${n1}/${n2} uid,gid +expect 0 unlink ${n1}/${n2} expect 0 rmdir ${n1} cd ${cdir} expect 0 rmdir ${n0} Modified: head/tools/regression/pjdfstest/tests/chown/06.t ============================================================================== --- head/tools/regression/pjdfstest/tests/chown/06.t Tue Aug 17 02:50:12 2010 (r211409) +++ head/tools/regression/pjdfstest/tests/chown/06.t Tue Aug 17 06:08:09 2010 (r211410) @@ -6,14 +6,18 @@ desc="chown returns ELOOP if too many sy dir=`dirname $0` . ${dir}/../misc.sh -echo "1..6" +echo "1..10" n0=`namegen` n1=`namegen` expect 0 symlink ${n0} ${n1} expect 0 symlink ${n1} ${n0} +expect ELOOP chown ${n0} 65534 65534 +expect ELOOP chown ${n1} 65534 65534 expect ELOOP chown ${n0}/test 65534 65534 expect ELOOP chown ${n1}/test 65534 65534 +expect ELOOP lchown ${n0}/test 65534 65534 +expect ELOOP lchown ${n1}/test 65534 65534 expect 0 unlink ${n0} expect 0 unlink ${n1} Modified: head/tools/regression/pjdfstest/tests/chown/07.t ============================================================================== --- head/tools/regression/pjdfstest/tests/chown/07.t Tue Aug 17 02:50:12 2010 (r211409) +++ head/tools/regression/pjdfstest/tests/chown/07.t Tue Aug 17 06:08:09 2010 (r211410) @@ -6,23 +6,48 @@ desc="chown returns EPERM if the operati dir=`dirname $0` . ${dir}/../misc.sh -echo "1..11" +echo "1..132" n0=`namegen` n1=`namegen` n2=`namegen` +n3=`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 create ${n1}/${n2} 0644 -expect EPERM -u 65534 -g 65534 chown ${n1}/${n2} 65533 65533 -expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65534 65534 -expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65533 65533 -expect EPERM -u 65534 -g 65534 -- chown ${n1}/${n2} -1 65533 -expect 0 unlink ${n1}/${n2} +for type in regular dir fifo block char socket symlink; do + if [ "${type}" != "symlink" ]; then + create_file ${type} ${n1}/${n2} 65534 65534 + expect EPERM -u 65534 -g 65534 chown ${n1}/${n2} 65533 65533 + expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65534 65534 + expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65533 65533 + expect EPERM -u 65534 -g 65534 -- chown ${n1}/${n2} -1 65533 + expect 0 -u 65534 -g 65534 symlink ${n2} ${n1}/${n3} + expect EPERM -u 65534 -g 65534 chown ${n1}/${n3} 65533 65533 + expect EPERM -u 65533 -g 65533 chown ${n1}/${n3} 65534 65534 + expect EPERM -u 65533 -g 65533 chown ${n1}/${n3} 65533 65533 + expect EPERM -u 65534 -g 65534 -- chown ${n1}/${n3} -1 65533 + expect 0 unlink ${n1}/${n3} + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1}/${n2} + else + expect 0 unlink ${n1}/${n2} + fi + fi + create_file ${type} ${n1}/${n2} 65534 65534 + expect EPERM -u 65534 -g 65534 lchown ${n1}/${n2} 65533 65533 + expect EPERM -u 65533 -g 65533 lchown ${n1}/${n2} 65534 65534 + expect EPERM -u 65533 -g 65533 lchown ${n1}/${n2} 65533 65533 + expect EPERM -u 65534 -g 65534 -- lchown ${n1}/${n2} -1 65533 + if [ "${type}" = "dir" ]; then + expect 0 rmdir ${n1}/${n2} + else + expect 0 unlink ${n1}/${n2} + fi +done expect 0 rmdir ${n1} cd ${cdir} expect 0 rmdir ${n0} Modified: head/tools/regression/pjdfstest/tests/chown/10.t ============================================================================== --- head/tools/regression/pjdfstest/tests/chown/10.t Tue Aug 17 02:50:12 2010 (r211409) +++ head/tools/regression/pjdfstest/tests/chown/10.t Tue Aug 17 06:08:09 2010 (r211410) @@ -6,7 +6,9 @@ desc="chown returns EFAULT if the path a dir=`dirname $0` . ${dir}/../misc.sh -echo "1..2" +echo "1..4" expect EFAULT chown NULL 65534 65534 expect EFAULT chown DEADCODE 65534 65534 +expect EFAULT lchown NULL 65534 65534 +expect EFAULT lchown DEADCODE 65534 65534
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008170608.o7H68ArB020505>