xref: /freebsd/contrib/pjdfstest/tests/mkdir/08.t (revision 40a8ac8f62b535d30349faf28cf47106b7041b83)
1*40a8ac8fSEnji Cooper#!/bin/sh
2*40a8ac8fSEnji Cooper# $FreeBSD: head/tools/regression/pjdfstest/tests/mkdir/08.t 211352 2010-08-15 21:24:17Z pjd $
3*40a8ac8fSEnji Cooper
4*40a8ac8fSEnji Cooperdesc="mkdir returns EPERM if the parent directory of the directory to be created has its immutable flag set"
5*40a8ac8fSEnji Cooper
6*40a8ac8fSEnji Cooperdir=`dirname $0`
7*40a8ac8fSEnji Cooper. ${dir}/../misc.sh
8*40a8ac8fSEnji Cooper
9*40a8ac8fSEnji Cooperrequire chflags
10*40a8ac8fSEnji Cooper
11*40a8ac8fSEnji Coopercase "${os}:${fs}" in
12*40a8ac8fSEnji CooperFreeBSD:ZFS)
13*40a8ac8fSEnji Cooper	echo "1..17"
14*40a8ac8fSEnji Cooper	;;
15*40a8ac8fSEnji CooperFreeBSD:UFS)
16*40a8ac8fSEnji Cooper	echo "1..30"
17*40a8ac8fSEnji Cooper	;;
18*40a8ac8fSEnji Cooper*)
19*40a8ac8fSEnji Cooper	quick_exit
20*40a8ac8fSEnji Cooperesac
21*40a8ac8fSEnji Cooper
22*40a8ac8fSEnji Coopern0=`namegen`
23*40a8ac8fSEnji Coopern1=`namegen`
24*40a8ac8fSEnji Cooper
25*40a8ac8fSEnji Cooperexpect 0 mkdir ${n0} 0755
26*40a8ac8fSEnji Cooper
27*40a8ac8fSEnji Cooperexpect 0 mkdir ${n0}/${n1} 0755
28*40a8ac8fSEnji Cooperexpect 0 rmdir ${n0}/${n1}
29*40a8ac8fSEnji Cooper
30*40a8ac8fSEnji Cooperexpect 0 chflags ${n0} SF_IMMUTABLE
31*40a8ac8fSEnji Cooperexpect EPERM mkdir ${n0}/${n1} 0755
32*40a8ac8fSEnji Cooperexpect 0 chflags ${n0} none
33*40a8ac8fSEnji Cooperexpect 0 mkdir ${n0}/${n1} 0755
34*40a8ac8fSEnji Cooperexpect 0 rmdir ${n0}/${n1}
35*40a8ac8fSEnji Cooper
36*40a8ac8fSEnji Cooperexpect 0 chflags ${n0} SF_NOUNLINK
37*40a8ac8fSEnji Cooperexpect 0 mkdir ${n0}/${n1} 0755
38*40a8ac8fSEnji Cooperexpect 0 rmdir ${n0}/${n1}
39*40a8ac8fSEnji Cooperexpect 0 chflags ${n0} none
40*40a8ac8fSEnji Cooper
41*40a8ac8fSEnji Cooperexpect 0 chflags ${n0} SF_APPEND
42*40a8ac8fSEnji Cooperexpect 0 mkdir ${n0}/${n1} 0755
43*40a8ac8fSEnji Cooperexpect 0 chflags ${n0} none
44*40a8ac8fSEnji Cooperexpect 0 rmdir ${n0}/${n1}
45*40a8ac8fSEnji Cooper
46*40a8ac8fSEnji Coopercase "${os}:${fs}" in
47*40a8ac8fSEnji CooperFreeBSD:UFS)
48*40a8ac8fSEnji Cooper	expect 0 chflags ${n0} UF_IMMUTABLE
49*40a8ac8fSEnji Cooper	expect EPERM mkdir ${n0}/${n1} 0755
50*40a8ac8fSEnji Cooper	expect 0 chflags ${n0} none
51*40a8ac8fSEnji Cooper	expect 0 mkdir ${n0}/${n1} 0755
52*40a8ac8fSEnji Cooper	expect 0 rmdir ${n0}/${n1}
53*40a8ac8fSEnji Cooper
54*40a8ac8fSEnji Cooper	expect 0 chflags ${n0} UF_NOUNLINK
55*40a8ac8fSEnji Cooper	expect 0 mkdir ${n0}/${n1} 0755
56*40a8ac8fSEnji Cooper	expect 0 rmdir ${n0}/${n1}
57*40a8ac8fSEnji Cooper	expect 0 chflags ${n0} none
58*40a8ac8fSEnji Cooper
59*40a8ac8fSEnji Cooper	expect 0 chflags ${n0} UF_APPEND
60*40a8ac8fSEnji Cooper	expect 0 mkdir ${n0}/${n1} 0755
61*40a8ac8fSEnji Cooper	expect 0 chflags ${n0} none
62*40a8ac8fSEnji Cooper	expect 0 rmdir ${n0}/${n1}
63*40a8ac8fSEnji Cooper	;;
64*40a8ac8fSEnji Cooperesac
65*40a8ac8fSEnji Cooper
66*40a8ac8fSEnji Cooperexpect 0 rmdir ${n0}
67