xref: /freebsd/contrib/pjdfstest/tests/link/05.t (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1#!/bin/sh
2# vim: filetype=sh noexpandtab ts=8 sw=8
3# $FreeBSD: head/tools/regression/pjdfstest/tests/link/05.t 211352 2010-08-15 21:24:17Z pjd $
4
5desc="link returns EMLINK if the link count of the file named by name1 would exceed 32767"
6
7dir=`dirname $0`
8. ${dir}/../misc.sh
9
10[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
11
12echo "1..5"
13
14n0=`namegen`
15n1=`namegen`
16n2=`namegen`
17
18expect 0 mkdir ${n0} 0755
19n=`mdconfig -a -n -t malloc -s 1m` || exit
20newfs -i 1 /dev/md${n} >/dev/null || exit
21mount /dev/md${n} ${n0} || exit
22expect 0 create ${n0}/${n1} 0644
23i=1
24while :; do
25	link ${n0}/${n1} ${n0}/${i} >/dev/null 2>&1
26	if [ $? -ne 0 ]; then
27		break
28	fi
29	i=`expr $i + 1`
30done
31test_check $i -eq 32767
32
33expect EMLINK link ${n0}/${n1} ${n0}/${n2}
34
35umount /dev/md${n}
36mdconfig -d -u ${n} || exit
37expect 0 rmdir ${n0}
38