]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/pjdfstest/tests/mknod/09.t
MFV r331708:
[FreeBSD/FreeBSD.git] / contrib / pjdfstest / tests / mknod / 09.t
1 #!/bin/sh
2 # vim: filetype=sh noexpandtab ts=8 sw=8
3 # $FreeBSD: head/tools/regression/pjdfstest/tests/mknod/09.t 211352 2010-08-15 21:24:17Z pjd $
4
5 desc="mknod returns EPERM if the parent directory of the file to be created has its immutable flag set"
6
7 dir=`dirname $0`
8 . ${dir}/../misc.sh
9
10 require chflags
11
12 case "${os}:${fs}" in
13 FreeBSD:UFS)
14         echo "1..30"
15         ;;
16 *)
17         echo "1..17"
18         ;;
19 esac
20
21 n0=`namegen`
22 n1=`namegen`
23
24 expect 0 mkdir ${n0} 0755
25
26 expect 0 mknod ${n0}/${n1} f 0644 0 0
27 expect 0 unlink ${n0}/${n1}
28
29 expect 0 chflags ${n0} SF_IMMUTABLE
30 expect EPERM mknod ${n0}/${n1} f 0644 0 0
31 expect 0 chflags ${n0} none
32 expect 0 mknod ${n0}/${n1} f 0644 0 0
33 expect 0 unlink ${n0}/${n1}
34
35 expect 0 chflags ${n0} SF_APPEND
36 expect 0 mknod ${n0}/${n1} f 0644 0 0
37 expect 0 chflags ${n0} none
38 expect 0 unlink ${n0}/${n1}
39
40 expect 0 chflags ${n0} SF_NOUNLINK
41 expect 0 mknod ${n0}/${n1} f 0644 0 0
42 expect 0 unlink ${n0}/${n1}
43 expect 0 chflags ${n0} none
44
45 case "${os}:${fs}" in
46 FreeBSD:UFS)
47         expect 0 chflags ${n0} UF_IMMUTABLE
48         expect EPERM mknod ${n0}/${n1} f 0644 0 0
49         expect 0 chflags ${n0} none
50         expect 0 mknod ${n0}/${n1} f 0644 0 0
51         expect 0 unlink ${n0}/${n1}
52
53         expect 0 chflags ${n0} UF_APPEND
54         expect 0 mknod ${n0}/${n1} f 0644 0 0
55         expect 0 chflags ${n0} none
56         expect 0 unlink ${n0}/${n1}
57
58         expect 0 chflags ${n0} UF_NOUNLINK
59         expect 0 mknod ${n0}/${n1} f 0644 0 0
60         expect 0 unlink ${n0}/${n1}
61         expect 0 chflags ${n0} none
62         ;;
63 esac
64
65 expect 0 rmdir ${n0}