xref: /freebsd/contrib/pjdfstest/tests/symlink/10.t (revision 4ba73429a3a213248fbf8f0e124ca428e1d824ea)
1#!/bin/sh
2# $FreeBSD: head/tools/regression/pjdfstest/tests/symlink/10.t 211352 2010-08-15 21:24:17Z pjd $
3
4desc="symlink returns EROFS if the file name2 would reside on a read-only file system"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
10
11echo "1..7"
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
21
22expect 0 symlink test ${n0}/${n1}
23expect 0 unlink ${n0}/${n1}
24mount -ur /dev/md${n}
25expect EROFS symlink test ${n0}/${n1}
26mount -uw /dev/md${n}
27expect 0 symlink test ${n0}/${n1}
28expect 0 unlink ${n0}/${n1}
29
30umount /dev/md${n}
31mdconfig -d -u ${n} || exit
32expect 0 rmdir ${n0}
33