xref: /freebsd/contrib/pjdfstest/tests/rename/16.t (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1#!/bin/sh
2# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/16.t 211352 2010-08-15 21:24:17Z pjd $
3
4desc="rename returns EROFS if the requested link requires writing in a directory on a read-only file system"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9[ "${os}" = "FreeBSD" ] || quick_exit
10
11echo "1..8"
12
13n0=`namegen`
14n1=`namegen`
15n2=`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
22mount -ur /dev/md${n}
23
24expect EROFS rename ${n0}/${n1} ${n0}/${n2}
25expect EROFS rename ${n0}/${n1} ${n2}
26expect 0 create ${n2} 0644
27expect EROFS rename ${n2} ${n0}/${n2}
28expect 0 unlink ${n2}
29
30umount /dev/md${n}
31mdconfig -d -u ${n} || exit
32expect 0 rmdir ${n0}
33