xref: /freebsd/contrib/pjdfstest/tests/rename/20.t (revision 39ee7a7a6bdd1557b1c3532abf60d139798ac88b)
1#!/bin/sh
2# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/20.t 211352 2010-08-15 21:24:17Z pjd $
3
4desc="rename returns EEXIST or ENOTEMPTY if the 'to' argument is a directory and is not empty"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9echo "1..25"
10
11n0=`namegen`
12n1=`namegen`
13n2=`namegen`
14
15expect 0 mkdir ${n0} 0755
16expect 0 mkdir ${n1} 0755
17
18for type in regular dir fifo block char socket symlink; do
19	create_file ${type} ${n1}/${n2}
20	expect "EEXIST|ENOTEMPTY" rename ${n0} ${n1}
21	if [ "${type}" = "dir" ]; then
22		expect 0 rmdir ${n1}/${n2}
23	else
24		expect 0 unlink ${n1}/${n2}
25	fi
26done
27
28expect 0 rmdir ${n1}
29expect 0 rmdir ${n0}
30