]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - tools/regression/pjdfstest/tests/open/11.t
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / tools / regression / pjdfstest / tests / open / 11.t
1 #!/bin/sh
2 # $FreeBSD$
3
4 desc="open returns EPERM when the named file has its append-only flag set, the file is to be modified, and O_TRUNC is specified or O_APPEND is not specified"
5
6 dir=`dirname $0`
7 . ${dir}/../misc.sh
8
9 require chflags
10
11 case "${os}:${fs}" in
12 FreeBSD:ZFS)
13         echo "1..12"
14         ;;
15 FreeBSD:UFS)
16         echo "1..24"
17         ;;
18 *)
19         quick_exit
20 esac
21
22 n0=`namegen`
23
24 expect 0 create ${n0} 0644
25 expect 0 chflags ${n0} SF_APPEND
26 expect 0 open ${n0} O_WRONLY,O_APPEND
27 expect 0 open ${n0} O_RDWR,O_APPEND
28 expect EPERM open ${n0} O_WRONLY
29 expect EPERM open ${n0} O_RDWR
30 todo FreeBSD:ZFS "When fle is protected by SF_APPEND, open(O_TRUNC) should return EPERM."
31 expect EPERM open ${n0} O_RDONLY,O_TRUNC
32 todo FreeBSD:ZFS "When fle is protected by SF_APPEND, open(O_TRUNC) should return EPERM."
33 expect EPERM open ${n0} O_RDONLY,O_APPEND,O_TRUNC
34 todo FreeBSD:ZFS "When fle is protected by SF_APPEND, open(O_TRUNC) should return EPERM."
35 expect EPERM open ${n0} O_WRONLY,O_APPEND,O_TRUNC
36 todo FreeBSD:ZFS "When fle is protected by SF_APPEND, open(O_TRUNC) should return EPERM."
37 expect EPERM open ${n0} O_RDWR,O_APPEND,O_TRUNC
38 expect 0 chflags ${n0} none
39 expect 0 unlink ${n0}
40
41 case "${os}:${fs}" in
42 FreeBSD:UFS)
43         expect 0 create ${n0} 0644
44         expect 0 chflags ${n0} UF_APPEND
45         expect 0 open ${n0} O_WRONLY,O_APPEND
46         expect 0 open ${n0} O_RDWR,O_APPEND
47         expect EPERM open ${n0} O_WRONLY
48         expect EPERM open ${n0} O_RDWR
49         expect EPERM open ${n0} O_RDONLY,O_TRUNC
50         expect EPERM open ${n0} O_RDONLY,O_APPEND,O_TRUNC
51         expect EPERM open ${n0} O_WRONLY,O_APPEND,O_TRUNC
52         expect EPERM open ${n0} O_RDWR,O_APPEND,O_TRUNC
53         expect 0 chflags ${n0} none
54         expect 0 unlink ${n0}
55         ;;
56 esac