xref: /freebsd/contrib/pjdfstest/tests/link/15.t (revision 59e2ff550c448126b988150ce800cdf73bb5103e)
1#!/bin/sh
2# $FreeBSD: head/tools/regression/pjdfstest/tests/link/15.t 211352 2010-08-15 21:24:17Z pjd $
3
4desc="link returns ENOSPC if the directory in which the entry for the new link is being placed cannot be extended because there is no space left on the file system containing the directory"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
10
11echo "1..4"
12
13n0=`namegen`
14n1=`namegen`
15n2=`namegen`
16
17expect 0 mkdir ${n0} 0755
18n=`mdconfig -a -n -t malloc -s 512k` || exit
19newfs /dev/md${n} >/dev/null || exit
20mount /dev/md${n} ${n0} || exit
21expect 0 create ${n0}/${n1} 0644
22i=0
23while :; do
24	link ${n0}/${n1} ${n0}/${i} >/dev/null 2>&1
25	if [ $? -ne 0 ]; then
26		break
27	fi
28	i=`expr $i + 1`
29done
30expect ENOSPC link ${n0}/${n1} ${n0}/${n2}
31umount /dev/md${n}
32mdconfig -d -u ${n} || exit
33expect 0 rmdir ${n0}
34