xref: /freebsd/contrib/pjdfstest/tests/link/05.t (revision 193d9e768ba63fcfb187cfd17f461f7d41345048)
1#!/bin/sh
2# $FreeBSD: head/tools/regression/pjdfstest/tests/link/05.t 211352 2010-08-15 21:24:17Z pjd $
3
4desc="link returns EMLINK if the link count of the file named by name1 would exceed 32767"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
10
11echo "1..5"
12
13n0=`namegen`
14n1=`namegen`
15n2=`namegen`
16
17expect 0 mkdir ${n0} 0755
18n=`mdconfig -a -n -t malloc -s 1m` || exit
19newfs -i 1 /dev/md${n} >/dev/null || exit
20mount /dev/md${n} ${n0} || exit
21expect 0 create ${n0}/${n1} 0644
22i=1
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
30test_check $i -eq 32767
31
32expect EMLINK link ${n0}/${n1} ${n0}/${n2}
33
34umount /dev/md${n}
35mdconfig -d -u ${n} || exit
36expect 0 rmdir ${n0}
37