blob: 07698db78e23bb3d5ad250cb1938b8478925aaa4 [file] [log] [blame]
#!/bin/bash
#
# Copyright (c) International Business Machines Corp., 2005
# Author: Avantika Mathur (mathurav@us.ibm.com)
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
SETS_DEFAULTS="${TCID=test03} ${TST_COUNT=1} ${TST_TOTAL=1}"
declare -r TCID
declare -r TST_COUNT
declare -r TST_TOTAL
export TCID TST_COUNT TST_TOTAL
tst_resm TINFO "***************TEST03***************"
tst_resm TINFO "regression: move unshared directory to unshare mountpoint."
tst_resm TINFO "************************************"
. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of regression/test03 failed" && tst_exit)
export result=0
trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
while /bin/true ; do
# This loop is for error recovery purposes only
mkdir dir1
mkdir dir2
mount --bind "$disk1" dir1
mount --bind "$disk2" dir1/a
mount --move dir1 dir2
check dir2/a "$disk2"
break
done
trap 'ERR=$? ; tst_resm TWARN "regression/test03: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
if [ -n "${ERR_MSG}" ]; then
tst_resm TWARN "regression/test03: ${ERR_MSG}"
ERR_MSG=""
result=$ERR
fi
trap '' ERR
{
umount dir2/a
umount dir2
umount dir1
rm -rf dir*
cleanup
} >& /dev/null
if [ $result -ne 0 ]
then
tst_resm TFAIL "regression/test03: FAILED: regression: move unshared directory to unshare mountpoint."
exit 1
else
tst_resm TPASS "regression/test03: PASSED"
exit 0
fi
tst_exit