xref: /freebsd/contrib/pjdfstest/tests/mkdir/08.t (revision 531c2d7af3cd2e64eec94aa1b19c4b2f16fce515)
140a8ac8fSEnji Cooper#!/bin/sh
2*3416500aSEnji Cooper# vim: filetype=sh noexpandtab ts=8 sw=8
340a8ac8fSEnji Cooper# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/08.t 211352 2010-08-15 21:24:17Z pjd $
440a8ac8fSEnji Cooper
540a8ac8fSEnji Cooperdesc="mkdir returns EPERM if the parent directory of the directory to be created has its immutable flag set"
640a8ac8fSEnji Cooper
740a8ac8fSEnji Cooperdir=`dirname $0`
840a8ac8fSEnji Cooper. ${dir}/../misc.sh
940a8ac8fSEnji Cooper
1040a8ac8fSEnji Cooperrequire chflags
1140a8ac8fSEnji Cooper
1240a8ac8fSEnji Coopercase "${os}:${fs}" in
1340a8ac8fSEnji CooperFreeBSD:ZFS)
1440a8ac8fSEnji Cooper	echo "1..17"
1540a8ac8fSEnji Cooper	;;
1640a8ac8fSEnji CooperFreeBSD:UFS)
1740a8ac8fSEnji Cooper	echo "1..30"
1840a8ac8fSEnji Cooper	;;
1940a8ac8fSEnji Cooper*)
2040a8ac8fSEnji Cooper	quick_exit
2140a8ac8fSEnji Cooperesac
2240a8ac8fSEnji Cooper
2340a8ac8fSEnji Coopern0=`namegen`
2440a8ac8fSEnji Coopern1=`namegen`
2540a8ac8fSEnji Cooper
2640a8ac8fSEnji Cooperexpect 0 mkdir ${n0} 0755
2740a8ac8fSEnji Cooper
2840a8ac8fSEnji Cooperexpect 0 mkdir ${n0}/${n1} 0755
2940a8ac8fSEnji Cooperexpect 0 rmdir ${n0}/${n1}
3040a8ac8fSEnji Cooper
3140a8ac8fSEnji Cooperexpect 0 chflags ${n0} SF_IMMUTABLE
3240a8ac8fSEnji Cooperexpect EPERM mkdir ${n0}/${n1} 0755
3340a8ac8fSEnji Cooperexpect 0 chflags ${n0} none
3440a8ac8fSEnji Cooperexpect 0 mkdir ${n0}/${n1} 0755
3540a8ac8fSEnji Cooperexpect 0 rmdir ${n0}/${n1}
3640a8ac8fSEnji Cooper
3740a8ac8fSEnji Cooperexpect 0 chflags ${n0} SF_NOUNLINK
3840a8ac8fSEnji Cooperexpect 0 mkdir ${n0}/${n1} 0755
3940a8ac8fSEnji Cooperexpect 0 rmdir ${n0}/${n1}
4040a8ac8fSEnji Cooperexpect 0 chflags ${n0} none
4140a8ac8fSEnji Cooper
4240a8ac8fSEnji Cooperexpect 0 chflags ${n0} SF_APPEND
4340a8ac8fSEnji Cooperexpect 0 mkdir ${n0}/${n1} 0755
4440a8ac8fSEnji Cooperexpect 0 chflags ${n0} none
4540a8ac8fSEnji Cooperexpect 0 rmdir ${n0}/${n1}
4640a8ac8fSEnji Cooper
4740a8ac8fSEnji Coopercase "${os}:${fs}" in
4840a8ac8fSEnji CooperFreeBSD:UFS)
4940a8ac8fSEnji Cooper	expect 0 chflags ${n0} UF_IMMUTABLE
5040a8ac8fSEnji Cooper	expect EPERM mkdir ${n0}/${n1} 0755
5140a8ac8fSEnji Cooper	expect 0 chflags ${n0} none
5240a8ac8fSEnji Cooper	expect 0 mkdir ${n0}/${n1} 0755
5340a8ac8fSEnji Cooper	expect 0 rmdir ${n0}/${n1}
5440a8ac8fSEnji Cooper
5540a8ac8fSEnji Cooper	expect 0 chflags ${n0} UF_NOUNLINK
5640a8ac8fSEnji Cooper	expect 0 mkdir ${n0}/${n1} 0755
5740a8ac8fSEnji Cooper	expect 0 rmdir ${n0}/${n1}
5840a8ac8fSEnji Cooper	expect 0 chflags ${n0} none
5940a8ac8fSEnji Cooper
6040a8ac8fSEnji Cooper	expect 0 chflags ${n0} UF_APPEND
6140a8ac8fSEnji Cooper	expect 0 mkdir ${n0}/${n1} 0755
6240a8ac8fSEnji Cooper	expect 0 chflags ${n0} none
6340a8ac8fSEnji Cooper	expect 0 rmdir ${n0}/${n1}
6440a8ac8fSEnji Cooper	;;
6540a8ac8fSEnji Cooperesac
6640a8ac8fSEnji Cooper
6740a8ac8fSEnji Cooperexpect 0 rmdir ${n0}
68