aboutsummaryrefslogtreecommitdiff
path: root/tools/regression/fstest/tests/open/14.t
blob: 9d6f788436e48dab38801f150d12ef69dcadba3f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh
# $FreeBSD: src/tools/regression/fstest/tests/open/14.t,v 1.1.10.1.6.1 2010/12/21 17:09:25 kensmith Exp $

desc="open returns EROFS if the named file resides on a read-only file system, and the file is to be modified"

dir=`dirname $0`
. ${dir}/../misc.sh

case "${os}:${fs}" in
FreeBSD:UFS)
	echo "1..10"

	n0=`namegen`
	n1=`namegen`

	expect 0 mkdir ${n0} 0755
	n=`mdconfig -a -n -t malloc -s 1m`
	newfs /dev/md${n} >/dev/null
	mount /dev/md${n} ${n0}
	expect 0 create ${n0}/${n1} 0644
	expect 0 open ${n0}/${n1} O_WRONLY
	expect 0 open ${n0}/${n1} O_RDWR
	expect 0 open ${n0}/${n1} O_RDONLY,O_TRUNC
	mount -ur /dev/md${n}
	expect EROFS open ${n0}/${n1} O_WRONLY
	expect EROFS open ${n0}/${n1} O_RDWR
	expect EROFS open ${n0}/${n1} O_RDONLY,O_TRUNC
	mount -uw /dev/md${n}
	expect 0 unlink ${n0}/${n1}
	umount /dev/md${n}
	mdconfig -d -u ${n}
	expect 0 rmdir ${n0}
	;;
*)
	quick_exit
	;;
esac