xref: /freebsd/contrib/pjdfstest/tests/rename/20.t (revision f4b37ed0f8b307b1f3f0f630ca725d68f1dff30d)
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