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