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