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