xref: /freebsd/contrib/pjdfstest/tests/rename/15.t (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1#!/bin/sh
2# vim: filetype=sh noexpandtab ts=8 sw=8
3# $FreeBSD: head/tools/regression/pjdfstest/tests/rename/15.t 211352 2010-08-15 21:24:17Z pjd $
4
5desc="rename returns EXDEV if the link named by 'to' and the file named by 'from' are on different file systems"
6
7dir=`dirname $0`
8. ${dir}/../misc.sh
9
10[ "${os}" = "FreeBSD" ] || quick_exit
11
12echo "1..23"
13
14n0=`namegen`
15n1=`namegen`
16n2=`namegen`
17
18expect 0 mkdir ${n0} 0755
19n=`mdconfig -a -n -t malloc -s 1m` || exit
20newfs /dev/md${n} >/dev/null || exit
21mount /dev/md${n} ${n0} || exit
22
23for type in regular dir fifo block char socket symlink; do
24	create_file ${type} ${n0}/${n1}
25	expect EXDEV rename ${n0}/${n1} ${n2}
26	if [ "${type}" = "dir" ]; then
27		expect 0 rmdir ${n0}/${n1}
28	else
29		expect 0 unlink ${n0}/${n1}
30	fi
31done
32
33umount /dev/md${n}
34mdconfig -d -u ${n} || exit
35expect 0 rmdir ${n0}
36