turns printfs back on
[freebsd-src/fkvm-freebsd.git] / tools / regression / fstest / tests / truncate / 10.t
blob2dc0b451f6945ad347154fdbd9e124544961dfd5
1 #!/bin/sh
2 # $FreeBSD$
4 desc="truncate returns EROFS if the named file resides on a read-only file system"
6 dir=`dirname $0`
7 . ${dir}/../misc.sh
9 case "${os}:${fs}" in
10 FreeBSD:UFS)
11 echo "1..10"
13 n0=`namegen`
14 n1=`namegen`
16 expect 0 mkdir ${n0} 0755
17 n=`mdconfig -a -n -t malloc -s 1m`
18 newfs /dev/md${n} >/dev/null
19 mount /dev/md${n} ${n0}
20 expect 0 create ${n0}/${n1} 0644
21 expect 0 truncate ${n0}/${n1} 123
22 expect 123 stat ${n0}/${n1} size
23 mount -ur /dev/md${n}
24 expect EROFS truncate ${n0}/${n1} 1234
25 expect 123 stat ${n0}/${n1} size
26 mount -uw /dev/md${n}
27 expect 0 truncate ${n0}/${n1} 1234
28 expect 1234 stat ${n0}/${n1} size
29 expect 0 unlink ${n0}/${n1}
30 umount /dev/md${n}
31 mdconfig -d -u ${n}
32 expect 0 rmdir ${n0}
35 quick_exit
37 esac