xref: /freebsd/contrib/pjdfstest/tests/open/14.t (revision 40a8ac8f62b535d30349faf28cf47106b7041b83)
1#!/bin/sh
2# $FreeBSD: head/tools/regression/pjdfstest/tests/open/14.t 211352 2010-08-15 21:24:17Z pjd $
3
4desc="open returns EROFS if the named file resides on a read-only file system, and the file is to be modified"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
10
11echo "1..10"
12
13n0=`namegen`
14n1=`namegen`
15
16expect 0 mkdir ${n0} 0755
17n=`mdconfig -a -n -t malloc -s 1m`
18newfs /dev/md${n} >/dev/null
19mount /dev/md${n} ${n0}
20expect 0 create ${n0}/${n1} 0644
21expect 0 open ${n0}/${n1} O_WRONLY
22expect 0 open ${n0}/${n1} O_RDWR
23expect 0 open ${n0}/${n1} O_RDONLY,O_TRUNC
24mount -ur /dev/md${n}
25expect EROFS open ${n0}/${n1} O_WRONLY
26expect EROFS open ${n0}/${n1} O_RDWR
27expect EROFS open ${n0}/${n1} O_RDONLY,O_TRUNC
28mount -uw /dev/md${n}
29expect 0 unlink ${n0}/${n1}
30umount /dev/md${n}
31mdconfig -d -u ${n}
32expect 0 rmdir ${n0}
33