xref: /freebsd/contrib/pjdfstest/tests/open/19.t (revision 09a53ad8f1318c5daae6cfb19d97f4f6459f0013)
1#!/bin/sh
2# $FreeBSD: head/tools/regression/pjdfstest/tests/open/19.t 211352 2010-08-15 21:24:17Z pjd $
3
4desc="open returns ENOSPC when O_CREAT is specified, the file does not exist, and there are no free inodes on the file system on which the file is being created"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
10
11echo "1..3"
12
13n0=`namegen`
14n1=`namegen`
15
16expect 0 mkdir ${n0} 0755
17n=`mdconfig -a -n -t malloc -s 512k` || exit
18newfs /dev/md${n} >/dev/null || exit
19mount /dev/md${n} ${n0} || exit
20i=0
21while :; do
22	touch ${n0}/${i} >/dev/null 2>&1
23	if [ $? -ne 0 ]; then
24		break
25	fi
26	i=`expr $i + 1`
27done
28expect ENOSPC open ${n0}/${i} O_RDONLY,O_CREAT 0644
29umount /dev/md${n}
30mdconfig -d -u ${n} || exit
31expect 0 rmdir ${n0}
32