]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/pjdfstest/tests/open/11.t
MFV r348576: 9963 Seperate tunable for disabling ZIL vdev flush
[FreeBSD/FreeBSD.git] / contrib / pjdfstest / tests / open / 11.t
1 #!/bin/sh
2 # vim: filetype=sh noexpandtab ts=8 sw=8
3 # $FreeBSD: head/tools/regression/pjdfstest/tests/open/11.t 211352 2010-08-15 21:24:17Z pjd $
4
5 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"
6
7 dir=`dirname $0`
8 . ${dir}/../misc.sh
9
10 require chflags
11
12 case "${os}:${fs}" in
13 FreeBSD:ZFS)
14         echo "1..12"
15         ;;
16 FreeBSD:UFS)
17         echo "1..24"
18         ;;
19 *)
20         quick_exit
21 esac
22
23 n0=`namegen`
24
25 expect 0 create ${n0} 0644
26 expect 0 chflags ${n0} SF_APPEND
27 expect 0 open ${n0} O_WRONLY,O_APPEND
28 expect 0 open ${n0} O_RDWR,O_APPEND
29 expect EPERM open ${n0} O_WRONLY
30 expect EPERM open ${n0} O_RDWR
31 todo FreeBSD:ZFS "When fle is protected by SF_APPEND, open(O_TRUNC) should return EPERM."
32 expect EPERM open ${n0} O_RDONLY,O_TRUNC
33 todo FreeBSD:ZFS "When fle is protected by SF_APPEND, open(O_TRUNC) should return EPERM."
34 expect EPERM open ${n0} O_RDONLY,O_APPEND,O_TRUNC
35 todo FreeBSD:ZFS "When fle is protected by SF_APPEND, open(O_TRUNC) should return EPERM."
36 expect EPERM open ${n0} O_WRONLY,O_APPEND,O_TRUNC
37 todo FreeBSD:ZFS "When fle is protected by SF_APPEND, open(O_TRUNC) should return EPERM."
38 expect EPERM open ${n0} O_RDWR,O_APPEND,O_TRUNC
39 expect 0 chflags ${n0} none
40 expect 0 unlink ${n0}
41
42 case "${os}:${fs}" in
43 FreeBSD:UFS)
44         expect 0 create ${n0} 0644
45         expect 0 chflags ${n0} UF_APPEND
46         expect 0 open ${n0} O_WRONLY,O_APPEND
47         expect 0 open ${n0} O_RDWR,O_APPEND
48         expect EPERM open ${n0} O_WRONLY
49         expect EPERM open ${n0} O_RDWR
50         expect EPERM open ${n0} O_RDONLY,O_TRUNC
51         expect EPERM open ${n0} O_RDONLY,O_APPEND,O_TRUNC
52         expect EPERM open ${n0} O_WRONLY,O_APPEND,O_TRUNC
53         expect EPERM open ${n0} O_RDWR,O_APPEND,O_TRUNC
54         expect 0 chflags ${n0} none
55         expect 0 unlink ${n0}
56         ;;
57 esac