xref: /freebsd/contrib/pjdfstest/tests/open/19.t (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1#!/bin/sh
2# vim: filetype=sh noexpandtab ts=8 sw=8
3# $FreeBSD: head/tools/regression/pjdfstest/tests/open/19.t 211352 2010-08-15 21:24:17Z pjd $
4
5desc="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"
6
7dir=`dirname $0`
8. ${dir}/../misc.sh
9
10[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
11
12echo "1..3"
13
14n0=`namegen`
15n1=`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
21i=0
22while :; do
23	touch ${n0}/${i} >/dev/null 2>&1
24	if [ $? -ne 0 ]; then
25		break
26	fi
27	i=`expr $i + 1`
28done
29expect ENOSPC open ${n0}/${i} O_RDONLY,O_CREAT 0644
30umount /dev/md${n}
31mdconfig -d -u ${n} || exit
32expect 0 rmdir ${n0}
33