@@ -1,2 +1,96 @@
#DESCRIPTION:Bind mounts and shared subtrees
-BindMounts $LTPROOT/testscripts/test_fs_bind.sh
+
+fs_bind01_sh fs_bind01.sh
+fs_bind02_sh fs_bind02.sh
+fs_bind03_sh fs_bind03.sh
+fs_bind04_sh fs_bind04.sh
+fs_bind05_sh fs_bind05.sh
+fs_bind06_sh fs_bind06.sh
+fs_bind07_sh fs_bind07.sh
+fs_bind07-2_sh fs_bind07-2.sh
+fs_bind08_sh fs_bind08.sh
+fs_bind09_sh fs_bind09.sh
+fs_bind10_sh fs_bind10.sh
+fs_bind11_sh fs_bind11.sh
+fs_bind12_sh fs_bind12.sh
+fs_bind13_sh fs_bind13.sh
+fs_bind14_sh fs_bind14.sh
+fs_bind15_sh fs_bind15.sh
+fs_bind16_sh fs_bind16.sh
+fs_bind17_sh fs_bind17.sh
+fs_bind18_sh fs_bind18.sh
+fs_bind19_sh fs_bind19.sh
+fs_bind20_sh fs_bind20.sh
+fs_bind21_sh fs_bind21.sh
+fs_bind22_sh fs_bind22.sh
+fs_bind23_sh fs_bind23.sh
+fs_bind24_sh fs_bind24.sh
+
+
+fs_bind_move01_sh fs_bind_move01.sh
+fs_bind_move02_sh fs_bind_move02.sh
+fs_bind_move03_sh fs_bind_move03.sh
+fs_bind_move04_sh fs_bind_move04.sh
+fs_bind_move05_sh fs_bind_move05.sh
+fs_bind_move06_sh fs_bind_move06.sh
+fs_bind_move07_sh fs_bind_move07.sh
+fs_bind_move08_sh fs_bind_move08.sh
+fs_bind_move09_sh fs_bind_move09.sh
+fs_bind_move10_sh fs_bind_move10.sh
+fs_bind_move11_sh fs_bind_move11.sh
+fs_bind_move12_sh fs_bind_move12.sh
+fs_bind_move13_sh fs_bind_move13.sh
+fs_bind_move14_sh fs_bind_move14.sh
+fs_bind_move15_sh fs_bind_move15.sh
+fs_bind_move16_sh fs_bind_move16.sh
+fs_bind_move17_sh fs_bind_move17.sh
+fs_bind_move18_sh fs_bind_move18.sh
+fs_bind_move19_sh fs_bind_move19.sh
+fs_bind_move20_sh fs_bind_move20.sh
+fs_bind_move21_sh fs_bind_move21.sh
+fs_bind_move22_sh fs_bind_move22.sh
+
+
+fs_bind_rbind01_sh fs_bind_rbind01.sh
+fs_bind_rbind02_sh fs_bind_rbind02.sh
+fs_bind_rbind03_sh fs_bind_rbind03.sh
+fs_bind_rbind04_sh fs_bind_rbind04.sh
+fs_bind_rbind05_sh fs_bind_rbind05.sh
+fs_bind_rbind06_sh fs_bind_rbind06.sh
+fs_bind_rbind07-2_sh fs_bind_rbind07-2.sh
+fs_bind_rbind07_sh fs_bind_rbind07.sh
+fs_bind_rbind08_sh fs_bind_rbind08.sh
+fs_bind_rbind09_sh fs_bind_rbind09.sh
+fs_bind_rbind10_sh fs_bind_rbind10.sh
+fs_bind_rbind11_sh fs_bind_rbind11.sh
+fs_bind_rbind12_sh fs_bind_rbind12.sh
+fs_bind_rbind13_sh fs_bind_rbind13.sh
+fs_bind_rbind14_sh fs_bind_rbind14.sh
+fs_bind_rbind15_sh fs_bind_rbind15.sh
+fs_bind_rbind16_sh fs_bind_rbind16.sh
+fs_bind_rbind17_sh fs_bind_rbind17.sh
+fs_bind_rbind18_sh fs_bind_rbind18.sh
+fs_bind_rbind19_sh fs_bind_rbind19.sh
+fs_bind_rbind20_sh fs_bind_rbind20.sh
+fs_bind_rbind21_sh fs_bind_rbind21.sh
+fs_bind_rbind22_sh fs_bind_rbind22.sh
+fs_bind_rbind23_sh fs_bind_rbind23.sh
+fs_bind_rbind24_sh fs_bind_rbind24.sh
+fs_bind_rbind25_sh fs_bind_rbind25.sh
+fs_bind_rbind26_sh fs_bind_rbind26.sh
+fs_bind_rbind27_sh fs_bind_rbind27.sh
+fs_bind_rbind28_sh fs_bind_rbind28.sh
+fs_bind_rbind29_sh fs_bind_rbind29.sh
+fs_bind_rbind30_sh fs_bind_rbind30.sh
+fs_bind_rbind31_sh fs_bind_rbind31.sh
+fs_bind_rbind32_sh fs_bind_rbind32.sh
+fs_bind_rbind33_sh fs_bind_rbind33.sh
+fs_bind_rbind34_sh fs_bind_rbind34.sh
+fs_bind_rbind35_sh fs_bind_rbind35.sh
+fs_bind_rbind36_sh fs_bind_rbind36.sh
+fs_bind_rbind37_sh fs_bind_rbind37.sh
+fs_bind_rbind38_sh fs_bind_rbind38.sh
+fs_bind_rbind39_sh fs_bind_rbind39.sh
+
+
+fs_bind_regression_sh fs_bind_regression.sh
@@ -1,33 +1,11 @@
-#
-# kernel/fs/fs_bind testcases Makefile.
-#
-# Copyright (C) 2009, Cisco Systems Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009, Cisco Systems Inc.
# Ngie Cooper, July 2009
-#
top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/env_pre.mk
-INSTALL_DIR := $(prefix)/testcases/bin/fs_bind
-
-INSTALL_TARGETS := */*.sh */test*
-
-RECURSIVE_TARGETS := all install uninstall
+INSTALL_TARGETS := fs_bind_lib.sh fs_bind_regression.sh
include $(top_srcdir)/include/mk/generic_trunk_target.mk
deleted file mode 100644
@@ -1,176 +0,0 @@
-/******************************************************************************/
-/* */
-/* Copyright (c) International Business Machines Corp., 2008 */
-/* */
-/* This program is free software; you can redistribute it and/or modify */
-/* it under the terms of the GNU General Public License as published by */
-/* the Free Software Foundation; either version 2 of the License, or */
-/* (at your option) any later version. */
-/* */
-/* This program 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 General Public License for more details. */
-/* */
-/* You should have received a copy of the GNU General Public License */
-/* along with this program; if not, write to the Free Software */
-/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
-/* */
-/******************************************************************************/
-
-OO_DESCRIPTION.txt
-==================
-
-The contents of the bind directory:
-test01 - shared child to shared parent.
-test02 - shared child to private parent.
-test03 - shared child to slave parent.
-test04 - shared child to unclonable parent.
-test05 - private child to shared parent.
-test06 - private child to private parent.
-test07 - private child to slave parent.
-test07-2 - create slave then mount master - slave still propagates.
-test08 - private child to uncloneable parent.
-test09 - slave child to shared parent.
-test10 - slave child to private parent.
-test11 - slave child to slave parent.
-test12 - slave child to uncloneable parent.
-test13 - uncloneable child to shared parent.
-test14 - uncloneable child to private parent.
-test15 - uncloneable child to slave parent.
-test16 - uncloneable child to uncloneable parent.
-test17 - shared subtree with shared child to shared subtree.
-test18 - shared subtree with shared child to private subtree.
-test19 - shared subtree with shared child to slave subtree.
-test20 - shared subtree with shared child to uncloneable subtree.
-test21 - multi-level slave p-nodes.
-test22 - bind within same tree - root to child
-test23 - shared child to shared parent.
-test24 - shared child to shared parent.
-
-
-test07-2:
-=========
-create slave then mount master - slave still propagates.
-
-
-test01:
-=======
-shared child to shared parent.
-
-
-test02:
-=======
-shared child to private parent.
-
-
-test03:
-=======
-shared child to slave parent.
-
-
-test04:
-=======
-shared child to unclonable parent.
-
-
-test05:
-=======
-private child to shared parent.
-
-
-test06:
-=======
-private child to private parent.
-
-
-test07:
-=======
-private child to slave parent.
-
-
-test08:
-=======
-private child to uncloneable parent.
-
-
-test09:
-=======
-slave child to shared parent.
-
-
-test10:
-=======
-slave child to private parent.
-
-
-test11:
-=======
-slave child to slave parent.
-
-
-test12:
-=======
-slave child to uncloneable parent.
-
-
-test13:
-=======
-uncloneable child to shared parent.
-
-
-test14:
-=======
-uncloneable child to private parent.
-
-
-test15:
-=======
-uncloneable child to slave parent.
-
-
-test16:
-=======
-uncloneable child to uncloneable parent.
-
-
-test17:
-=======
-shared subtree with shared child to shared subtree.
-
-
-test18:
-=======
-shared subtree with shared child to private subtree.
-
-
-test19:
-=======
-shared subtree with shared child to slave subtree.
-
-
-test20:
-=======
-shared subtree with shared child to uncloneable subtree.
-
-
-test21:
-=======
-multi-level slave p-nodes.
-
-
-test22:
-=======
-bind within same tree - root to child
-
-
-test23:
-=======
-shared child to shared parent.
-
-
-test24:
-=======
-shared child to shared parent.
-
-
new file mode 100644
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009, Cisco Systems Inc.
+# Ngie Cooper, July 2009
+
+top_srcdir ?= ../../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+INSTALL_TARGETS := fs_bind*
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
@@ -1,99 +1,48 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test01} ${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 "***************TEST01***************"
-tst_resm TINFO "bind: shared child to shared parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test01 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
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "bind: shared child to shared parent"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share2
+ fs_bind_makedir rshared parent1/child1
- mount --bind "$disk1" parent1/child1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent1/child1
mkdir parent2/child2
- mount --bind parent2 share2
- mount --bind parent1/child1 parent2/child2
-
- check parent2 share2
- check parent1/child1 parent2/child2
+ EXPECT_PASS mount --bind parent2 share2
+ EXPECT_PASS mount --bind parent1/child1 parent2/child2
- mount --bind "$disk2" parent1/child1/a
+ fs_bind_check parent2 share2
+ fs_bind_check parent1/child1 parent2/child2
- check parent1/child1/a parent2/child2/a share2/child2/a
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent1/child1/a
+ fs_bind_check parent1/child1/a parent2/child2/a share2/child2/a
- mount --bind "$disk3" parent2/child2/b
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent2/child2/b
+ fs_bind_check parent1/child1/b parent2/child2/b share2/child2/b
+ fs_bind_check parent2 share2
- check parent1/child1/b parent2/child2/b share2/child2/b
- check parent2 share2
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test01: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test01: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent1/child1/b
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount share2
- umount share2
- umount parent2
- umount parent1
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent1/child1/b
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test01: FAILED: bind: shared child to shared parent."
- exit 1
-else
- tst_resm TPASS "bind/test01: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,102 +1,50 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test02} ${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 "***************TEST02***************"
-tst_resm TINFO "bind: shared child to private parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test02 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
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "bind: shared child to private parent"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared parent1/child1
- mount --bind "$disk1" parent1/child1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent1/child1
mkdir parent2/child2
- mount --bind parent1/child1 share1
- mount --bind parent1/child1 parent2/child2
-
- check parent1/child1 share1
- check parent1/child1 parent2/child2
+ EXPECT_PASS mount --bind parent1/child1 share1
+ EXPECT_PASS mount --bind parent1/child1 parent2/child2
- mount --bind "$disk2" parent1/child1/a
+ fs_bind_check parent1/child1 share1
+ fs_bind_check parent1/child1 parent2/child2
- check parent1/child1/a parent2/child2/a share1/a
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent1/child1/a
- mount --bind "$disk3" parent2/child2/b
-
- check parent1/child1/b parent2/child2/b share1/b
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test02: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test02: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent1/child1/b
- umount parent1/child1
- umount parent1/child1
- umount parent1/child1
- umount parent1/child1
- umount share1
- umount parent2/child2
- umount parent2
- umount parent1
+ fs_bind_check parent1/child1/a parent2/child2/a share1/a
- rm -rf parent* share*
- cleanup
-} >& /dev/null
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent2/child2/b
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test02: FAILED: bind: shared child to private parent."
- exit 1
-else
- tst_resm TPASS "bind/test02: PASSED"
- exit 0
-fi
+ fs_bind_check parent1/child1/b parent2/child2/b share1/b
+
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent1/child1/b
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
-tst_exit
+tst_run
@@ -1,118 +1,61 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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 "bind: shared child to slave parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/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
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "bind: shared child to slave parent"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
+ fs_bind_makedir rshared parent1/child1
mkdir parent2
- mount --bind parent1/child1 share1
- mount --bind "$disk1" parent1/child1
- mount --bind "$disk2" share2
- mount --bind share2 parent2
- "${FS_BIND_ROOT}/bin/makedir" slave parent2
-
- "${FS_BIND_ROOT}/bin/check_prop" share2 parent2
+ EXPECT_PASS mount --bind parent1/child1 share1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent1/child1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" share2
+ EXPECT_PASS mount --bind share2 parent2
+ EXPECT_PASS mount --make-rslave parent2
+ fs_bind_check share2 parent2
mkdir parent2/child2
- ls share2
-
- mount --bind parent1/child1 share1
- mount --bind parent1/child1 parent2/child2
- "${FS_BIND_ROOT}/bin/check_prop" parent1/child1 share1 parent2/child2
+ EXPECT_PASS mount --bind parent1/child1 share1
+ EXPECT_PASS mount --bind parent1/child1 parent2/child2
- mount --bind "$disk3" parent1/child1/a
+ fs_bind_check parent1/child1 share1 parent2/child2
- "${FS_BIND_ROOT}/bin/check_prop" parent1/child1/a parent2/child2/a share1/a
- "${FS_BIND_ROOT}/bin/check_prop" -n parent2/child2/a share2/child2/a
-
- mount --bind "$disk3" parent2/child2/b
-
- "${FS_BIND_ROOT}/bin/check_prop" -n parent2/child2/b share2/child2/b
- "${FS_BIND_ROOT}/bin/check_prop" parent1/child1/b parent2/child2/b share1/b
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test03: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test03: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent1/child1/b
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount parent1/child1
- umount parent1/child1
- umount parent1/child1
- umount share2
- umount share2
- umount share2
- umount parent1
- umount parent2
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent1/child1/a
- rm -rf parent* share*
- cleanup
-} >& /dev/null
+ fs_bind_check parent1/child1/a parent2/child2/a share1/a
+ fs_bind_check -n parent2/child2/a share2/child2/a
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test03: FAILED: bind: shared child to slave parent."
- exit 1
-else
- tst_resm TPASS "bind/test03: PASSED"
- exit 0
-fi
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent2/child2/b
+ fs_bind_check -n parent2/child2/b share2/child2/b
+ fs_bind_check parent1/child1/b parent2/child2/b share1/b
+
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent1/child1/b
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount parent2
+}
-tst_exit
+tst_run
@@ -1,104 +1,50 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test04} ${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 "***************TEST04***************"
-tst_resm TINFO "bind: shared child to unclonable parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test04 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
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "bind: shared child to unclonable parent"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" unclone parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir runbindable parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared parent1/child1
- mount --bind "$disk1" parent1/child1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent1/child1
mkdir parent2/child2
- mount --bind parent1/child1 share1
- mount --bind parent1/child1 parent2/child2
-
- check parent1/child1 share1 parent2/child2
-
- mount --bind "$disk2" parent1/child1/a
-
- check parent1/child1/a parent2/child2/a share1/a
+ EXPECT_PASS mount --bind parent1/child1 share1
+ EXPECT_PASS mount --bind parent1/child1 parent2/child2
+ fs_bind_check parent1/child1 share1 parent2/child2
- mount --bind "$disk3" parent2/child2/b
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent1/child1/a
+ fs_bind_check parent1/child1/a parent2/child2/a share1/a
- check parent1/child1/b parent2/child2/b share1/b
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent2/child2/b
+ fs_bind_check parent1/child1/b parent2/child2/b share1/b
- mount --bind "$disk4" share1/c
-
- check parent1/child1/c parent2/child2/c share1/c
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test04: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test04: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent1/child1/b
- umount parent1/child1/c
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount parent1/child1
- umount share1
- umount parent2
- umount parent1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK4" share1/c
+ fs_bind_check parent1/child1/c parent2/child2/c share1/c
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent1/child1/b
+ EXPECT_PASS umount parent1/child1/c
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test04: FAILED: bind: shared child to unclonable parent."
- exit 1
-else
- tst_resm TPASS "bind/test04: PASSED"
- exit 0
-fi
+}
-tst_exit
+tst_run
@@ -1,113 +1,58 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test05} ${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 "***************TEST05***************"
-tst_resm TINFO "bind: private child to shared parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test05 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "bind: private child to shared parent"
-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
-
-
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" priv parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
+ fs_bind_makedir private parent1/child1
- mount --bind parent1 share1
- mount --bind "$disk1" parent1/child1
- mount --bind parent2 share2
+ EXPECT_PASS mount --bind parent1 share1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent1/child1
+ EXPECT_PASS mount --bind parent2 share2
- check -n parent1/child1 share1/child1
+ fs_bind_check -n parent1/child1 share1/child1
mkdir parent2/child2
- mount --bind parent1/child1 parent2/child2
+ EXPECT_PASS mount --bind parent1/child1 parent2/child2
+ fs_bind_check parent1/child1 parent2/child2 share2/child2
- check parent1/child1 parent2/child2 share2/child2
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent1/child1/a
+ fs_bind_check -n parent1/child1/a parent2/child2/a
- mount --bind "$disk2" parent1/child1/a
-
- check -n parent1/child1/a parent2/child2/a
-
- mount --bind "$disk3" parent2/child2/b
-
- check -n parent1/child1/b parent2/child2/b
- check parent2/child2/b share2/child2/b
-
- mount --bind "$disk4" share2/child2/c
-
- check -n parent1/child1/b parent2/child2/b
- check parent2/child2/c share2/child2/c
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test05: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test05: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent2/child2/b
- umount share2/child2/c
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount share1
- umount share1
- umount share2
- umount share2
- umount parent2
- umount parent1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent2/child2/b
+ fs_bind_check -n parent1/child1/b parent2/child2/b
+ fs_bind_check parent2/child2/b share2/child2/b
+ EXPECT_PASS mount --bind "$FS_BIND_DISK4" share2/child2/c
+ fs_bind_check -n parent1/child1/b parent2/child2/b
+ fs_bind_check parent2/child2/c share2/child2/c
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test05: FAILED: bind: private child to shared parent."
- exit 1
-else
- tst_resm TPASS "bind/test05: PASSED"
- exit 0
-fi
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child2/b
+ EXPECT_PASS umount share2/child2/c
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
-tst_exit
+tst_run
@@ -1,102 +1,47 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test06} ${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 "***************TEST06***************"
-tst_resm TINFO "bind: private child to private parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test06 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
-
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" priv parent1/child1
+test()
+{
+ tst_res TINFO "bind: private child to private parent"
- mount --bind parent1 share1
- mount --bind "$disk1" parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir private parent1/child1
- check -n parent1/child1 share1/child1
+ EXPECT_PASS mount --bind parent1 share1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent1/child1
+ fs_bind_check -n parent1/child1 share1/child1
mkdir parent2/child2
- mount --bind parent1/child1 parent2/child2
-
- check parent1/child1 parent2/child2
-
- mount --bind "$disk2" parent1/child1/a
-
- check -n parent1/child1/a parent2/child2/a
-
- mount --bind "$disk3" parent2/child2/b
-
- check -n parent1/child1/b parent2/child2/b
- check -n parent1/child1 share1/child1
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test06: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test06: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent2/child2/b
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount share1
- umount share1
- umount parent2
- umount parent1
+ EXPECT_PASS mount --bind parent1/child1 parent2/child2
+ fs_bind_check parent1/child1 parent2/child2
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent1/child1/a
+ fs_bind_check -n parent1/child1/a parent2/child2/a
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test06: FAILED: bind: private child to private parent."
- exit 1
-else
- tst_resm TPASS "bind/test06: PASSED"
- exit 0
-fi
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent2/child2/b
+ fs_bind_check -n parent1/child1/b parent2/child2/b
+ fs_bind_check -n parent1/child1 share1/child1
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child2/b
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
-tst_exit
+tst_run
@@ -1,69 +1,34 @@
-#!/bin/bash
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
+# Author: Avantika Mathur (mathurav@us.ibm.com)
-SETS_DEFAULTS="${TCID=test07-2} ${TST_COUNT=1} ${TST_TOTAL=1}"
-declare -r TCID
-declare -r TST_COUNT
-declare -r TST_TOTAL
-export TCID TST_COUNT TST_TOTAL
+FS_BIND_TESTFUNC=test
-tst_resm TINFO "***************TEST07-2***************"
-tst_resm TINFO "bind: create slave then mount master - slave still propagates."
-tst_resm TINFO "************************************"
+. fs_bind_lib.sh
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test07-2 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
-
-
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share2
-
- mount --bind share2 parent2
- "${FS_BIND_ROOT}/bin/makedir" slave parent2
- mount --bind "$disk1" share2
-
- check parent2 share2
-
- mount --bind "$disk2" parent2/a
-
- check -n parent2/a share2/a
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test07-2: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test07-2: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
+test()
{
- umount parent2/a
- umount parent2
- umount parent2
- umount parent2
+ tst_res TINFO "bind: create slave then mount master - slave still propagates"
- umount share2
- umount share2
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share2
+ EXPECT_PASS mount --bind share2 parent2
+ EXPECT_PASS mount --make-slave parent2
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" share2
+ fs_bind_check parent2 share2
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test07-2: FAILED: bind: create slave then mount master - slave still propagates."
- exit 1
-else
- tst_resm TPASS "bind/test07-2: PASSED"
- exit 0
-fi
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent2/a
+ fs_bind_check -n parent2/a share2/a
+ EXPECT_PASS umount parent2/a
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+}
-tst_exit
+tst_run
@@ -1,113 +1,57 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test07} ${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 "***************TEST07***************"
-tst_resm TINFO "bind: private child to slave parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test07 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
-
-
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" priv parent1/child1
-
- mount --bind parent1 share1
- mount --bind "$disk1" parent1/child1
- check -n parent1/child1 share1/child1
+FS_BIND_TESTFUNC=test
- mount --bind "$disk2" share2
- mount --bind share2 parent2
- "${FS_BIND_ROOT}/bin/makedir" slave parent2
- #mount --bind "$disk2" share2
+. fs_bind_lib.sh
- mkdir parent2/child2
- check parent2 share2
-
- mount --bind parent1/child1 parent2/child2
-
- check parent1/child1 parent2/child2
- check -n parent2/child2 share2/child2
-
- mount --bind "$disk2" parent1/child1/a
-
- check -n parent1/child1/a parent2/child2/a
-
- mount --bind "$disk3" parent2/child2/b
-
- check -n parent1/child1/b parent2/child2/b
- check -n parent1/child1 share1/child1
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test07: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test07: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
+test()
{
- umount parent1/child1/a
- umount parent2/child2/b
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount share1
- umount share1
- umount share2
- umount share2
- umount share2
- umount parent2
- umount parent1
+ tst_res TINFO "bind: private child to slave parent"
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
+ fs_bind_makedir private parent1/child1
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test07: FAILED: bind: private child to slave parent."
- exit 1
-else
- tst_resm TPASS "bind/test07: PASSED"
- exit 0
-fi
+ EXPECT_PASS mount --bind parent1 share1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent1/child1
+ fs_bind_check -n parent1/child1 share1/child1
-
-tst_exit
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" share2
+ EXPECT_PASS mount --bind share2 parent2
+ EXPECT_PASS mount --make-rslave parent2
+ mkdir parent2/child2
+ fs_bind_check parent2 share2
+
+ EXPECT_PASS mount --bind parent1/child1 parent2/child2
+ fs_bind_check parent1/child1 parent2/child2
+ fs_bind_check -n parent2/child2 share2/child2
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent1/child1/a
+
+ fs_bind_check -n parent1/child1/a parent2/child2/a
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent2/child2/b
+
+ fs_bind_check -n parent1/child1/b parent2/child2/b
+ fs_bind_check -n parent1/child1 share1/child1
+
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child2/b
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
+
+tst_run
@@ -1,102 +1,48 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test08} ${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 "***************TEST08***************"
-tst_resm TINFO "bind: private child to uncloneable parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test08 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "bind: private child to uncloneable parent"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" unclone parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" priv parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir runbindable parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir private parent1/child1
- mount --bind parent1 share1
- mount --bind "$disk1" parent1/child1
+ EXPECT_PASS mount --bind parent1 share1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent1/child1
- check -n parent1/child1 share1/child1
+ fs_bind_check -n parent1/child1 share1/child1
mkdir parent2/child2
- mount --bind parent1/child1 parent2/child2
-
- check parent1/child1 parent2/child2
-
- mount --bind "$disk2" parent1/child1/a
-
- check -n parent1/child1/a parent2/child2/a
-
- mount --bind "$disk3" parent2/child2/b
-
- check -n parent1/child1/b parent2/child2/b
- check -n parent1/child1 share1/child1
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test08: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test08: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent2/child2/b
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount share1
- umount share1
- umount parent2
- umount parent1
+ EXPECT_PASS mount --bind parent1/child1 parent2/child2
+ fs_bind_check parent1/child1 parent2/child2
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent1/child1/a
+ fs_bind_check -n parent1/child1/a parent2/child2/a
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test08: FAILED: bind: private child to uncloneable parent."
- exit 1
-else
- tst_resm TPASS "bind/test08: PASSED"
- exit 0
-fi
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent2/child2/b
+ fs_bind_check -n parent1/child1/b parent2/child2/b
+ fs_bind_check -n parent1/child1 share1/child1
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child2/b
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
-tst_exit
+tst_run
@@ -1,113 +1,57 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test09} ${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 "***************TEST09***************"
-tst_resm TINFO "bind: slave child to shared parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test09 failed" && tst_exit)
-export result=0
-
-
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+FS_BIND_TESTFUNC=test
-while /bin/true ; do
- # This loop is for error recovery purposes only
+. fs_bind_lib.sh
-
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
-
- mount --bind parent2 share2
- mount --bind share1 parent1/child1
- mount --bind "$disk1" share1
- "${FS_BIND_ROOT}/bin/makedir" slave parent1/child1
-
- check parent1/child1 share1
-
- mkdir parent2/child2
-
- mount --bind parent1/child1 parent2/child2
-
- check parent1/child1 parent2/child2
-
- mount --bind "$disk2" parent1/child1/a
-
- check -n parent1/child1/a parent2/child2/a
- check -n parent1/child1/a share1/a
-
- mount --bind "$disk3" parent2/child2/b
-
- check -n parent1/child1/b parent2/child2/b
- check parent2/child2 share2/child2
-
- mount --bind "$disk4" share1/c
- check share1/c parent1/child1/c
- check parent1/child1/c parent2/child2/c
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test09: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test09: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
+test()
{
- umount parent1/child1/a
- umount parent2/child2/b
- umount share1/c
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount parent1/child1
- umount share1
- umount share2
- umount share2
- umount parent2
- umount parent1
+ tst_res TINFO "bind: slave child to shared parent"
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
+ fs_bind_makedir rshared parent1/child1
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test09: FAILED: bind: slave child to shared parent."
- exit 1
-else
- tst_resm TPASS "bind/test09: PASSED"
- exit 0
-fi
+ EXPECT_PASS mount --bind parent2 share2
+ EXPECT_PASS mount --bind share1 parent1/child1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" share1
+ EXPECT_PASS mount --make-rslave parent1/child1
+ fs_bind_check parent1/child1 share1
-
-tst_exit
+ mkdir parent2/child2
+ EXPECT_PASS mount --bind parent1/child1 parent2/child2
+ fs_bind_check parent1/child1 parent2/child2
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent1/child1/a
+ fs_bind_check -n parent1/child1/a parent2/child2/a
+ fs_bind_check -n parent1/child1/a share1/a
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent2/child2/b
+ fs_bind_check -n parent1/child1/b parent2/child2/b
+ fs_bind_check parent2/child2 share2/child2
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK4" share1/c
+ fs_bind_check share1/c parent1/child1/c
+ fs_bind_check parent1/child1/c parent2/child2/c
+
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child2/b
+ EXPECT_PASS umount share1/c
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
+
+tst_run
@@ -1,108 +1,52 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test10} ${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 "***************TEST10***************"
-tst_resm TINFO "bind: slave child to private parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test10 failed" && tst_exit)
-export result=0
-
-
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+FS_BIND_TESTFUNC=test
-while /bin/true ; do
- # This loop is for error recovery purposes only
+. fs_bind_lib.sh
-
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
-
- mount --bind share1 parent1/child1
- mount --bind "$disk1" share1
- "${FS_BIND_ROOT}/bin/makedir" slave parent1/child1
-
- check parent1/child1 share1
-
- mkdir parent2/child2
-
- mount --bind parent1/child1 parent2/child2
-
- check parent1/child1 parent2/child2
-
- mount --bind "$disk2" parent1/child1/a
-
- check -n parent1/child1/a parent2/child2/a
- check -n parent1/child1/a share1/a
-
- mount --bind "$disk3" parent2/child2/b
-
- check -n parent1/child1/b parent2/child2/b
-
- mount --bind "$disk4" share1/c
- check share1/c parent1/child1/c
- check parent1/child1/c parent2/child2/c
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test10: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test10: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
+test()
{
- umount parent1/child1/a
- umount parent2/child2/b
- umount share1/c
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount parent1/child1
- umount share1
- umount parent2
- umount parent1
+ tst_res TINFO "bind: slave child to private parent"
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared parent1/child1
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test10: FAILED: bind: slave child to private parent."
- exit 1
-else
- tst_resm TPASS "bind/test10: PASSED"
- exit 0
-fi
+ EXPECT_PASS mount --bind share1 parent1/child1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" share1
+ EXPECT_PASS mount --make-rslave parent1/child1
+ fs_bind_check parent1/child1 share1
-
-tst_exit
+ mkdir parent2/child2
+ EXPECT_PASS mount --bind parent1/child1 parent2/child2
+ fs_bind_check parent1/child1 parent2/child2
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent1/child1/a
+ fs_bind_check -n parent1/child1/a parent2/child2/a
+ fs_bind_check -n parent1/child1/a share1/a
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent2/child2/b
+ fs_bind_check -n parent1/child1/b parent2/child2/b
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK4" share1/c
+ fs_bind_check share1/c parent1/child1/c
+ fs_bind_check parent1/child1/c parent2/child2/c
+
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child2/b
+ EXPECT_PASS umount share1/c
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
+
+tst_run
@@ -1,116 +1,63 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test11} ${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 "***************TEST11***************"
-tst_resm TINFO "bind: slave child to slave parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test11 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
-
-
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
- mount --bind parent2 share2
- mount --bind share1 parent1/child1
- mount --bind "$disk1" share1
- mount --bind "$disk2" share2
- "${FS_BIND_ROOT}/bin/makedir" slave parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" slave parent2
+FS_BIND_TESTFUNC=test
- mkdir parent2/child2
-
- check parent1/child1 share1
- check parent2 share2
-
- mount --bind parent1/child1 parent2/child2
-
- check parent1/child1 parent2/child2
-
- mount --bind "$disk3" parent1/child1/a
+. fs_bind_lib.sh
- check -n parent1/child1/a parent2/child2/a
- check -n parent1/child1/a share1/a
-
- mount --bind "$disk4" parent2/child2/b
-
- check -n parent1/child1/b parent2/child2/b
- check -n parent2/child2 share2/child2
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test11: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test11: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
+test()
{
- umount parent2/child2/b
-
- mount --bind "$disk4" share1/c
- check share1/c parent1/child1/c
- check parent1/child1/c parent2/child2/c
+ tst_res TINFO "bind: slave child to slave parent"
- umount parent1/child1/a
- umount share1/c
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount parent1/child1
- umount share1
- umount parent2
- umount parent2
- umount parent2
- umount parent2
- umount parent1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
+ fs_bind_makedir rshared parent1/child1
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test11: FAILED: bind: slave child to slave parent."
- exit 1
-else
- tst_resm TPASS "bind/test11: PASSED"
- exit 0
-fi
+ EXPECT_PASS mount --bind parent2 share2
+ EXPECT_PASS mount --bind share1 parent1/child1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" share1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" share2
+ EXPECT_PASS mount --make-rslave parent1/child1
+ EXPECT_PASS mount --make-rslave parent2
-
-tst_exit
+ mkdir parent2/child2
+ fs_bind_check parent1/child1 share1
+ fs_bind_check parent2 share2
+
+ EXPECT_PASS mount --bind parent1/child1 parent2/child2
+ fs_bind_check parent1/child1 parent2/child2
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent1/child1/a
+ fs_bind_check -n parent1/child1/a parent2/child2/a
+ fs_bind_check -n parent1/child1/a share1/a
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK4" parent2/child2/b
+ fs_bind_check -n parent1/child1/b parent2/child2/b
+ fs_bind_check -n parent2/child2 share2/child2
+
+ EXPECT_PASS umount parent2/child2/b
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK4" share1/c
+ fs_bind_check share1/c parent1/child1/c
+ fs_bind_check parent1/child1/c parent2/child2/c
+
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount share1/c
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
+
+tst_run
@@ -1,108 +1,52 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test12} ${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 "***************TEST12***************"
-tst_resm TINFO "bind: slave child to uncloneable parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test12 failed" && tst_exit)
-export result=0
-
-
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+FS_BIND_TESTFUNC=test
-while /bin/true ; do
- # This loop is for error recovery purposes only
+. fs_bind_lib.sh
-
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" unclone parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
-
- mount --bind share1 parent1/child1
- mount --bind "$disk1" share1
- "${FS_BIND_ROOT}/bin/makedir" slave parent1/child1
-
- check parent1/child1 share1
-
- mkdir parent2/child2
-
- mount --bind parent1/child1 parent2/child2
-
- check parent1/child1 parent2/child2
-
- mount --bind "$disk2" parent1/child1/a
-
- check -n parent1/child1/a parent2/child2/a
- check -n parent1/child1/a share1/a
-
- mount --bind "$disk3" parent2/child2/b
-
- check -n parent1/child1/b parent2/child2/b
-
- mount --bind "$disk4" share1/c
- check share1/c parent1/child1/c
- check parent1/child1/c parent2/child2/c
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test12: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test12: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
+test()
{
- umount parent1/child1/a
- umount parent2/child2/b
- umount share1/c
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount parent1/child1
- umount parent2
- umount share1
- umount parent1
+ tst_res TINFO "bind: slave child to uncloneable parent"
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir runbindable parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared parent1/child1
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test12: FAILED: bind: slave child to uncloneable parent."
- exit 1
-else
- tst_resm TPASS "bind/test12: PASSED"
- exit 0
-fi
+ EXPECT_PASS mount --bind share1 parent1/child1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" share1
+ EXPECT_PASS mount --make-rslave parent1/child1
+ fs_bind_check parent1/child1 share1
-
-tst_exit
+ mkdir parent2/child2
+ EXPECT_PASS mount --bind parent1/child1 parent2/child2
+ fs_bind_check parent1/child1 parent2/child2
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent1/child1/a
+ fs_bind_check -n parent1/child1/a parent2/child2/a
+ fs_bind_check -n parent1/child1/a share1/a
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent2/child2/b
+ fs_bind_check -n parent1/child1/b parent2/child2/b
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK4" share1/c
+ fs_bind_check share1/c parent1/child1/c
+ fs_bind_check parent1/child1/c parent2/child2/c
+
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child2/b
+ EXPECT_PASS umount share1/c
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent1
+}
+
+tst_run
@@ -1,90 +1,38 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test13} ${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 "***************TEST13***************"
-tst_resm TINFO "bind: uncloneable child to shared parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test13 failed" && tst_exit)
-export result=0
-
-
-
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+FS_BIND_TESTFUNC=test
-while /bin/true ; do
- # This loop is for error recovery purposes only
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "bind: uncloneable child to shared parent"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" unclone parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
+ fs_bind_makedir runbindable parent1/child1
- mount --bind parent1 share1
- mount --bind parent2 share2
+ EXPECT_PASS mount --bind parent1 share1
+ EXPECT_PASS mount --bind parent2 share2
mkdir parent1/child1/x
- mount --bind "$disk1" parent1/child1/x
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent1/child1/x
mkdir parent2/child2
- mount --bind parent1/child1 parent2/child2 2> /dev/null || result=$? # mount should fail
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test13: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test13: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/x
- umount parent1/child1
- umount share1
- umount share1
- umount share2
- umount share2
- umount parent2
- umount parent1
-
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -eq 0 ]
-then
- tst_resm TFAIL "bind/test13: FAILED: bind: uncloneable child to shared parent."
- exit 1
-else
- tst_resm TPASS "bind/test13: PASSED"
- exit 0
-fi
-
-
-tst_exit
+ EXPECT_FAIL mount --bind parent1/child1 parent2/child2
+
+ EXPECT_PASS umount parent1/child1/x
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
+
+tst_run
@@ -1,86 +1,34 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test14} ${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 "***************TEST14***************"
-tst_resm TINFO "bind: uncloneable child to private parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test14 failed" && tst_exit)
-export result=0
-
-
+FS_BIND_TESTFUNC=test
-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
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "bind: uncloneable child to private parent"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" unclone parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir runbindable parent1/child1
mkdir parent1/child1/x
- mount --bind parent1 share1
- mount --bind "$disk1" parent1/child1/x
+ EXPECT_PASS mount --bind parent1 share1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent1/child1/x
mkdir parent2/child2
- mount --bind parent1/child1 parent2/child2 2> /dev/null || result=$? # mount should fail
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test14: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test14: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/x
- umount parent1/child1
- umount share1
- umount share1
- umount parent2
- umount parent1
-
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -eq 0 ]
-then
- tst_resm TFAIL "bind/test14: FAILED: bind: uncloneable child to private parent."
- exit 1
-else
- tst_resm TPASS "bind/test14: PASSED"
- exit 0
-fi
+ EXPECT_FAIL mount --bind parent1/child1 parent2/child2
+ EXPECT_PASS umount parent1/child1/x
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
-tst_exit
+tst_run
@@ -1,96 +1,43 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test15} ${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 "***************TEST15***************"
-tst_resm TINFO "bind: uncloneable child to slave parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test15 failed" && tst_exit)
-export result=0
-
-
-
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+FS_BIND_TESTFUNC=test
-while /bin/true ; do
- # This loop is for error recovery purposes only
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "bind: uncloneable child to slave parent"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" unclone parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
+ fs_bind_makedir runbindable parent1/child1
mkdir parent1/child1/x
- mount --bind parent1 share1
- mount --bind "$disk1" parent1/child1/x
- mount --bind "$disk2" share2
- mount --bind share2 parent2
- "${FS_BIND_ROOT}/bin/makedir" slave parent2
+ EXPECT_PASS mount --bind parent1 share1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent1/child1/x
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" share2
+ EXPECT_PASS mount --bind --make-rslave share2 parent2
- check parent2 share2
+ fs_bind_check parent2 share2
mkdir parent2/child2
- mount --bind parent1/child1 parent2/child2 2> /dev/null || result=$? # mount should fail
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test15: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test15: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/x
- umount parent1/child1
- umount share1
- umount share1
- umount share2
- umount share2
- umount parent2
- umount parent2
- umount parent1
-
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -eq 0 ]
-then
- tst_resm TFAIL "bind/test15: FAILED: bind: uncloneable child to slave parent."
- exit 1
-else
- tst_resm TPASS "bind/test15: PASSED"
- exit 0
-fi
-
-
-tst_exit
+ EXPECT_FAIL mount --bind parent1/child1 parent2/child2
+
+ EXPECT_PASS umount parent1/child1/x
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
+
+tst_run
@@ -1,87 +1,35 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test16} ${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 "***************TEST16***************"
-tst_resm TINFO "bind: uncloneable child to uncloneable parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test16 failed" && tst_exit)
-export result=0
-
-
+FS_BIND_TESTFUNC=test
-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
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "bind: uncloneable child to uncloneable parent"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" unclone parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" unclone parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir runbindable parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir runbindable parent1/child1
mkdir parent1/child1/x
- mount --bind parent1 share1
- mount --bind "$disk1" parent1/child1/x
+ EXPECT_PASS mount --bind parent1 share1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent1/child1/x
mkdir parent2/child2
- mount --bind parent1/child1 parent2/child2 2> /dev/null || result=$? # mount should fail
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test16: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test16: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/x
- umount parent1/child1
- umount share1
- umount share1
- umount parent2
- umount parent1
-
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -eq 0 ]
-then
- tst_resm TFAIL "bind/test16: FAILED: bind: uncloneable child to uncloneable parent."
- exit 1
-else
- tst_resm TPASS "bind/test16: PASSED"
- exit 0
-fi
+ EXPECT_FAIL mount --bind parent1/child1 parent2/child2
+ EXPECT_PASS umount parent1/child1/x
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
-tst_exit
+tst_run
@@ -1,100 +1,48 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test17} ${TST_COUNT=1} ${TST_TOTAL=1}"
-declare -r TCID
-declare -r TST_COUNT
-declare -r TST_TOTAL
-export TCID TST_COUNT TST_TOTAL
-
-result=0
-
-tst_resm TINFO "***************TEST17***************"
-tst_resm TINFO "bind: shared subtree with shared child to shared subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test17 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
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
-
- mount --bind "$disk1" share1
- mount --bind share1 parent1
-
- mount --bind parent1 parent2
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
-
- check parent1 share1 parent2
- mount --bind "$disk2" parent1/child1
- check parent1/child1 parent2/child1
- check parent1/child1 share1/child1
- mount --bind "$disk3" parent2/a
-
- check parent1/a parent2/a share1/a
-
- mount --bind "$disk4" share1/b
-
- check parent1/b parent2/b share1/b
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test17: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test17: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
+test()
{
- umount share1/b
- umount parent2/a
- umount parent1/child1
- umount parent1/child1
- umount parent2
- umount parent1
- umount share1
- umount parent2
- umount parent1
- umount share1
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test17: FAILED: bind: shared subtree with shared child to shared subtree."
- exit 1
-else
- tst_resm TPASS "bind/test17: PASSED"
- exit 0
-fi
-tst_exit
+ tst_res TINFO "bind: shared subtree with shared child to shared subtree"
+
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" share1
+ EXPECT_PASS mount --bind share1 parent1
+
+ EXPECT_PASS mount --bind parent1 parent2
+ fs_bind_makedir rshared parent1/child1
+ fs_bind_check parent1 share1 parent2
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent1/child1
+ fs_bind_check parent1/child1 parent2/child1
+ fs_bind_check parent1/child1 share1/child1
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent2/a
+ fs_bind_check parent1/a parent2/a share1/a
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK4" share1/b
+ fs_bind_check parent1/b parent2/b share1/b
+
+ EXPECT_PASS umount share1/b
+ EXPECT_PASS umount parent2/a
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+}
+
+tst_run
@@ -1,98 +1,48 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test18} ${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 "***************TEST18***************"
-tst_resm TINFO "bind: shared subtree with shared child to private subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test18 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
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
-
- mount --bind "$disk1" share1
- mount --bind share1 parent1
-
- mount --bind parent1 parent2
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
-
- check parent1 share1 parent2
- mount --bind "$disk2" parent1/child1
- check parent1/child1 parent2/child1
- check parent1/child1 share1/child1
- mount --bind "$disk3" parent2/a
-
- check parent1/a parent2/a share1/a
-
- mount --bind "$disk4" share1/b
-
- check parent1/b parent2/b share1/b
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test18: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test18: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
+test()
{
- umount share1/b
- umount parent2/a
- umount parent1/child1
- umount parent1/child1
- umount parent2
- umount parent1
- umount share1
- umount parent2
- umount parent1
- umount share1
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test18: FAILED: bind: shared subtree with shared child to private subtree."
- exit 1
-else
- tst_resm TPASS "bind/test18: PASSED"
- exit 0
-fi
-tst_exit
+ tst_res TINFO "bind: shared subtree with shared child to private subtree"
+
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share1
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" share1
+ EXPECT_PASS mount --bind share1 parent1
+
+ EXPECT_PASS mount --bind parent1 parent2
+ fs_bind_makedir rshared parent1/child1
+ fs_bind_check parent1 share1 parent2
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent1/child1
+ fs_bind_check parent1/child1 parent2/child1
+ fs_bind_check parent1/child1 share1/child1
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent2/a
+ fs_bind_check parent1/a parent2/a share1/a
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK4" share1/b
+ fs_bind_check parent1/b parent2/b share1/b
+
+ EXPECT_PASS umount share1/b
+ EXPECT_PASS umount parent2/a
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+}
+
+tst_run
@@ -1,109 +1,52 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test19} ${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 "***************TEST19***************"
-tst_resm TINFO "bind: shared subtree with shared child to slave subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test19 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
-
- ####### SETUP ######
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
-
- mount --bind "$disk1" share1
- mount --bind share1 parent1
- mount --bind share2 parent2
- "${FS_BIND_ROOT}/bin/makedir" slave parent2
-
- ###### BODY ######
- mount --bind parent1 parent2
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
-
- ##### VERIFICATION ######
- check parent1 share1 parent2
- mount --bind "$disk2" parent1/child1
- check parent1/child1 parent2/child1
- check parent1/child1 share1/child1
- mount --bind "$disk3" parent2/a
-
- check parent1/a parent2/a share1/a
-
- mount --bind "$disk4" share1/b
-
- check parent1/b parent2/b share1/b
-
- ##### CLEANUP ######
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test19: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test19: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
+test()
{
- umount share1/b
- umount parent2/a
- umount parent1/child1
- umount parent1/child1
- umount parent2
- umount parent2
- umount parent1
- umount share1
- umount parent2
- umount parent1
- umount share1
- umount share2
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test19: FAILED: bind: shared subtree with shared child to slave subtree."
- exit 1
-else
- tst_resm TPASS "bind/test19: PASSED"
- exit 0
-fi
-tst_exit
+ tst_res TINFO "bind: shared subtree with shared child to slave subtree"
+
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" share1
+ EXPECT_PASS mount --bind share1 parent1
+ EXPECT_PASS mount --bind --make-rslave share2 parent2
+
+ EXPECT_PASS mount --bind parent1 parent2
+ fs_bind_makedir rshared parent1/child1
+ fs_bind_check parent1 share1 parent2
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent1/child1
+ fs_bind_check parent1/child1 parent2/child1
+ fs_bind_check parent1/child1 share1/child1
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent2/a
+ fs_bind_check parent1/a parent2/a share1/a
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK4" share1/b
+ fs_bind_check parent1/b parent2/b share1/b
+
+ EXPECT_PASS umount share1/b
+ EXPECT_PASS umount parent2/a
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+}
+
+tst_run
@@ -1,98 +1,48 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test20} ${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 "***************TEST20***************"
-tst_resm TINFO "bind: shared subtree with shared child to uncloneable subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test20 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
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" unclone parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
-
- mount --bind "$disk1" share1
- mount --bind share1 parent1
-
- mount --bind parent1 parent2
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
-
- check parent1 share1 parent2
- mount --bind "$disk2" parent1/child1
- check parent1/child1 parent2/child1
- check parent1/child1 share1/child1
- mount --bind "$disk3" parent2/a
-
- check parent1/a parent2/a share1/a
-
- mount --bind "$disk4" share1/b
-
- check parent1/b parent2/b share1/b
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test20: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test20: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
+test()
{
- umount share1/b
- umount parent2/a
- umount parent1/child1
- umount parent1/child1
- umount parent2
- umount parent1
- umount share1
- umount parent2
- umount parent1
- umount share1
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test20: FAILED: bind: shared subtree with shared child to uncloneable subtree."
- exit 1
-else
- tst_resm TPASS "bind/test20: PASSED"
- exit 0
-fi
-tst_exit
+ tst_res TINFO "bind: shared subtree with shared child to uncloneable subtree"
+
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir runbindable parent2
+ fs_bind_makedir rshared share1
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" share1
+ EXPECT_PASS mount --bind share1 parent1
+
+ EXPECT_PASS mount --bind parent1 parent2
+ fs_bind_makedir rshared parent1/child1
+ fs_bind_check parent1 share1 parent2
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent1/child1
+ fs_bind_check parent1/child1 parent2/child1
+ fs_bind_check parent1/child1 share1/child1
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent2/a
+ fs_bind_check parent1/a parent2/a share1/a
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK4" share1/b
+ fs_bind_check parent1/b parent2/b share1/b
+
+ EXPECT_PASS umount share1/b
+ EXPECT_PASS umount parent2/a
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+}
+
+tst_run
@@ -1,114 +1,57 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test21} ${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 "***************TEST21***************"
-tst_resm TINFO "bind: multi-level slave p-nodes."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test21 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
-
-
-
- "${FS_BIND_ROOT}/bin/makedir" share dir1
- mkdir dir1/x dir2 dir3 dir4
-
- mount --bind dir1 dir2
- "${FS_BIND_ROOT}/bin/makedir" slave dir2
- "${FS_BIND_ROOT}/bin/makedir" -n share dir2
-
- mount --bind dir2 dir3
- "${FS_BIND_ROOT}/bin/makedir" slave dir3
- "${FS_BIND_ROOT}/bin/makedir" -n share dir3
-
- mount --bind dir3 dir4
- "${FS_BIND_ROOT}/bin/makedir" slave dir4
-
- mount --bind "$disk1" dir1/x
-
- check dir1/x dir2/x dir3/x dir4/x
+FS_BIND_TESTFUNC=test
- mount --bind "$disk2" dir2/x/a
- check -n dir1/x/a dir2/x/a
- check dir2/x/a dir3/x/a dir4/x/a
+. fs_bind_lib.sh
- mount --bind "$disk3" dir3/x/b
- check -n dir1/x/b dir3/x/b
- check -n dir2/x/b dir3/x/b
- check dir3/x/b dir4/x/b
-
- mount --bind "$disk4" dir4/x/c
- check -n dir1/x/c dir4/x/c
- check -n dir2/x/c dir4/x/c
- check -n dir3/x/c dir4/x/c
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test21: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test21: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
+test()
{
- umount dir2/x/a
- umount dir3/x/b
- umount dir4/x/c
- umount dir1/x
- umount dir1
- umount dir1
- umount dir2
- umount dir3
- umount dir4
-
- rm -rf dir*
-
- cleanup
-} >& /dev/null
-
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test21: FAILED: bind: multi-level slave p-nodes."
- exit 1
-else
- tst_resm TPASS "bind/test21: PASSED"
- exit 0
-fi
+ tst_res TINFO "bind: multi-level slave p-nodes"
+ fs_bind_makedir rshared dir1
+ mkdir dir1/x dir2 dir3 dir4
-tst_exit
+ EXPECT_PASS mount --bind dir1 dir2
+ EXPECT_PASS mount --make-rslave dir2
+ EXPECT_PASS mount --make-rshared dir2
+
+ EXPECT_PASS mount --bind dir2 dir3
+ EXPECT_PASS mount --make-rslave dir3
+ EXPECT_PASS mount --make-rshared dir3
+
+ EXPECT_PASS mount --bind dir3 dir4
+ EXPECT_PASS mount --make-rslave dir4
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" dir1/x
+ fs_bind_check dir1/x dir2/x dir3/x dir4/x
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" dir2/x/a
+ fs_bind_check -n dir1/x/a dir2/x/a
+ fs_bind_check dir2/x/a dir3/x/a dir4/x/a
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" dir3/x/b
+ fs_bind_check -n dir1/x/b dir3/x/b
+ fs_bind_check -n dir2/x/b dir3/x/b
+ fs_bind_check dir3/x/b dir4/x/b
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK4" dir4/x/c
+ fs_bind_check -n dir1/x/c dir4/x/c
+ fs_bind_check -n dir2/x/c dir4/x/c
+ fs_bind_check -n dir3/x/c dir4/x/c
+
+ EXPECT_PASS umount dir2/x/a
+ EXPECT_PASS umount dir3/x/b
+ EXPECT_PASS umount dir4/x/c
+ EXPECT_PASS umount dir1/x
+ EXPECT_PASS umount dir1
+ EXPECT_PASS umount dir2
+ EXPECT_PASS umount dir3
+ EXPECT_PASS umount dir4
+}
+
+tst_run
@@ -1,95 +1,40 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test22} ${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 "***************TEST22***************"
-tst_resm TINFO "bind: bind within same tree - root to child "
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test22 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
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
- "${FS_BIND_ROOT}/bin/makedir" share parent
- "${FS_BIND_ROOT}/bin/makedir" share parent/child1
- "${FS_BIND_ROOT}/bin/makedir" share parent/child2
-
- mount --bind parent parent/child2/
-
- check parent parent/child2/
-
- mount --bind "$disk3" parent/child2/child1
-
- check parent/child1 parent/child2/child1
-
- umount parent/child2/child1
+test()
+{
+ tst_res TINFO "bind: bind within same tree - root to child"
- check parent/child1 parent/child2/child1
+ fs_bind_makedir rshared parent
+ fs_bind_makedir rshared parent/child1
+ fs_bind_makedir rshared parent/child2
- mount --bind "$disk4" parent/child2/child1
+ EXPECT_PASS mount --bind parent parent/child2/
+ fs_bind_check parent parent/child2/
- check parent/child1 parent/child2/child1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent/child2/child1
+ fs_bind_check parent/child1 parent/child2/child1
- umount parent/child1
+ EXPECT_PASS umount parent/child2/child1
+ fs_bind_check parent/child1 parent/child2/child1
- check parent/child1 parent/child2/child1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK4" parent/child2/child1
+ fs_bind_check parent/child1 parent/child2/child1
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test22: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test22: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent/child1
- umount parent/child2
- umount parent/child2
- umount parent
+ EXPECT_PASS umount parent/child1
+ fs_bind_check parent/child1 parent/child2/child1
- rm -rf parent
+ EXPECT_PASS umount parent/child1
+ EXPECT_PASS umount parent/child2
+ EXPECT_PASS umount parent/child2
+ EXPECT_PASS umount parent
+}
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test22: FAILED: bind: bind within same tree - root to child "
- exit 1
-else
- tst_resm TPASS "bind/test22: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,89 +1,40 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test23} ${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 "***************TEST24***************"
-tst_resm TINFO "bind: shared child to shared parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test23 failed" && tst_exit)
-export result=0
-
+FS_BIND_TESTFUNC=test
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+. fs_bind_lib.sh
-while /bin/true ; do
- # This loop is for error recovery purposes only
-
-
- mkdir mnt mnt/1 mnt/2 mnt/1/abc tmp1 tmp1/3 tmp2
-
- mount --bind mnt mnt
- "${FS_BIND_ROOT}/bin/makedir" share mnt/1 mnt/1
- mount --bind mnt/1 mnt/2
- mount --bind "$disk1" mnt/1/abc
+test()
+{
+ tst_res TINFO "bind: shared child to shared parent"
- check mnt/1/abc mnt/2/abc "$disk1"
+ fs_bind_makedir private mnt
+ fs_bind_makedir rshared mnt/1
- "${FS_BIND_ROOT}/bin/makedir" share tmp1
- mount --bind tmp1 tmp2
+ mkdir mnt/2 mnt/1/abc
+ EXPECT_PASS mount --bind mnt/1 mnt/2
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" mnt/1/abc
- mount --move mnt tmp1/3
- check tmp1/3/1/abc tmp2/3/1/abc tmp2/3/2/abc "$disk1"
+ fs_bind_check mnt/1/abc mnt/2/abc "$FS_BIND_DISK1"
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test23: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test23: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount tmp1/3/1/abc
- umount tmp1/3/1
- umount tmp1/3/2
- umount tmp1/3
- umount tmp1
- umount tmp1
- umount tmp2
+ mkdir tmp2
+ fs_bind_makedir rshared tmp1
+ EXPECT_PASS mount --bind tmp1 tmp2
- rm -rf mnt tmp1 tmp2
+ mkdir tmp1/3
+ EXPECT_PASS mount --move mnt tmp1/3
+ fs_bind_check tmp1/3/1/abc tmp2/3/1/abc tmp2/3/2/abc "$FS_BIND_DISK1"
+ EXPECT_PASS umount tmp1/3/1/abc
+ EXPECT_PASS umount tmp1/3/1
+ EXPECT_PASS umount tmp1/3/2
+ EXPECT_PASS umount tmp1/3
+ EXPECT_PASS umount tmp1
+ EXPECT_PASS umount tmp2
+}
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test23: FAILED: bind: shared child to shared parent."
- exit 1
-else
- tst_resm TPASS "bind/test23: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,87 +1,35 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test24} ${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 "***************TEST24***************"
-tst_resm TINFO "bind: shared child to shared parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of bind/test24 failed" && tst_exit)
-export result=0
-
-
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+FS_BIND_TESTFUNC=test
-while /bin/true ; do
- # This loop is for error recovery purposes only
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "bind: shared child to shared parent"
- "${FS_BIND_ROOT}/bin/makedir" share dir1
- mkdir dir1/1 dir1/1/2 dir1/1/2/3 dir1/1/2/check dir2 dir3 dir4
+ fs_bind_makedir rshared dir1
+ mkdir dir1/1 dir1/1/2 dir1/1/2/3 dir1/1/2/fs_bind_check dir2 dir3 dir4
touch dir4/ls
- mount --bind dir1/1/2 dir2
- "${FS_BIND_ROOT}/bin/makedir" slave dir1
- "${FS_BIND_ROOT}/bin/makedir" -n share dir1
-
- mount --bind dir1/1/2/3 dir3
- "${FS_BIND_ROOT}/bin/makedir" slave dir1
-
- mount --bind dir4 dir2/check
-
- check dir1/1/2/check/ dir4
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "bind/test24: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "bind/test24: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount dir2/check
- umount dir3
- umount dir2
- umount dir1
+ EXPECT_PASS mount --bind dir1/1/2 dir2
+ EXPECT_PASS mount --make-rslave dir1
+ EXPECT_PASS mount --make-rshared dir1
+ EXPECT_PASS mount --bind dir1/1/2/3 dir3
+ EXPECT_PASS mount --make-rslave dir1
- rm -rf dir*
+ EXPECT_PASS mount --bind dir4 dir2/fs_bind_check
+ fs_bind_check dir1/1/2/fs_bind_check/ dir4
+ EXPECT_PASS umount dir2/fs_bind_check
+ EXPECT_PASS umount dir3
+ EXPECT_PASS umount dir2
+ EXPECT_PASS umount dir1
+}
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "bind/test24: FAILED: bind: shared child to shared parent."
- exit 1
-else
- tst_resm TPASS "bind/test24: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
new file mode 100644
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009, Cisco Systems Inc.
+# Ngie Cooper, July 2009
+
+top_srcdir ?= ../../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+INSTALL_TARGETS := fs_bind*
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
new file mode 100644
@@ -0,0 +1,213 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
+# Based on work by: Avantika Mathur (mathurav@us.ibm.com)
+
+TST_NEEDS_TMPDIR=1
+TST_NEEDS_ROOT=1
+TST_MIN_KVER=2.6.15
+TST_SETUP=fs_bind_setup
+TST_CLEANUP=fs_bind_cleanup
+TST_TESTFUNC=fs_bind_test
+TST_NEEDS_CMDS="mount umount awk sed"
+
+. tst_test.sh
+
+[ -z "$FS_BIND_TESTFUNC" ] && tst_brk TBROK "Please set FS_BIND_TESTFUNC before sourcing fs_bind_lib.sh"
+
+# Test interface:
+#
+# FS_BIND_TESTFUNC is the real testfunction. Please do not use
+# TST_TESTFUNC in the test. FS_BIND_TESTFUNC is used to wrap some additional logic.
+# TST_CNT can be used as usual
+
+FS_BIND_SANDBOX="sandbox"
+FS_BIND_DISK1="disk1"
+FS_BIND_DISK2="disk2"
+FS_BIND_DISK3="disk3"
+FS_BIND_DISK4="disk4"
+
+# Creates a directory and bind-mounts it to itself.
+# usage: fs_bind_makedir share_mode directory
+# where
+# share_mode is one of the --make-{shared,priv,...}
+# supported by mount
+# directory is directory where to be created/configured.
+# If it does not exist, it will be created
+fs_bind_makedir()
+{
+ local bind_type dir
+
+ bind_type="$1"
+ dir="$2"
+
+ case "$bind_type" in
+ shared|private|rshared|slave|rslave|rprivate|runbindable) ;;
+ *) tst_brk TBROK "Unknown share type \"$bind_type\""
+ esac
+
+ if [ -e "$dir" ]; then
+ tst_brk TBROK "An entry by the name \"$dir\" exists already"
+ fi
+
+ ROD mkdir -p "$dir"
+
+ # Most mount implementations can use --make-* in the same command as bind,
+ # but busybox mount, fails at least to set --make-private
+ EXPECT_PASS mount --bind "$dir" "$dir"
+ EXPECT_PASS mount --make-$bind_type "$dir"
+}
+
+# Verifies that subtrees contain the same content
+# usage: fs_bind_check [-n] dir1 dirn...
+# where
+# -n If set, expectes the subtrees to not be equal
+# -s Run check in mount namespace
+# dir1 dirn... An arbitraty number of directories, that are compared.
+# If -n is given, only two directories are allowed.
+fs_bind_check()
+{
+ local expect_diff args msg dir1 dir2 fail output
+ expect_diff=0
+ while getopts "n" args; do
+ case "$args" in
+ n) expect_diff=1; shift; ;;
+ esac
+ done
+ msg="Check"
+ [ $expect_diff -eq 1 ] && msg="$msg no"
+ msg="$msg propagation $*"
+
+ if [ $# -lt 2 ] || ( [ $expect_diff -eq 1 ] && [ $# -ne 2 ] ); then
+ tst_brk TBROK "Insufficient arguments"
+ fi
+
+ dir1=$1
+ shift
+
+ for dir2 in "$@"; do
+ # compare adjacent pairs of directory trees
+
+ if [ ! -d "$dir1" ]; then
+ tst_res TFAIL "$msg: \"$dir1\" does not exist"
+ return 1
+ elif [ ! -d "$dir2" ]; then
+ if [ $expect_diff -eq 1 ]; then
+ tst_res TPASS "$msg"
+ return 0
+ else
+ tst_res TFAIL "$msg: \"$dir2\" does not exist"
+ return 1
+ fi
+ fi
+
+ output="$(diff -r "$dir1" "$dir2" 2> /dev/null)"
+
+ if [ $? -ne 0 ]; then
+ if [ $expect_diff -eq 1 ]; then
+ # Since expect_diff=1 allows only two directories
+ # to be compared, we are done after finding the first diff
+ tst_res TPASS "$msg"
+ return 0
+ else
+ tst_res TFAIL "$msg:"
+ tst_res TFAIL "\"$dir1\" \"$dir2\" differ:\n$output"
+ return 1
+ fi
+ fi
+ dir1="$dir2"
+ done
+
+ if [ $expect_diff -eq 1 ]; then
+ tst_res TFAIL "$msg"
+ return 1
+ else
+ tst_res TPASS "$msg"
+ return 0
+ fi
+}
+
+fs_bind_setup()
+{
+ fs_bind_makedir private "$FS_BIND_SANDBOX"
+
+ cd $FS_BIND_SANDBOX
+ mkdir -p "$FS_BIND_DISK1" "$FS_BIND_DISK2" "$FS_BIND_DISK3" "$FS_BIND_DISK4"
+ mkdir "$FS_BIND_DISK1/a" "$FS_BIND_DISK1/b" "$FS_BIND_DISK1/c"
+ mkdir "$FS_BIND_DISK2/d" "$FS_BIND_DISK2/e" "$FS_BIND_DISK2/f"
+ mkdir "$FS_BIND_DISK3/g" "$FS_BIND_DISK3/h" "$FS_BIND_DISK3/i"
+ mkdir "$FS_BIND_DISK4/j" "$FS_BIND_DISK4/k" "$FS_BIND_DISK4/l"
+}
+
+_fs_bind_unmount_all()
+{
+ local mounts
+
+ cd "$TST_TMPDIR"
+
+ # Cleanup leftover mounts from the test
+ # sed '1!G;h;$!d' is used to reverse /proc/mounts.
+ # unmounting in reverse order requires significantly less iterations
+ # There is a slight chance, this loop does not terminate, if a mount
+ # cannot be unmounted for some reason. In that case the timeout
+ # will kill the test, but we cannot restore the system anyway
+ while true; do
+ mounts=$( sed '1!G;h;$!d' /proc/mounts \
+ | awk -vtmp="$TST_TMPDIR/$FS_BIND_SANDBOX/" \
+ 'index($2, tmp) {print $2}' )
+ [ -z "$mounts" ] && break
+ echo $mounts | xargs umount 2>/dev/null
+ done
+}
+
+fs_bind_cleanup()
+{
+ _fs_bind_unmount_all
+ umount "$FS_BIND_SANDBOX"
+}
+
+_fs_bind_setup_test()
+{
+ local e
+
+ cd "$TST_TMPDIR/$FS_BIND_SANDBOX" || tst_brk "Unable to cd into sandbox"
+
+ for e in ls *; do
+ if [ "$e" = "$FS_BIND_DISK1" ] \
+ || [ "$e" = "$FS_BIND_DISK2" ] \
+ || [ "$e" = "$FS_BIND_DISK3" ] \
+ || [ "$e" = "$FS_BIND_DISK4" ]; then
+ continue
+ fi
+ rm -rf "$e"
+ done
+}
+
+_fs_bind_cleanup_test()
+{
+ local mounts
+
+ mounts=$( awk -v tmp="$TST_TMPDIR/$FS_BIND_SANDBOX/" '
+ index($2, tmp) {
+ print substr($2, length(tmp) + 1)
+ }
+ ' /proc/mounts )
+ if [ -n "$mounts" ]; then
+ tst_res TFAIL "There are still mounts in the sandbox:\n$mounts"
+ fi
+ _fs_bind_unmount_all
+}
+
+fs_bind_test()
+{
+ _fs_bind_setup_test
+
+ if type ${FS_BIND_TESTFUNC}1 > /dev/null 2>&1; then
+ "$FS_BIND_TESTFUNC$_tst_i" $1
+ else
+ "$FS_BIND_TESTFUNC" $1
+ fi
+
+ _fs_bind_cleanup_test
+}
new file mode 100755
@@ -0,0 +1,56 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
+# Author: Avantika Mathur (mathurav@us.ibm.com)
+
+TST_CNT=3
+FS_BIND_TESTFUNC=test
+
+. fs_bind_lib.sh
+
+test1()
+{
+ tst_res TINFO "regression: bind unshared directory to unshare mountpoint"
+
+ mkdir dir
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" dir
+ fs_bind_check "$FS_BIND_DISK1" dir
+ EXPECT_PASS umount dir
+}
+
+test2()
+{
+ tst_res TINFO "regression: rbind unshared directory to unshare mountpoint"
+
+ mkdir dir1
+ mkdir dir2
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" dir1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" dir1/a
+ EXPECT_PASS mount --rbind dir1 dir2
+
+ fs_bind_check dir1/a dir2/a
+
+ EXPECT_PASS umount dir1/a
+ EXPECT_PASS umount dir2/a
+ EXPECT_PASS umount dir2
+ EXPECT_PASS umount dir1
+}
+
+test3()
+{
+ tst_res TINFO "regression: move unshared directory to unshare mountpoint"
+
+ mkdir dir1
+ mkdir dir2
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" dir1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" dir1/a
+ EXPECT_PASS mount --move dir1 dir2
+
+ fs_bind_check dir2/a "$FS_BIND_DISK2"
+
+ EXPECT_PASS umount dir2/a
+ EXPECT_PASS umount dir2
+}
+
+tst_run
deleted file mode 100644
@@ -1,158 +0,0 @@
-/******************************************************************************/
-/* */
-/* Copyright (c) International Business Machines Corp., 2008 */
-/* */
-/* This program is free software; you can redistribute it and/or modify */
-/* it under the terms of the GNU General Public License as published by */
-/* the Free Software Foundation; either version 2 of the License, or */
-/* (at your option) any later version. */
-/* */
-/* This program 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 General Public License for more details. */
-/* */
-/* You should have received a copy of the GNU General Public License */
-/* along with this program; if not, write to the Free Software */
-/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
-/* */
-/******************************************************************************/
-
-OO_DESCRIPTION.txt
-==================
-
-The contents of the move directory:
-test01 - shared child to shared parent.
-test02 - shared subtree to private parent.
-test03 - shared subtree to slave parent.
-test04 - shared subtree to uncloneable parent.
-test05 - private subtree to shared parent.
-test06 - private subtree to private parent.
-test07 - private subtree to slave parent.
-test08 - private subtree to uncloneable parent.
-test09 - slave subtree to shared parent.
-test10 - slave subtree to private parent.
-test11 - slave subtree to slave parent.
-test12 - slave subtree to uncloneable parent.
-test13 - uncloneable subtree to shared parent.
-test14 - uncloneable subtree to private parent.
-test15 - uncloneable subtree to slave parent.
-test16 - uncloneable subtree to uncloneable parent.
-test17 - tree with shared parent - check ERROR.
-test18 - private to private - with shared children
-test19 - private to private - with slave children
-test20 - private to private - with unclonable children
-test21 - shared tree within a tree it is bound to.
-test22 - shared tree within a tree it is bound to - and then move t
-
-
-test01:
-=======
-shared child to shared parent.
-
-
-test02:
-=======
-shared subtree to private parent.
-
-
-test03:
-=======
-shared subtree to slave parent.
-
-
-test04:
-=======
-shared subtree to uncloneable parent.
-
-
-test05:
-=======
-private subtree to shared parent.
-
-
-test06:
-=======
-private subtree to private parent.
-
-
-test07:
-=======
-private subtree to slave parent.
-
-
-test08:
-=======
-private subtree to uncloneable parent.
-
-
-test09:
-=======
-slave subtree to shared parent.
-
-
-test10:
-=======
-slave subtree to private parent.
-
-
-test11:
-=======
-slave subtree to slave parent.
-
-
-test12:
-=======
-slave subtree to uncloneable parent.
-
-
-test13:
-=======
-uncloneable subtree to shared parent.
-
-
-test14:
-=======
-uncloneable subtree to private parent.
-
-
-test15:
-=======
-uncloneable subtree to slave parent.
-
-
-test16:
-=======
-uncloneable subtree to uncloneable parent.
-
-
-test17:
-=======
-tree with shared parent - check ERROR.
-
-
-test18:
-=======
-private to private - with shared children
-
-
-test19:
-=======
-private to private - with slave children
-
-
-test20:
-=======
-private to private - with unclonable children
-
-
-test21:
-=======
-shared tree within a tree it is bound to.
-
-
-test22:
-=======
-shared tree within a tree it is bound to - and then move to another share subtree
-
-
new file mode 100644
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009, Cisco Systems Inc.
+# Ngie Cooper, July 2009
+
+top_srcdir ?= ../../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+INSTALL_TARGETS := fs_bind*
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
@@ -1,93 +1,44 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test01} ${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 "***************TEST01***************"
-tst_resm TINFO "move: shared child to shared parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test01 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "move: shared child to shared parent"
- "${FS_BIND_ROOT}/bin/makedir" share dir
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" share share1
+ fs_bind_makedir rshared dir
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share2
+ fs_bind_makedir rshared share1
- mount --bind dir share1
- mount --bind parent2 share2
+ EXPECT_PASS mount --bind dir share1
+ EXPECT_PASS mount --bind parent2 share2
mkdir dir/grandchild
mkdir parent2/child2
- mount --move dir parent2/child2
+ EXPECT_PASS mount --move dir parent2/child2
- mount --bind "$disk1" parent2/child2/grandchild
- check parent2/child2/grandchild share1/grandchild share2/child2/grandchild
- check -n dir/grandchild parent2/child2/grandchild
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent2/child2/grandchild
+ fs_bind_fs_bind_check parent2/child2/grandchild share1/grandchild share2/child2/grandchild
+ fs_bind_fs_bind_check -n dir/grandchild parent2/child2/grandchild
- mount --bind "$disk2" share1/grandchild/a
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" share1/grandchild/a
- check parent2/child2/grandchild/a share1/grandchild/a share2/child2/grandchild/a
+ fs_bind_fs_bind_check parent2/child2/grandchild/a share1/grandchild/a share2/child2/grandchild/a
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test01: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test01: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount dir 2> /dev/null
- umount share1/grandchild/a
- umount share1/grandchild/
- umount parent2/child2
- umount share1
- umount share1
- umount share2
- umount share2
- umount parent2
+ EXPECT_PASS umount share1/grandchild/a
+ EXPECT_PASS umount share1/grandchild/
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+}
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test01: FAILED: move: shared child to shared parent."
- exit 1
-else
- tst_resm TPASS "move/test01: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,94 +1,45 @@
-#!/bin/bash
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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
-#
+FS_BIND_TESTFUNC=test
-SETS_DEFAULTS="${TCID=test02} ${TST_COUNT=1} ${TST_TOTAL=1}"
-declare -r TCID
-declare -r TST_COUNT
-declare -r TST_TOTAL
-export TCID TST_COUNT TST_TOTAL
+. fs_bind_lib.sh
-tst_resm TINFO "***************TEST02***************"
-tst_resm TINFO "move: shared subtree to private parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test02 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
-
-
- "${FS_BIND_ROOT}/bin/makedir" share dir
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
+test()
+{
+ tst_res TINFO "move: shared subtree to private parent"
+ fs_bind_makedir rshared dir
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
- mount --bind dir share1
+ EXPECT_PASS mount --bind dir share1
mkdir dir/grandchild
mkdir parent2/child2
- mount --move dir parent2/child2
- mount --bind parent2 share2
+ EXPECT_PASS mount --move dir parent2/child2
+ EXPECT_PASS mount --bind parent2 share2
- mount --bind "$disk1" parent2/child2/grandchild
- check parent2/child2/grandchild share1/grandchild
- check -n dir/grandchild parent2/child2/grandchild
- check -n share2/child2/grandchild parent2/child2/grandchild
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent2/child2/grandchild
+ fs_bind_check parent2/child2/grandchild share1/grandchild
+ fs_bind_check -n dir/grandchild parent2/child2/grandchild
+ fs_bind_check -n share2/child2 parent2/child2
- mount --bind "$disk2" share1/grandchild/a
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" share1/grandchild/a
- check parent2/child2/grandchild/a share1/grandchild/a
+ fs_bind_check parent2/child2/grandchild/a share1/grandchild/a
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test02: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test02: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount share1/grandchild/a
- umount share1/grandchild/
- umount parent2/child2
- umount share1
- umount share1
- umount share2
- umount share2
- umount parent2
+ EXPECT_PASS umount share1/grandchild/a
+ EXPECT_PASS umount share1/grandchild/
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+}
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test02: FAILED: move: shared subtree to private parent."
- exit 1
-else
- tst_resm TPASS "move/test02: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,97 +1,47 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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 "***************TEST02***************"
-tst_resm TINFO "move: shared subtree to slave parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test03 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "move: shared subtree to slave parent"
- "${FS_BIND_ROOT}/bin/makedir" share dir
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
+ fs_bind_makedir rshared dir
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
- mount --bind dir share1
- mount --bind share2 parent2
+ EXPECT_PASS mount --bind dir share1
+ EXPECT_PASS mount --bind share2 parent2
mkdir dir/grandchild
mkdir parent2/child2
- "${FS_BIND_ROOT}/bin/makedir" slave parent2
+ EXPECT_PASS mount --make-rslave parent2
- mount --move dir parent2/child2
+ EXPECT_PASS mount --move dir parent2/child2
- mount --bind "$disk1" parent2/child2/grandchild
- check parent2/child2/grandchild share1/grandchild
- check -n dir/grandchild parent2/child2/grandchild
- check -n share2/child2/grandchild parent2/child2/grandchild
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent2/child2/grandchild
+ fs_bind_check parent2/child2/grandchild share1/grandchild
+ fs_bind_check -n dir/grandchild parent2/child2/grandchild
+ fs_bind_check -n share2/child2 parent2/child2
- mount --bind "$disk2" share1/grandchild/a
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" share1/grandchild/a
- check parent2/child2/grandchild/a share1/grandchild/a
+ fs_bind_check parent2/child2/grandchild/a share1/grandchild/a
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test03: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test03: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount share1/grandchild/a
- umount parent2/child2/grandchild
- umount parent2/child2 # if move succeeded
- umount dir # if move failed
- umount parent2
- umount share1
- umount share2
- umount share1
- umount parent2
- umount dir
+ EXPECT_PASS umount share1/grandchild/a
+ EXPECT_PASS umount parent2/child2/grandchild
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+}
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test03: FAILED: move: shared subtree to slave parent."
- exit 1
-else
- tst_resm TPASS "move/test03: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,89 +1,41 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test04} ${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 "***************TEST04***************"
-tst_resm TINFO "move: shared subtree to uncloneable parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test04 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "move: shared subtree to uncloneable parent"
- "${FS_BIND_ROOT}/bin/makedir" share dir
- "${FS_BIND_ROOT}/bin/makedir" unclone parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
+ fs_bind_makedir rshared dir
+ fs_bind_makedir runbindable parent2
+ fs_bind_makedir rshared share1
- mount --bind dir share1
+ EXPECT_PASS mount --bind dir share1
mkdir dir/grandchild
mkdir parent2/child2
- mount --move dir parent2/child2
+ EXPECT_PASS mount --move dir parent2/child2
- mount --bind "$disk1" parent2/child2/grandchild
- check parent2/child2/grandchild share1/grandchild
- check -n dir/grandchild parent2/child2/grandchild
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent2/child2/grandchild
+ fs_bind_check parent2/child2/grandchild share1/grandchild
+ fs_bind_check -n dir/grandchild parent2/child2/grandchild
- mount --bind "$disk2" share1/grandchild/a
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" share1/grandchild/a
- check parent2/child2/grandchild/a share1/grandchild/a
+ fs_bind_check parent2/child2/grandchild/a share1/grandchild/a
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test04: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test04: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount share1/grandchild/a
- umount share1/grandchild/
- umount parent2/child2
- umount share1
- umount share1
- umount parent2
+ EXPECT_PASS umount share1/grandchild/a
+ EXPECT_PASS umount share1/grandchild/
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+}
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test04: FAILED: move: shared subtree to uncloneable parent."
- exit 1
-else
- tst_resm TPASS "move/test04: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,94 +1,44 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test05} ${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 "***************TEST05***************"
-tst_resm TINFO "move: private subtree to shared parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test05 failed" && tst_exit)
-export result=0
-
+FS_BIND_TESTFUNC=test
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+. fs_bind_lib.sh
-while /bin/true ; do
- # This loop is for error recovery purposes only
-
-
- "${FS_BIND_ROOT}/bin/makedir" priv dir
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" share share1
+test()
+{
+ tst_res TINFO "move: private subtree to shared parent"
+ fs_bind_makedir private dir
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share2
+ fs_bind_makedir rshared share1
- mount --bind parent2 share2
+ EXPECT_PASS mount --bind parent2 share2
mkdir dir/grandchild
- mount --bind dir share1
+ EXPECT_PASS mount --bind dir share1
mkdir parent2/child2
- mount --move dir parent2/child2
+ EXPECT_PASS mount --move dir parent2/child2
- mount --bind "$disk1" parent2/child2/grandchild
- check parent2/child2/grandchild share2/child2/grandchild
- check -n dir/grandchild parent2/child2/grandchild
- check -n share1/grandchild parent2/child2/grandchild
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent2/child2/grandchild
+ fs_bind_check parent2/child2/grandchild share2/child2/grandchild
+ fs_bind_check -n dir/grandchild parent2/child2/grandchild
+ fs_bind_check -n share1/grandchild parent2/child2/grandchild
- mount --bind "$disk2" share2/child2/grandchild/a
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" share2/child2/grandchild/a
- check parent2/child2/grandchild/a share2/child2/grandchild/a
+ fs_bind_check parent2/child2/grandchild/a share2/child2/grandchild/a
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test05: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test05: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent2/child2/grandchild/a
- umount parent2/child2/grandchild
- umount parent2/child2 # if move succeeded
- umount dir # if move failed
- umount share1
- umount share2
- umount share1
- umount share2
- umount parent2
+ EXPECT_PASS umount parent2/child2/grandchild/a
+ EXPECT_PASS umount parent2/child2/grandchild
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+}
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test05: FAILED: move: private subtree to shared parent."
- exit 1
-else
- tst_resm TPASS "move/test05: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,88 +1,40 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test06} ${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 "***************TEST06***************"
-tst_resm TINFO "move: private subtree to private parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test06 failed" && tst_exit)
-export result=0
-
-
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+FS_BIND_TESTFUNC=test
-while /bin/true ; do
- # This loop is for error recovery purposes only
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "move: private subtree to private parent"
- "${FS_BIND_ROOT}/bin/makedir" priv dir
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" share share1
+ fs_bind_makedir private dir
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share2
+ fs_bind_makedir rshared share1
mkdir dir/grandchild
- mount --bind dir share1
+ EXPECT_PASS mount --bind dir share1
mkdir parent2/child2
- mount --bind parent2 share2
- mount --move dir parent2/child2
-
- mount --bind "$disk1" parent2/child2/grandchild
- check -n parent2/child2/grandchild share2/child2/grandchild
- check -n dir/grandchild parent2/child2/grandchild
- check -n share1/grandchild parent2/child2/grandchild
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test06: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test06: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent2/child2/grandchild
- umount parent2/child2/
- umount share1
- umount share1
- umount share2
- umount share2
- umount parent2
-
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test06: FAILED: move: private subtree to private parent."
- exit 1
-else
- tst_resm TPASS "move/test06: PASSED"
- exit 0
-fi
-tst_exit
+ EXPECT_PASS mount --bind parent2 share2
+ EXPECT_PASS mount --move dir parent2/child2
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent2/child2/grandchild
+ fs_bind_check -n parent2/child2/grandchild share2/child2/grandchild
+ fs_bind_check -n dir/grandchild parent2/child2/grandchild
+ fs_bind_check -n share1/grandchild parent2/child2/grandchild
+
+ EXPECT_PASS umount parent2/child2/grandchild
+ EXPECT_PASS umount parent2/child2/
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+}
+
+tst_run
@@ -1,91 +1,41 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test07} ${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 "***************TEST07***************"
-tst_resm TINFO "move: private subtree to slave parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test07 failed" && tst_exit)
-export result=0
-
-
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+FS_BIND_TESTFUNC=test
-while /bin/true ; do
- # This loop is for error recovery purposes only
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "move: private subtree to slave parent"
- "${FS_BIND_ROOT}/bin/makedir" priv dir
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" share share1
+ fs_bind_makedir private dir
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share2
+ fs_bind_makedir rshared share1
mkdir dir/grandchild
- mount --bind dir share1
+ EXPECT_PASS mount --bind dir share1
mkdir parent2/child2
- mount --bind parent2 share2
- "${FS_BIND_ROOT}/bin/makedir" slave parent2
- mount --move dir parent2/child2
-
- mount --bind "$disk1" parent2/child2/grandchild
- check -n parent2/child2/grandchild share2/child2/grandchild
- check -n dir/grandchild parent2/child2/grandchild
- check -n share1/grandchild parent2/child2/grandchild
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test07: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test07: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent2/child2/grandchild
- umount parent2/child2 # if move succeeded
- umount dir # if move did not succeed
- umount share2
- umount share1
- umount share1
- umount share2
- umount parent2
- umount dir
-
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test07: FAILED: move: private subtree to slave parent."
- exit 1
-else
- tst_resm TPASS "move/test07: PASSED"
- exit 0
-fi
-tst_exit
+ EXPECT_PASS mount --bind parent2 share2
+ EXPECT_PASS mount --make-rslave parent2
+ EXPECT_PASS mount --move dir parent2/child2
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent2/child2/grandchild
+ fs_bind_check -n parent2/child2/grandchild share2/child2/grandchild
+ fs_bind_check -n dir/grandchild parent2/child2/grandchild
+ fs_bind_check -n share1/grandchild parent2/child2/grandchild
+
+ EXPECT_PASS umount parent2/child2/grandchild
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+}
+
+tst_run
@@ -1,85 +1,35 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test08} ${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 "***************TEST08***************"
-tst_resm TINFO "move: private subtree to uncloneable parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test08 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "move: private subtree to uncloneable parent"
- "${FS_BIND_ROOT}/bin/makedir" priv dir
- "${FS_BIND_ROOT}/bin/makedir" unclone parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
+ fs_bind_makedir private dir
+ fs_bind_makedir runbindable parent2
+ fs_bind_makedir rshared share1
mkdir dir/grandchild
- mount --bind dir share1
+ EXPECT_PASS mount --bind dir share1
mkdir parent2/child2
- mount --move dir parent2/child2
+ EXPECT_PASS mount --move dir parent2/child2
- mount --bind "$disk1" parent2/child2/grandchild
- check -n dir/grandchild parent2/child2/grandchild
- check -n share1/grandchild parent2/child2/grandchild
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent2/child2/grandchild
+ fs_bind_check -n dir/grandchild parent2/child2/grandchild
+ fs_bind_check -n share1/grandchild parent2/child2/grandchild
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test08: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test08: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent2/child2/grandchild
- umount parent2/child2 # if move succeeded
- umount dir # if move failed
- umount share1
- umount share1
- umount parent2
- umount dir
+ EXPECT_PASS umount parent2/child2/grandchild
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+}
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test08: FAILED: move: private subtree to uncloneable parent."
- exit 1
-else
- tst_resm TPASS "move/test08: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,99 +1,50 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test09} ${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 "***************TEST09***************"
-tst_resm TINFO "move: slave subtree to shared parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test09 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "move: slave subtree to shared parent"
- "${FS_BIND_ROOT}/bin/makedir" share dir
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" share share1
+ fs_bind_makedir rshared dir
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share2
+ fs_bind_makedir rshared share1
- mount --bind parent2 share2
+ EXPECT_PASS mount --bind parent2 share2
mkdir dir/grandchild
- mount --bind dir share1
- "${FS_BIND_ROOT}/bin/makedir" slave dir
+ EXPECT_PASS mount --bind dir share1
+ EXPECT_PASS mount --make-rslave dir
mkdir parent2/child2
- mount --move dir parent2/child2
+ EXPECT_PASS mount --move dir parent2/child2
- mount --bind "$disk1" parent2/child2/grandchild
- check parent2/child2/grandchild share2/child2/grandchild
- check -n dir/grandchild parent2/child2/grandchild
- check -n share1/grandchild parent2/child2/grandchild
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent2/child2/grandchild
+ fs_bind_check parent2/child2/grandchild share2/child2/grandchild
+ fs_bind_check -n dir/grandchild parent2/child2/grandchild
+ fs_bind_check -n share1/grandchild parent2/child2/grandchild
- mount --bind "$disk2" share2/child2/grandchild/a
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" share2/child2/grandchild/a
- check parent2/child2/grandchild/a share2/child2/grandchild/a
+ fs_bind_check parent2/child2/grandchild/a share2/child2/grandchild/a
mkdir share1/test
- check parent2/child2 share1
+ fs_bind_check parent2/child2 share1
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test09: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test09: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent2/child2/grandchild/a
- umount parent2/child2/grandchild
- umount parent2/child2
- umount share1
- umount share1
- umount share2
- umount share2
- umount parent2
- umount dir
+ EXPECT_PASS umount parent2/child2/grandchild/a
+ EXPECT_PASS umount parent2/child2/grandchild
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+}
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test09: FAILED: move: slave subtree to shared parent."
- exit 1
-else
- tst_resm TPASS "move/test09: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,100 +1,46 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test10} ${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 "***************TEST10***************"
-tst_resm TINFO "move: slave subtree to private parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test10 failed" && tst_exit)
-export result=0
-
-
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+FS_BIND_TESTFUNC=test
-while /bin/true ; do
- # This loop is for error recovery purposes only
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "move: slave subtree to private parent"
- "${FS_BIND_ROOT}/bin/makedir" share dir
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" share share1
+ fs_bind_makedir rshared dir
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share2
+ fs_bind_makedir rshared share1
mkdir dir/grandchild
- mount --bind dir share1
- "${FS_BIND_ROOT}/bin/makedir" slave dir
+ EXPECT_PASS mount --bind dir share1
+ EXPECT_PASS mount --make-rslave dir
mkdir parent2/child2
- mount --bind parent2 share2
-
- mount --move dir parent2/child2
- check -n parent2/child2 share2/child2
-
- mount --bind "$disk1" share1/grandchild
- check parent2/child2/grandchild share1/grandchild
- check -n dir/grandchild/ parent2/child2/grandchild
+ EXPECT_PASS mount --bind parent2 share2
- mount --bind "$disk2" parent2/child2/grandchild/a
- check -n share1/grandchild/a parent2/child2/grandchild/a
+ EXPECT_PASS mount --move dir parent2/child2
+ fs_bind_check -n parent2/child2 share2/child2
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" share1/grandchild
+ fs_bind_check parent2/child2/grandchild share1/grandchild
+ fs_bind_check -n dir/grandchild/ parent2/child2/grandchild
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent2/child2/grandchild/a
+ fs_bind_check -n share1/grandchild/a parent2/child2/grandchild/a
+ EXPECT_PASS umount parent2/child2/grandchild/a
+ EXPECT_PASS umount share1/grandchild
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+}
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test10: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test10: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent2/child2/grandchild/a
- umount share1/grandchild # also does umount parent2/child2/grandchild
- umount parent2/child2
- umount dir # if move fails
- umount share2
- umount share1
- umount share1
- umount share2
- umount parent2
- umount dir
-
-
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test10: FAILED: move: slave subtree to private parent."
- exit 1
-else
- tst_resm TPASS "move/test10: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,98 +1,47 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test11} ${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 "***************TEST11***************"
-tst_resm TINFO "move: slave subtree to slave parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test11 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "move: slave subtree to slave parent"
- "${FS_BIND_ROOT}/bin/makedir" share dir
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" share share1
+ fs_bind_makedir rshared dir
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share2
+ fs_bind_makedir rshared share1
mkdir dir/grandchild
- mount --bind dir share1
- "${FS_BIND_ROOT}/bin/makedir" slave dir
+ EXPECT_PASS mount --bind dir share1
+ EXPECT_PASS mount --make-rslave dir
mkdir parent2/child2
- mount --bind parent2 share2
- "${FS_BIND_ROOT}/bin/makedir" slave parent2
-
- mount --move dir parent2/child2
- check -n parent2/child2 share2/child2
-
- mount --bind "$disk1" share1/grandchild
- check parent2/child2/grandchild share1/grandchild
- check -n dir/grandchild/ parent2/child2/grandchild
-
- mount --bind "$disk2" parent2/child2/grandchild/a
- check -n share1/grandchild/a parent2/child2/grandchild/a
-
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test11: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test11: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent2/child2/grandchild/a
- umount share1/grandchild
- umount parent2/child2
- umount dir # if move fails
- umount share2
- umount share1
- umount share1
- umount share2
- umount parent2
- umount dir
-
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test11: FAILED: move: slave subtree to slave parent."
- exit 1
-else
- tst_resm TPASS "move/test11: PASSED"
- exit 0
-fi
-tst_exit
+ EXPECT_PASS mount --bind parent2 share2
+ EXPECT_PASS mount --make-rslave parent2
+
+ EXPECT_PASS mount --move dir parent2/child2
+ fs_bind_check -n parent2/child2 share2/child2
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" share1/grandchild
+ fs_bind_check parent2/child2/grandchild share1/grandchild
+ fs_bind_check -n dir/grandchild/ parent2/child2/grandchild
+
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent2/child2/grandchild/a
+ fs_bind_check -n share1/grandchild/a parent2/child2/grandchild/a
+
+ EXPECT_PASS umount parent2/child2/grandchild/a
+ EXPECT_PASS umount share1/grandchild
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+}
+
+tst_run
@@ -1,98 +1,45 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test12} ${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 "***************TEST12***************"
-tst_resm TINFO "move: slave subtree to uncloneable parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test12 failed" && tst_exit)
-export result=0
-
-
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+FS_BIND_TESTFUNC=test
-while /bin/true ; do
- # This loop is for error recovery purposes only
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "move: slave subtree to uncloneable parent"
- "${FS_BIND_ROOT}/bin/makedir" share dir
- "${FS_BIND_ROOT}/bin/makedir" unclone parent2
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" share share1
+ fs_bind_makedir rshared dir
+ fs_bind_makedir runbindable parent2
+ fs_bind_makedir rshared share2
+ fs_bind_makedir rshared share1
mkdir dir/grandchild
- mount --bind dir share1
- "${FS_BIND_ROOT}/bin/makedir" slave dir
+ EXPECT_PASS mount --bind dir share1
+ EXPECT_PASS mount --make-rslave dir
mkdir parent2/child2
- mount --bind parent2 share2 2> /dev/null && /bin/false || /bin/true #mount should fail
-
- mount --move dir parent2/child2
- check -n parent2/child2 share2/child2
-
- mount --bind "$disk1" share1/grandchild
- check parent2/child2/grandchild share1/grandchild
- check -n dir/grandchild/ parent2/child2/grandchild
+ EXPECT_FAIL mount --bind parent2 share2 2> /dev/null
- mount --bind "$disk2" parent2/child2/grandchild/a
- check -n share1/grandchild/a parent2/child2/grandchild/a
+ EXPECT_PASS mount --move dir parent2/child2
+ fs_bind_check -n parent2/child2 share2/child2
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" share1/grandchild
+ fs_bind_check parent2/child2/grandchild share1/grandchild
+ fs_bind_check -n dir/grandchild/ parent2/child2/grandchild
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent2/child2/grandchild/a
+ fs_bind_check -n share1/grandchild/a parent2/child2/grandchild/a
+ EXPECT_PASS umount parent2/child2/grandchild/a
+ EXPECT_PASS umount share1/grandchild
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+}
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test12: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test12: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent2/child2/grandchild/a
- umount share1/grandchild
- umount parent2/child2
- umount share1
- umount share1
- umount share2
- umount share2
- umount parent2
- umount dir
-
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test12: FAILED: move: slave subtree to uncloneable parent."
- exit 1
-else
- tst_resm TPASS "move/test12: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,80 +1,30 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test13} ${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 "***************TEST13***************"
-tst_resm TINFO "move: uncloneable subtree to shared parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test13 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "move: uncloneable subtree to shared parent"
- "${FS_BIND_ROOT}/bin/makedir" unclone dir
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share2
+ fs_bind_makedir runbindable dir
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share2
- mount --bind parent2 share2
+ EXPECT_PASS mount --bind parent2 share2
mkdir dir/grandchild
mkdir parent2/child2
- mount --move dir parent2/child2 2> /dev/null || result=$? # mount should fail
+ EXPECT_FAIL mount --move dir parent2/child2
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test13: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test13: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount dir
- umount parent2/child2
- umount share2
- umount share2
- umount parent2
- umount dir
+ EXPECT_PASS umount dir
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+}
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -eq 1 ]
-then
- tst_resm TFAIL "move/test13: FAILED: move: uncloneable subtree to shared parent."
- exit 1
-else
- tst_resm TPASS "move/test13: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,82 +1,32 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test14} ${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 "***************TEST14***************"
-tst_resm TINFO "move: uncloneable subtree to private parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test14 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "move: uncloneable subtree to private parent"
- "${FS_BIND_ROOT}/bin/makedir" unclone dir
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share2
+ fs_bind_makedir runbindable dir
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share2
mkdir dir/grandchild
mkdir parent2/child2
- mount --move dir parent2/child2
+ EXPECT_PASS mount --move dir parent2/child2
- mount --bind parent2 share2
- check -n parent2/child2/ share2/child2/
+ EXPECT_PASS mount --bind parent2 share2
+ fs_bind_check -n parent2/child2/ share2/child2/
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test14: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test14: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount share2
- umount parent2/child2
- umount dir # if the move fails
- umount share2
- umount parent2
- umount dir
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+}
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test14: FAILED: move: uncloneable subtree to private parent."
- exit 1
-else
- tst_resm TPASS "move/test14: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,82 +1,32 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test15} ${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 "***************TEST15***************"
-tst_resm TINFO "move: uncloneable subtree to slave parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test15 failed" && tst_exit)
-export result=0
-
+FS_BIND_TESTFUNC=test
-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
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "move: uncloneable subtree to slave parent"
- "${FS_BIND_ROOT}/bin/makedir" unclone dir
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share2
+ fs_bind_makedir runbindable dir
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share2
- mount --bind parent2 share2
+ EXPECT_PASS mount --bind parent2 share2
mkdir dir/grandchild
mkdir parent2/child2
- "${FS_BIND_ROOT}/bin/makedir" slave parent2
- mount --move dir parent2/child2
- check -n parent2/child2/ share2/child2/
+ EXPECT_PASS mount --make-rslave parent2
+ EXPECT_PASS mount --move dir parent2/child2
+ fs_bind_check -n parent2/child2/ share2/child2/
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+}
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test15: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test15: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent2/child2
- umount dir # if the move fails
- umount share2
- umount share2
- umount parent2
-
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test15: FAILED: move: uncloneable subtree to slave parent."
- exit 1
-else
- tst_resm TPASS "move/test15: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,80 +1,29 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test16} ${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 "***************TEST16***************"
-tst_resm TINFO "move: uncloneable subtree to uncloneable parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test16 failed" && tst_exit)
-export result=0
-
+FS_BIND_TESTFUNC=test
-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
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "move: uncloneable subtree to uncloneable parent"
- "${FS_BIND_ROOT}/bin/makedir" unclone dir
- "${FS_BIND_ROOT}/bin/makedir" unclone parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
+ fs_bind_makedir runbindable dir
+ fs_bind_makedir runbindable parent2
+ fs_bind_makedir rshared share1
mkdir dir/grandchild
mkdir parent2/child2
- mount --move dir parent2/child2
- result=$?
+ EXPECT_PASS mount --move dir parent2/child2
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+}
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test16: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test16: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent2/child2
- umount dir # if the move fails
- umount share1
- umount parent2
-
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test16: FAILED: move: uncloneable subtree to uncloneable parent."
- exit 1
-else
- tst_resm TPASS "move/test16: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,77 +1,27 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test17} ${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 "***************TEST17***************"
-tst_resm TINFO "move: tree with shared parent"
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test17 failed" && tst_exit)
-export result=0
-
+FS_BIND_TESTFUNC=test
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+. fs_bind_lib.sh
-while /bin/true ; do
- # This loop is for error recovery purposes only
-
-
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
+test()
+{
+ tst_res TINFO "move: tree with shared parent"
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent1/child1
+ fs_bind_makedir rshared parent2
mkdir parent2/child2
- mount --move parent1/child1 parent2/child2 2> /dev/null || result=$?
+ EXPECT_FAIL mount --move parent1/child1 parent2/child2
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test17: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test17: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1 # if the move failed
- umount parent2/child2 # if the move succeeded
- umount parent2
- umount parent1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -eq 0 ]
-then
- tst_resm TFAIL "move/test17: FAILED: move: tree with shared parent - check ERROR."
- exit 1
-else
- tst_resm TPASS "move/test17: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,101 +1,47 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test18} ${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 "***************TEST18***************"
-tst_resm TINFO "move: private to private - with shared children "
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test18 failed" && tst_exit)
-export result=0
-
+FS_BIND_TESTFUNC=test
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+. fs_bind_lib.sh
-while /bin/true ; do
- # This loop is for error recovery purposes only
-
-
- "${FS_BIND_ROOT}/bin/makedir" priv parent1
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" share share1
-
- mount --bind parent1/child1 share1
- mount --bind "$disk1" parent1/child1
+test()
+{
+ tst_res TINFO "move: private to private - with shared children"
- mount --move parent1 parent2
+ fs_bind_makedir private parent1
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared parent1/child1
+ fs_bind_makedir rshared share1
- check parent2/child1 share1
+ EXPECT_PASS mount --bind parent1/child1 share1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent1/child1
- #
- mount --bind "$disk2" parent2/child1/a
- check parent2/child1/a share1/a
+ EXPECT_PASS mount --move parent1 parent2
- mount --bind "$disk3" share1/b
- check parent2/child1/b share1/b
+ fs_bind_check parent2/child1 share1
- umount parent2/child1/a #share1/a
- check parent2/child1/a share1/a
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent2/child1/a
+ fs_bind_check parent2/child1/a share1/a
- umount parent2/child1/b #share1/b
- check parent2/child1/b share1/b
- #
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" share1/b
+ fs_bind_check parent2/child1/b share1/b
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test18: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test18: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent2/child1
- umount parent2/child1
+ EXPECT_PASS umount parent2/child1/a
+ fs_bind_check parent2/child1/a share1/a
- umount parent1/child1
- umount share1
+ EXPECT_PASS umount parent2/child1/b
+ fs_bind_check parent2/child1/b share1/b
- umount share1
- umount parent1/child1
- umount parent2
- umount parent1
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+}
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test18: FAILED: move: private to private - with shared children "
- exit 1
-else
- tst_resm TPASS "move/test18: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,95 +1,47 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test19} ${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 "***************TEST19***************"
-tst_resm TINFO "move: private to private - with slave children "
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test19 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "move: private to private - with slave children"
- "${FS_BIND_ROOT}/bin/makedir" priv parent1
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
+ fs_bind_makedir private parent1
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share1
mkdir parent1/child1
- mount --bind "$disk1" share1
- mount --bind share1 parent1/child1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" share1
+ EXPECT_PASS mount --bind share1 parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" slave parent1/child1
+ EXPECT_PASS mount --make-rslave parent1/child1
- mount --move parent1 parent2
+ EXPECT_PASS mount --move parent1 parent2
- check parent2/child1 share1
+ fs_bind_check parent2/child1 share1
- mount --bind "$disk2" parent2/child1/a
- check -n parent2/child1/a share1/a
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent2/child1/a
+ fs_bind_check -n parent2/child1/a share1/a
- mount --bind "$disk3" share1/b
- check parent2/child1/b share1/b
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" share1/b
+ fs_bind_check parent2/child1/b share1/b
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test19: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test19: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent2/child1/b
- check -n parent2/child1/b share1/b
+ EXPECT_PASS umount parent2/child1/b
+ fs_bind_check -n parent2/child1/b share1/b
- umount parent2/child1/a
- umount parent2/child1
- umount share1/b
- umount share1
- umount share1
- umount parent1
- umount parent2
+ EXPECT_PASS umount parent2/child1/a
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount share1/b
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+}
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test19: FAILED: move: private to private - with slave children "
- exit 1
-else
- tst_resm TPASS "move/test19: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,79 +1,31 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test20} ${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 "***************TEST20***************"
-tst_resm TINFO "move: private to private - with unclonable children "
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test20 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "move: private to private - with unclonable children"
- "${FS_BIND_ROOT}/bin/makedir" priv parent1
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" unclone parent1/child1
+ fs_bind_makedir private parent1
+ fs_bind_makedir private parent2
+ fs_bind_makedir runbindable parent1/child1
- mount --bind "$disk1" parent1/child1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent1/child1
- mount --move parent1 parent2
+ EXPECT_PASS mount --move parent1 parent2
- check "$disk1" parent2/child1
+ fs_bind_check "$FS_BIND_DISK1" parent2/child1
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test20: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test20: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent2/child1
- umount parent2/child1
- umount parent1
- umount parent2
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+}
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test20: FAILED: move: private to private - with unclonable children "
- exit 1
-else
- tst_resm TPASS "move/test20: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,93 +1,44 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test21} ${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 "***************TEST21***************"
-tst_resm TINFO "move: shared tree within a tree it is bound to."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test21 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "move: shared tree within a tree it is bound to"
mkdir parent1 parent2
- mount --bind "$disk1" parent1
- mount --make-rshared parent1 > /dev/null 2>&1 || "${FS_BIND_ROOT}/bin/smount" parent1 rshared
- mount --bind parent1 parent2
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent1
+ EXPECT_PASS mount --make-rshared parent1
+
+ EXPECT_PASS mount --bind parent1 parent2
- check parent1 parent2
+ fs_bind_check parent1 parent2
- mount --move parent1 parent2/a
+ EXPECT_PASS mount --move parent1 parent2/a
- check parent2 parent2/a parent2/a/a
+ fs_bind_check parent2 parent2/a parent2/a/a
- mount --bind "$disk2" parent2/b
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent2/b
- check parent2/b parent2/a/b parent2/a/a/b
+ fs_bind_check parent2/b parent2/a/b parent2/a/a/b
- mount --bind "$disk3" parent2/a/c
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent2/a/c
- check parent2/c parent2/a/c parent2/a/a/c
+ fs_bind_check parent2/c parent2/a/c parent2/a/a/c
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test21: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test21: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent2/a/a/c
+ EXPECT_PASS umount parent2/a/a/c
- check parent2/c parent2/a/c parent2/a/a/c
+ fs_bind_check parent2/c parent2/a/c parent2/a/a/c
- umount parent2/b
- umount parent2/a/a
- umount parent2/a
- umount parent2
- umount parent1
+ EXPECT_PASS umount parent2/b
+ EXPECT_PASS umount parent2/a/a
+ EXPECT_PASS umount parent2
+}
- rm -rf dir parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test21: FAILED: move: shared tree within a tree it is bound to."
- exit 1
-else
- tst_resm TPASS "move/test21: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,87 +1,37 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test22} ${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 "***************TEST22***************"
-tst_resm TINFO "move: shared tree within a tree it is bound to - and then move to another share subtree"
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of move/test22 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "move: shared tree within a tree it is bound to - and then move to another share subtree"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
+ fs_bind_makedir rshared parent1
mkdir parent1/a parent2
- mount --bind parent1 parent2
+ EXPECT_PASS mount --bind parent1 parent2
- check parent1 parent2
+ fs_bind_check parent1 parent2
- mount --move parent1 parent2/a
+ EXPECT_PASS mount --move parent1 parent2/a
- check parent2 parent2/a parent2/a/a
+ fs_bind_check parent2 parent2/a parent2/a/a
- "${FS_BIND_ROOT}/bin/makedir" share tmp1
+ fs_bind_makedir rshared tmp1
mkdir tmp2 tmp1/1
- mount --bind tmp1 tmp2
- mount --move parent2 tmp1/1
+ EXPECT_PASS mount --bind tmp1 tmp2
+ EXPECT_PASS mount --move parent2 tmp1/1
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "move/test22: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "move/test22: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount tmp1/1/a/a
- umount tmp1/1/a
- umount tmp1/1
- umount tmp1
- umount tmp1
- umount tmp2
+ EXPECT_PASS umount tmp1/1/a/a
+ EXPECT_PASS umount tmp1/1
+ EXPECT_PASS umount tmp1
+ EXPECT_PASS umount tmp2
+}
- rm -rf dir parent* tmp1 tmp2
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "move/test22: FAILED: move: shared tree within a tree it is bound to - and then move to another share subtree"
- exit 1
-else
- tst_resm TPASS "move/test22: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
deleted file mode 100644
@@ -1,266 +0,0 @@
-/******************************************************************************/
-/* */
-/* Copyright (c) International Business Machines Corp., 2008 */
-/* */
-/* This program is free software; you can redistribute it and/or modify */
-/* it under the terms of the GNU General Public License as published by */
-/* the Free Software Foundation; either version 2 of the License, or */
-/* (at your option) any later version. */
-/* */
-/* This program 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 General Public License for more details. */
-/* */
-/* You should have received a copy of the GNU General Public License */
-/* along with this program; if not, write to the Free Software */
-/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
-/* */
-/******************************************************************************/
-
-OO_DESCRIPTION.txt
-==================
-
-The contents of the rbind directory:
-test07-2 - create slave then mount master - slave still propagates
-test01 - shared child to shared parent.
-test02 - shared child to private parent.
-test03 - shared child to slave parent.
-test04 - shared child to unclonable parent.
-test05 - private child to shared parent.
-test06 - private child to private parent.
-test07 - private child to slave parent.
-test08 - private child to uncloneable parent.
-test09 - slave child to shared parent.
-test10 - slave child to private parent.
-test11 - slave child to slave parent.
-test12 - slave child to uncloneable parent.
-test13 - uncloneable child to shared parent.
-test14 - uncloneable child to private parent.
-test15 - uncloneable child to slave parent.
-test16 - uncloneable child to uncloneable parent.
-test17 - shared subtree with shared child to shared subtree.
-test18 - shared subtree with shared child to private subtree.
-test19 - shared subtree with shared child to slave subtree.
-test20 - shared subtree with shared child to uncloneable subtree.
-test21 - shared subtree with private child to shared subtree.
-test22 - shared subtree with private child to slave subtree.
-test23 - shared subtree with private child to private subtree.
-test24 - shared subtree with unclonable child to private subtree.
-test25 - shared subtree with slave child to shared subtree.
-test26 - shared subtree with slave child to private subtree.
-test27 - shared subtree with slave child to slave subtree.
-test28 - shared subtree with slave child to unclone subtree.
-test29 - shared subtree with uncloneable child to shared subtree.
-test30 - shared subtree with uncloneable child to private subtree.
-test31 - shared subtree with uncloneable child to slave subtree.
-test32 - shared subtree with uncloneable child to uncloneable subt
-test33 - multi-level slave p-nodes.
-test34 - rbind within same tree - root to child, child is shared
-test35 - rbind within same tree - root to child, child is private
-test36 - rbind within same tree - root to child, child is unclonea
-test37 - private to private - with shared children.
-test38 - private to private - with slave children.
-test39 - private to private - with unclonable children.
-
-
-test07-2:
-=========
-create slave then mount master - slave still propagates.
-
-
-test01:
-=======
-shared child to shared parent.
-
-
-test02:
-=======
-shared child to private parent.
-
-
-test03:
-=======
-shared child to slave parent.
-
-
-test04:
-=======
-shared child to unclonable parent.
-
-
-test05:
-=======
-private child to shared parent.
-
-
-test06:
-=======
-private child to private parent.
-
-
-test07:
-=======
-private child to slave parent.
-
-
-test08:
-=======
-private child to uncloneable parent.
-
-
-test09:
-=======
-slave child to shared parent.
-
-
-test10:
-=======
-slave child to private parent.
-
-
-test11:
-=======
-slave child to slave parent.
-
-
-test12:
-=======
-slave child to uncloneable parent.
-
-
-test13:
-=======
-uncloneable child to shared parent.
-
-
-test14:
-=======
-uncloneable child to private parent.
-
-
-test15:
-=======
-uncloneable child to slave parent.
-
-
-test16:
-=======
-uncloneable child to uncloneable parent.
-
-
-test17:
-=======
-shared subtree with shared child to shared subtree.
-
-
-test18:
-=======
-shared subtree with shared child to private subtree.
-
-
-test19:
-=======
-shared subtree with shared child to slave subtree.
-
-
-test20:
-=======
-shared subtree with shared child to uncloneable subtree.
-
-
-test21:
-=======
-shared subtree with private child to shared subtree.
-
-
-test22:
-=======
-shared subtree with private child to slave subtree.
-
-
-test23:
-=======
-shared subtree with private child to private subtree.
-
-
-test24:
-=======
-shared subtree with unclonable child to private subtree.
-
-
-test25:
-=======
-shared subtree with slave child to shared subtree.
-
-
-test26:
-=======
-shared subtree with slave child to private subtree.
-
-
-test27:
-=======
-shared subtree with slave child to slave subtree.
-
-
-test28:
-=======
-shared subtree with slave child to unclone subtree.
-
-
-test29:
-=======
-shared subtree with uncloneable child to shared subtree.
-
-
-test30:
-=======
-shared subtree with uncloneable child to private subtree.
-
-
-test31:
-=======
-shared subtree with uncloneable child to slave subtree.
-
-
-test32:
-=======
-shared subtree with uncloneable child to uncloneable subtree.
-
-
-test33:
-=======
-multi-level slave p-nodes.
-
-
-test34:
-=======
-rbind within same tree - root to child, child is shared
-
-
-test35:
-=======
-rbind within same tree - root to child, child is private
-
-
-test36:
-=======
-rbind within same tree - root to child, child is uncloneable
-
-
-test37:
-=======
-private to private - with shared children.
-
-
-test38:
-=======
-private to private - with slave children.
-
-
-test39:
-=======
-private to private - with unclonable children.
-
-
new file mode 100644
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009, Cisco Systems Inc.
+# Ngie Cooper, July 2009
+
+top_srcdir ?= ../../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+INSTALL_TARGETS := fs_bind*
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
@@ -1,98 +1,50 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test01} ${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 "***************TEST01***************"
-tst_resm TINFO "rbind: shared child to shared parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test01 failed" && tst_exit)
-export result=0
-
+FS_BIND_TESTFUNC=test
-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
-
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "rbind: shared child to shared parent"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share2
+ fs_bind_makedir rshared parent1/child1
- mount --rbind "$disk1" parent1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
mkdir parent2/child2
- mount --rbind parent2 share2
- mount --rbind parent1/child1 parent2/child2
+ EXPECT_PASS mount --rbind parent2 share2
+ EXPECT_PASS mount --rbind parent1/child1 parent2/child2
- check parent2 share2
- check parent1/child1 parent2/child2
+ fs_bind_check parent2 share2
+ fs_bind_check parent1/child1 parent2/child2
- mount --rbind "$disk2" parent1/child1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1/a
- check parent1/child1/a parent2/child2/a share2/child2/a
+ fs_bind_check parent1/child1/a parent2/child2/a share2/child2/a
- mount --rbind "$disk3" parent2/child2/b
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/child2/b
- check parent1/child1/b parent2/child2/b share2/child2/b
+ fs_bind_check parent1/child1/b parent2/child2/b share2/child2/b
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test01: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test01: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent1/child1/b
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount share2
- umount share2
- umount parent2
- umount parent1
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test01: FAILED: rbind: shared child to shared parent."
- exit 1
-else
- tst_resm TPASS "rbind/test01: PASSED"
- exit 0
-fi
-tst_exit
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent1/child1/b
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
+
+tst_run
@@ -1,97 +1,50 @@
-#!/bin/bash
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test02} ${TST_COUNT=1} ${TST_TOTAL=1}"
-declare -r TCID
-declare -r TST_COUNT
-declare -r TST_TOTAL
-export TCID TST_COUNT TST_TOTAL
+FS_BIND_TESTFUNC=test
-tst_resm TINFO "***************TEST02***************"
-tst_resm TINFO "rbind: shared child to private parent."
-tst_resm TINFO "************************************"
+. fs_bind_lib.sh
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test02 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
+test()
+{
+ tst_res TINFO "rbind: shared child to private parent"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared parent1/child1
- mount --rbind "$disk1" parent1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
mkdir parent2/child2
- mount --rbind parent1/child1 share1
- mount --rbind parent1/child1 parent2/child2
+ EXPECT_PASS mount --rbind parent1/child1 share1
+ EXPECT_PASS mount --rbind parent1/child1 parent2/child2
- check parent1/child1 share1
- check parent1/child1 parent2/child2
+ fs_bind_check parent1/child1 share1
+ fs_bind_check parent1/child1 parent2/child2
- mount --rbind "$disk2" parent1/child1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1/a
- check parent1/child1/a parent2/child2/a share1/a
+ fs_bind_check parent1/child1/a parent2/child2/a share1/a
- mount --rbind "$disk3" parent2/child2/b
-
- check parent1/child1/b parent2/child2/b share1/b
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test02: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test02: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent2/child2/b
- umount parent1/child1/a
- umount parent2/child2
- umount share1
- umount parent1/child1
- umount parent1/child1
- umount share1
- umount parent2
- umount parent1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/child2/b
- rm -rf parent* share*
- cleanup
-} >& /dev/null
+ fs_bind_check parent1/child1/b parent2/child2/b share1/b
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test02: FAILED: rbind: shared child to private parent."
- exit 1
-else
- tst_resm TPASS "rbind/test02: PASSED"
- exit 0
-fi
+ EXPECT_PASS umount parent2/child2/b
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
-tst_exit
+tst_run
@@ -1,118 +1,61 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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 "rbind: shared child to slave parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/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
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "rbind: shared child to slave parent"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
+ fs_bind_makedir rshared parent1/child1
mkdir parent2
- mount --rbind parent1/child1 share1
- mount --rbind "$disk1" parent1/child1
- mount --rbind "$disk2" share2
- mount --rbind share2 parent2
- "${FS_BIND_ROOT}/bin/makedir" slave parent2
-
- "${FS_BIND_ROOT}/bin/check_prop" share2 parent2
+ EXPECT_PASS mount --rbind parent1/child1 share1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" share2
+ EXPECT_PASS mount --rbind share2 parent2
+ EXPECT_PASS mount --make-rslave parent2
+ fs_bind_check share2 parent2
mkdir parent2/child2
- ls share2
- mount --rbind parent1/child1 share1
- mount --rbind parent1/child1 parent2/child2
+ EXPECT_PASS mount --rbind parent1/child1 share1
+ EXPECT_PASS mount --rbind parent1/child1 parent2/child2
- "${FS_BIND_ROOT}/bin/check_prop" parent1/child1 share1 parent2/child2
+ fs_bind_check parent1/child1 share1 parent2/child2
- mount --rbind "$disk3" parent1/child1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent1/child1/a
- "${FS_BIND_ROOT}/bin/check_prop" parent1/child1/a parent2/child2/a share1/a
- "${FS_BIND_ROOT}/bin/check_prop" -n parent2/child2 share2/child2
+ fs_bind_check parent1/child1/a parent2/child2/a share1/a
+ fs_bind_check -n parent2/child2 share2/child2
- mount --rbind "$disk3" parent2/child2/b
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/child2/b
- "${FS_BIND_ROOT}/bin/check_prop" -n parent2/child2 share2/child2
- "${FS_BIND_ROOT}/bin/check_prop" parent1/child1/b parent2/child2/b share1/b
+ fs_bind_check -n parent2/child2 share2/child2
+ fs_bind_check parent1/child1/b parent2/child2/b share1/b
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test03: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test03: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent1/child1/b
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount parent1/child1
- umount parent1/child1
- umount parent1/child1
- umount share2
- umount share2
- umount share2
- umount parent1
- umount parent2
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test03: FAILED: rbind: shared child to slave parent."
- exit 1
-else
- tst_resm TPASS "rbind/test03: PASSED"
- exit 0
-fi
-
-
-
-tst_exit
+
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent1/child1/b
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+}
+
+tst_run
@@ -1,104 +1,52 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test04} ${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 "***************TEST04***************"
-tst_resm TINFO "rbind: shared child to unclonable parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test04 failed" && tst_exit)
-export result=0
-
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+FS_BIND_TESTFUNC=test
-while /bin/true ; do
- # This loop is for error recovery purposes only
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "rbind: shared child to unclonable parent"
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir runbindable parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared parent1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
+ mkdir parent2/child2
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" unclone parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
+ EXPECT_PASS mount --rbind parent1/child1 share1
+ EXPECT_PASS mount --rbind parent1/child1 parent2/child2
- mount --rbind "$disk1" parent1/child1
+ fs_bind_check parent1/child1 share1 parent2/child2
- mkdir parent2/child2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1/a
- mount --rbind parent1/child1 share1
- mount --rbind parent1/child1 parent2/child2
+ fs_bind_check parent1/child1/a parent2/child2/a share1/a
- check parent1/child1 share1 parent2/child2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/child2/b
- mount --rbind "$disk2" parent1/child1/a
+ fs_bind_check parent1/child1/b parent2/child2/b share1/b
- check parent1/child1/a parent2/child2/a share1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK4" share1/c
- mount --rbind "$disk3" parent2/child2/b
- check parent1/child1/b parent2/child2/b share1/b
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent1/child1/b
+ EXPECT_PASS umount parent1/child1/c
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
- mount --rbind "$disk4" share1/c
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test04: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test04: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent1/child1/b
- umount parent1/child1/c
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount parent1/child1
- umount share1
- umount parent2
- umount parent1
-
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test04: FAILED: rbind: shared child to unclonable parent."
- exit 1
-else
- tst_resm TPASS "rbind/test04: PASSED"
- exit 0
-fi
-
-tst_exit
+tst_run
@@ -1,113 +1,62 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test05} ${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 "***************TEST05***************"
-tst_resm TINFO "rbind: private child to shared parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test05 failed" && tst_exit)
-export result=0
-
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+test()
+{
+ tst_res TINFO "rbind: private child to shared parent"
-while /bin/true ; do
- # This loop is for error recovery purposes only
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
+ fs_bind_makedir private parent1/child1
+ EXPECT_PASS mount --rbind parent1 share1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
+ EXPECT_PASS mount --rbind parent2 share2
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" priv parent1/child1
+ fs_bind_check -n parent1/child1 share1/child1
- mount --rbind parent1 share1
- mount --rbind "$disk1" parent1/child1
- mount --rbind parent2 share2
+ mkdir parent2/child2
- check -n parent1/child1 share1/child1
+ EXPECT_PASS mount --rbind parent1/child1 parent2/child2
- mkdir parent2/child2
+ fs_bind_check parent1/child1 parent2/child2 share2/child2
- mount --rbind parent1/child1 parent2/child2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1/a
- check parent1/child1 parent2/child2 share2/child2
+ fs_bind_check -n parent1/child1/a parent2/child2/a
- mount --rbind "$disk2" parent1/child1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/child2/b
- check -n parent1/child1/a parent2/child2/a
+ fs_bind_check -n parent1/child1/b parent2/child2/b
+ fs_bind_check parent2/child2/c share2/child2/c
- mount --rbind "$disk3" parent2/child2/b
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK4" share2/child2/c
- check -n parent1/child1/b parent2/child2/b
- check parent2/child2/c share2/child2/c
+ fs_bind_check -n parent1/child1/c parent2/child2/c
+ fs_bind_check parent2/child2/c share2/child2/c
- mount --rbind "$disk4" share2/child2/c
- check -n parent1/child1/c parent2/child2/c
- check parent2/child2/c share2/child2/c
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child2/b
+ EXPECT_PASS umount share2/child2/c
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test05: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test05: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent2/child2/b
- umount share2/child2/c
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount share1
- umount share1
- umount share2
- umount share2
- umount parent2
- umount parent1
-
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test05: FAILED: rbind: private child to shared parent."
- exit 1
-else
- tst_resm TPASS "rbind/test05: PASSED"
- exit 0
-fi
-
-
-tst_exit
+tst_run
@@ -1,102 +1,52 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test06} ${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 "***************TEST06***************"
-tst_resm TINFO "rbind: private child to private parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test06 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+test()
+{
+ tst_res TINFO "rbind: private child to private parent"
-while /bin/true ; do
- # This loop is for error recovery purposes only
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir private parent1/child1
+ EXPECT_PASS mount --rbind parent1 share1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" priv parent1/child1
+ fs_bind_check -n parent1/child1 share1/child1
- mount --rbind parent1 share1
- mount --rbind "$disk1" parent1/child1
+ mkdir parent2/child2
- check -n parent1/child1 share1/child1
+ EXPECT_PASS mount --rbind parent1/child1 parent2/child2
- mkdir parent2/child2
+ fs_bind_check parent1/child1 parent2/child2
- mount --rbind parent1/child1 parent2/child2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1/a
- check parent1/child1 parent2/child2
+ fs_bind_check -n parent1/child1/a parent2/child2/a
- mount --rbind "$disk2" parent1/child1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/child2/b
- check -n parent1/child1/a parent2/child2/a
+ fs_bind_check -n parent1/child1/b parent2/child2/b
+ fs_bind_check -n parent1/child1 share1/child1
- mount --rbind "$disk3" parent2/child2/b
- check -n parent1/child1/b parent2/child2/b
- check -n parent1/child1 share1/child1
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child2/b
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test06: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test06: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent2/child2/b
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount share1
- umount share1
- umount parent2
- umount parent1
-
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test06: FAILED: rbind: private child to private parent."
- exit 1
-else
- tst_resm TPASS "rbind/test06: PASSED"
- exit 0
-fi
-
-
-tst_exit
+tst_run
@@ -1,69 +1,37 @@
-#!/bin/bash
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
+# Author: Avantika Mathur (mathurav@us.ibm.com)
-SETS_DEFAULTS="${TCID=test07-2} ${TST_COUNT=1} ${TST_TOTAL=1}"
-declare -r TCID
-declare -r TST_COUNT
-declare -r TST_TOTAL
-export TCID TST_COUNT TST_TOTAL
+FS_BIND_TESTFUNC=test
-tst_resm TINFO "***************TEST07***************"
-tst_resm TINFO "rbind: create slave then mount master - slave still propagates."
-tst_resm TINFO "************************************"
+. fs_bind_lib.sh
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test07-2 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
-
-
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share2
-
- mount --rbind share2 parent2
- "${FS_BIND_ROOT}/bin/makedir" slave parent2
- mount --rbind "$disk1" share2
-
- check parent2 share2
+test()
+{
+ tst_res TINFO "rbind: create slave then mount master - slave still propagates"
- mount --rbind "$disk2" parent2/a
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share2
- check -n parent2/a share2/a
+ EXPECT_PASS mount --rbind share2 parent2
+ EXPECT_PASS mount --make-rslave parent2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" share2
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test07-2: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test07-2: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent2/a
- umount parent2
- umount parent2
- umount parent2
+ fs_bind_check parent2 share2
- umount share2
- umount share2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent2/a
+ fs_bind_check -n parent2/a share2/a
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test07-2: FAILED: rbind: create slave then mount master - slave still propagates."
- exit 1
-else
- tst_resm TPASS "rbind/test07-2: PASSED"
- exit 0
-fi
+ EXPECT_PASS umount parent2/a
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+}
-tst_exit
+tst_run
@@ -1,113 +1,62 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test07} ${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 "***************TEST07***************"
-tst_resm TINFO "rbind: private child to slave parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test07 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+test()
+{
+ tst_res TINFO "rbind: private child to slave parent"
-while /bin/true ; do
- # This loop is for error recovery purposes only
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
+ fs_bind_makedir private parent1/child1
+ EXPECT_PASS mount --rbind parent1 share1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" priv parent1/child1
+ fs_bind_check -n parent1/child1 share1/child1
- mount --rbind parent1 share1
- mount --rbind "$disk1" parent1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" share2
+ EXPECT_PASS mount --rbind share2 parent2
+ EXPECT_PASS mount --make-rslave parent2
- check -n parent1/child1 share1/child1
+ mkdir parent2/child2
+ fs_bind_check parent2 share2
- mount --rbind "$disk2" share2
- mount --rbind share2 parent2
- "${FS_BIND_ROOT}/bin/makedir" slave parent2
- #mount --rbind "$disk2" share2
+ EXPECT_PASS mount --rbind parent1/child1 parent2/child2
- mkdir parent2/child2
- check parent2 share2
+ fs_bind_check parent1/child1 parent2/child2
+ fs_bind_check -n parent2/child2 share2/child2
- mount --rbind parent1/child1 parent2/child2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1/a
- check parent1/child1 parent2/child2
- check -n parent2/child2 share2/child2
+ fs_bind_check -n parent1/child1/a parent2/child2/a
- mount --rbind "$disk2" parent1/child1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/child2/b
- check -n parent1/child1/a parent2/child2/a
+ fs_bind_check -n parent1/child1/b parent2/child2/b
+ fs_bind_check -n parent1/child1 share1/child1
- mount --rbind "$disk3" parent2/child2/b
- check -n parent1/child1/b parent2/child2/b
- check -n parent1/child1 share1/child1
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child2/b
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test07: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test07: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent2/child2/b
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount share1
- umount share1
- umount share2
- umount share2
- umount share2
- umount parent2
- umount parent1
-
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test07: FAILED: rbind: private child to slave parent."
- exit 1
-else
- tst_resm TPASS "rbind/test07: PASSED"
- exit 0
-fi
-
-
-tst_exit
+tst_run
@@ -1,103 +1,52 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test08} ${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 "***************TEST08***************"
-tst_resm TINFO "rbind: private child to uncloneable parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test08 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+test()
+{
+ tst_res TINFO "rbind: private child to uncloneable parent"
-while /bin/true ; do
- # This loop is for error recovery purposes only
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir runbindable parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir private parent1/child1
+ EXPECT_PASS mount --rbind parent1 share1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" unclone parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" priv parent1/child1
+ fs_bind_check -n parent1/child1 share1/child1
- mount --rbind parent1 share1
- mount --rbind "$disk1" parent1/child1
+ mkdir parent2/child2
- check -n parent1/child1 share1/child1
+ EXPECT_PASS mount --rbind parent1/child1 parent2/child2
- mkdir parent2/child2
+ fs_bind_check parent1/child1 parent2/child2
- mount --rbind parent1/child1 parent2/child2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1/a
- check parent1/child1 parent2/child2
+ fs_bind_check -n parent1/child1/a parent2/child2/a
- mount --rbind "$disk2" parent1/child1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/child2/b
- check -n parent1/child1/a parent2/child2/a
+ fs_bind_check -n parent1/child1/b parent2/child2/b
+ fs_bind_check -n parent1/child1 share1/child1
- mount --rbind "$disk3" parent2/child2/b
- check -n parent1/child1/b parent2/child2/b
- check -n parent1/child1 share1/child1
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child2/b
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test08: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test08: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent2/child2/b
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount share1
- umount share1
- umount parent2
- umount parent1
-
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test08: FAILED: rbind: private child to uncloneable parent."
- exit 1
-else
- tst_resm TPASS "rbind/test08: PASSED"
- exit 0
-fi
-
-
-tst_exit
+tst_run
@@ -1,113 +1,63 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test09} ${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 "***************TEST09***************"
-tst_resm TINFO "rbind: slave child to shared parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test09 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+test()
+{
+ tst_res TINFO "rbind: slave child to shared parent"
-while /bin/true ; do
- # This loop is for error recovery purposes only
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
+ fs_bind_makedir rshared parent1/child1
+ EXPECT_PASS mount --rbind parent2 share2
+ EXPECT_PASS mount --rbind share1 parent1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" share1
+ EXPECT_PASS mount --make-rslave parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
+ fs_bind_check parent1/child1 share1
- mount --rbind parent2 share2
- mount --rbind share1 parent1/child1
- mount --rbind "$disk1" share1
- "${FS_BIND_ROOT}/bin/makedir" slave parent1/child1
+ mkdir parent2/child2
- check parent1/child1 share1
+ EXPECT_PASS mount --rbind parent1/child1 parent2/child2
- mkdir parent2/child2
+ fs_bind_check parent1/child1 parent2/child2
- mount --rbind parent1/child1 parent2/child2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1/a
- check parent1/child1 parent2/child2
+ fs_bind_check -n parent1/child1/a parent2/child2/a
+ fs_bind_check -n parent1/child1/a share1/a
- mount --rbind "$disk2" parent1/child1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/child2/b
- check -n parent1/child1/a parent2/child2/a
- check -n parent1/child1/a share1/a
+ fs_bind_check -n parent1/child1/b parent2/child2/b
+ fs_bind_check parent2/child2/b share2/child2/b
- mount --rbind "$disk3" parent2/child2/b
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK4" share1/c
+ fs_bind_check share1/c parent1/child1/c
+ fs_bind_check parent1/child1/c parent2/child2/c
- check -n parent1/child1/b parent2/child2/b
- check parent2/child2/b share2/child2/b
- mount --rbind "$disk4" share1/c
- check share1/c parent1/child1/c
- check parent1/child1/c parent2/child2/c
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child2/b
+ EXPECT_PASS umount share1/c
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test09: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test09: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent2/child2/b
- umount share1/c
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount parent1/child1
- umount share1
- umount share2
- umount share2
- umount parent2
- umount parent1
-
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test09: FAILED: rbind: slave child to shared parent."
- exit 1
-else
- tst_resm TPASS "rbind/test09: PASSED"
- exit 0
-fi
-
-
-tst_exit
+tst_run
@@ -1,108 +1,58 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test10} ${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 "***************TEST10***************"
-tst_resm TINFO "rbind: slave child to private parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test10 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+test()
+{
+ tst_res TINFO "rbind: slave child to private parent"
-while /bin/true ; do
- # This loop is for error recovery purposes only
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared parent1/child1
+ EXPECT_PASS mount --rbind share1 parent1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" share1
+ EXPECT_PASS mount --make-rslave parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
+ fs_bind_check parent1/child1 share1
- mount --rbind share1 parent1/child1
- mount --rbind "$disk1" share1
- "${FS_BIND_ROOT}/bin/makedir" slave parent1/child1
+ mkdir parent2/child2
- check parent1/child1 share1
+ EXPECT_PASS mount --rbind parent1/child1 parent2/child2
- mkdir parent2/child2
+ fs_bind_check parent1/child1 parent2/child2
- mount --rbind parent1/child1 parent2/child2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1/a
- check parent1/child1 parent2/child2
+ fs_bind_check -n parent1/child1/a parent2/child2/a
+ fs_bind_check -n parent1/child1/a share1/a
- mount --rbind "$disk2" parent1/child1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/child2/b
- check -n parent1/child1/a parent2/child2/a
- check -n parent1/child1/a share1/a
+ fs_bind_check -n parent1/child1/b parent2/child2/b
- mount --rbind "$disk3" parent2/child2/b
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK4" share1/c
+ fs_bind_check share1/c parent1/child1/c
+ fs_bind_check parent1/child1/c parent2/child2/c
- check -n parent1/child1/b parent2/child2/b
- mount --rbind "$disk4" share1/c
- check share1/c parent1/child1/c
- check parent1/child1/c parent2/child2/c
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child2/b
+ EXPECT_PASS umount share1/c
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test10: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test10: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent2/child2/b
- umount share1/c
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount parent1/child1
- umount share1
- umount parent2
- umount parent1
-
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test10: FAILED: rbind: slave child to private parent."
- exit 1
-else
- tst_resm TPASS "rbind/test10: PASSED"
- exit 0
-fi
-
-
-tst_exit
+tst_run
@@ -1,117 +1,68 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test11} ${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 "***************TEST11***************"
-tst_resm TINFO "rbind: slave child to slave parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test11 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
-
-
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
-
- mount --rbind parent2 share2
- mount --rbind share1 parent1/child1
- mount --rbind "$disk1" share1
- mount --rbind "$disk2" share2
- "${FS_BIND_ROOT}/bin/makedir" slave parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" slave parent2
+
+FS_BIND_TESTFUNC=test
+
+. fs_bind_lib.sh
+
+test()
+{
+ tst_res TINFO "rbind: slave child to slave parent"
+
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
+ fs_bind_makedir rshared parent1/child1
+
+ EXPECT_PASS mount --rbind parent2 share2
+ EXPECT_PASS mount --rbind share1 parent1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" share1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" share2
+ EXPECT_PASS mount --make-rslave parent1/child1
+ EXPECT_PASS mount --make-rslave parent2
mkdir parent2/child2
- check parent1/child1 share1
- check parent2 share2
+ fs_bind_check parent1/child1 share1
+ fs_bind_check parent2 share2
- mount --rbind parent1/child1 parent2/child2
+ EXPECT_PASS mount --rbind parent1/child1 parent2/child2
- check parent1/child1 parent2/child2
+ fs_bind_check parent1/child1 parent2/child2
- mount --rbind "$disk3" parent1/child1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent1/child1/a
- check -n parent1/child1/a parent2/child2/a
- check -n parent1/child1/a share1/a
+ fs_bind_check -n parent1/child1/a parent2/child2/a
+ fs_bind_check -n parent1/child1/a share1/a
- mount --rbind "$disk4" parent2/child2/b
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK4" parent2/child2/b
- check -n parent1/child1/b parent2/child2/b
- check -n parent2/child2 share2/child2
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test11: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test11: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent2/child2/b
-
- mount --rbind "$disk4" share1/c
- check share1/c parent1/child1/c
- check parent1/child1/c parent2/child2/c
-
- umount parent1/child1/a
- umount share1/c
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount parent1/child1
- umount share1
- umount parent2
- umount parent2
- umount parent2
- umount parent2
- umount parent1
-
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test11: FAILED: rbind: slave child to slave parent."
- exit 1
-else
- tst_resm TPASS "rbind/test11: PASSED"
- exit 0
-fi
-
-
-tst_exit
+ fs_bind_check -n parent1/child1/b parent2/child2/b
+ fs_bind_check -n parent2/child2 share2/child2
+
+ EXPECT_PASS umount parent2/child2/b
+
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK4" share1/c
+ fs_bind_check share1/c parent1/child1/c
+ fs_bind_check parent1/child1/c parent2/child2/c
+
+
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount share1/c
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+}
+
+tst_run
@@ -1,108 +1,58 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test12} ${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 "***************TEST12***************"
-tst_resm TINFO "rbind: slave child to uncloneable parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test12 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+test()
+{
+ tst_res TINFO "rbind: slave child to uncloneable parent"
-while /bin/true ; do
- # This loop is for error recovery purposes only
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir runbindable parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared parent1/child1
+ EXPECT_PASS mount --rbind share1 parent1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" share1
+ EXPECT_PASS mount --make-rslave parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" unclone parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
+ fs_bind_check parent1/child1 share1
- mount --rbind share1 parent1/child1
- mount --rbind "$disk1" share1
- "${FS_BIND_ROOT}/bin/makedir" slave parent1/child1
+ mkdir parent2/child2
- check parent1/child1 share1
+ EXPECT_PASS mount --rbind parent1/child1 parent2/child2
- mkdir parent2/child2
+ fs_bind_check parent1/child1 parent2/child2
- mount --rbind parent1/child1 parent2/child2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1/a
- check parent1/child1 parent2/child2
+ fs_bind_check -n parent1/child1/a parent2/child2/a
+ fs_bind_check -n parent1/child1/a share1/a
- mount --rbind "$disk2" parent1/child1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/child2/b
- check -n parent1/child1/a parent2/child2/a
- check -n parent1/child1/a share1/a
+ fs_bind_check -n parent1/child1/b parent2/child2/b
- mount --rbind "$disk3" parent2/child2/b
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK4" share1/c
+ fs_bind_check share1/c parent1/child1/c
+ fs_bind_check parent1/child1/c parent2/child2/c
- check -n parent1/child1/b parent2/child2/b
- mount --rbind "$disk4" share1/c
- check share1/c parent1/child1/c
- check parent1/child1/c parent2/child2/c
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child2/b
+ EXPECT_PASS umount share1/c
+ EXPECT_PASS umount parent2/child2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent1
+}
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test12: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test12: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent2/child2/b
- umount share1/c
- umount parent2/child2
- umount parent1/child1
- umount parent1/child1
- umount parent1/child1
- umount parent2
- umount share1
- umount parent1
-
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test12: FAILED: rbind: slave child to uncloneable parent."
- exit 1
-else
- tst_resm TPASS "rbind/test12: PASSED"
- exit 0
-fi
-
-
-tst_exit
+tst_run
@@ -1,94 +1,39 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test13} ${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 "***************TEST13***************"
-tst_resm TINFO "rbind: uncloneable child to shared parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test13 failed" && tst_exit)
-export result=0
-
-
-
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+FS_BIND_TESTFUNC=test
-while /bin/true ; do
- # This loop is for error recovery purposes only
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "rbind: uncloneable child to shared parent"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" unclone parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
+ fs_bind_makedir runbindable parent1/child1
mkdir parent1/child1/x
- mount --rbind parent1 share1
- mount --rbind parent2 share2
- mount --rbind "$disk1" parent1/child1/x
+ EXPECT_PASS mount --rbind parent1 share1
+ EXPECT_PASS mount --rbind parent2 share2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1/x
mkdir parent2/child2
- mount --rbind parent1/child1 parent2/child2 2> /dev/null || result=$? # mount should fail
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test13: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test13: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/x
- umount parent1/child1
-
- rm -rf parent1/child1
- rm -rf parent2/child2
-
- umount share1
- umount share1
- umount share2
- umount share2
- umount parent2
- umount parent1
-
+ EXPECT_FAIL mount --rbind parent1/child1 parent2/child2
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -eq 0 ]
-then
- tst_resm TFAIL "rbind/test13: FAILED: rbind: uncloneable child to shared parent."
- exit 1
-else
- tst_resm TPASS "rbind/test13: PASSED"
- exit 0
-fi
+ EXPECT_PASS umount parent1/child1/x
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+}
-tst_exit
+tst_run
@@ -1,86 +1,35 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test14} ${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 "***************TEST14***************"
-tst_resm TINFO "rbind: uncloneable child to private parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test14 failed" && tst_exit)
-export result=0
-
-
+FS_BIND_TESTFUNC=test
-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
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "rbind: uncloneable child to private parent"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" unclone parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir runbindable parent1/child1
mkdir parent1/child1/x
- mount --rbind parent1 share1
- mount --rbind "$disk1" parent1/child1/x
+ EXPECT_PASS mount --rbind parent1 share1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1/x
mkdir parent2/child2
- mount --rbind parent1/child1 parent2/child2 2> /dev/null || result=$? # mount should fail
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test14: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test14: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/x
- umount parent1/child1
- umount share1
- umount share1
- umount parent2
- umount parent1
-
+ EXPECT_FAIL mount --rbind parent1/child1 parent2/child2
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -eq 0 ]
-then
- tst_resm TFAIL "rbind/test14: FAILED: rbind: uncloneable child to private parent."
- exit 1
-else
- tst_resm TPASS "rbind/test14: PASSED"
- exit 0
-fi
+ EXPECT_PASS umount parent1/child1/x
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
-tst_exit
+tst_run
@@ -1,97 +1,45 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test15} ${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 "***************TEST15***************"
-tst_resm TINFO "rbind: uncloneable child to slave parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test15 failed" && tst_exit)
-export result=0
-
-
+FS_BIND_TESTFUNC=test
-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
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "rbind: uncloneable child to slave parent"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" unclone parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
+ fs_bind_makedir runbindable parent1/child1
mkdir parent1/child1/x
- mount --rbind parent1 share1
- mount --rbind "$disk1" parent1/child1/x
- mount --rbind "$disk2" share2
- mount --rbind share2 parent2
- "${FS_BIND_ROOT}/bin/makedir" slave parent2
+ EXPECT_PASS mount --rbind parent1 share1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1/x
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" share2
+ EXPECT_PASS mount --rbind share2 parent2
+ EXPECT_PASS mount --make-rslave parent2
- check parent2 share2
+ fs_bind_check parent2 share2
mkdir parent2/child2
- mount --rbind parent1/child1 parent2/child2 2> /dev/null || result=$? # mount should fail
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test15: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test15: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/x
- umount parent1/child1
- umount share1
- umount share1
- umount share2
- umount share2
- umount share2
- umount parent2
- umount parent2
- umount parent1
-
+ EXPECT_FAIL mount --rbind parent1/child1 parent2/child2
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -eq 0 ]
-then
- tst_resm TFAIL "rbind/test15: FAILED: rbind: uncloneable child to slave parent."
- exit 1
-else
- tst_resm TPASS "rbind/test15: PASSED"
- exit 0
-fi
+ EXPECT_PASS umount parent1/child1/x
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
-tst_exit
+tst_run
@@ -1,87 +1,36 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test16} ${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 "***************TEST16***************"
-tst_resm TINFO "rbind: uncloneable child to uncloneable parent."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test16 failed" && tst_exit)
-export result=0
-
-
+FS_BIND_TESTFUNC=test
-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
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "rbind: uncloneable child to uncloneable parent"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" unclone parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" unclone parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir runbindable parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir runbindable parent1/child1
mkdir parent1/child1/x
- mount --rbind parent1 share1
- mount --rbind "$disk1" parent1/child1/x
+ EXPECT_PASS mount --rbind parent1 share1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1/x
mkdir parent2/child2
- mount --rbind parent1/child1 parent2/child2 2> /dev/null || result=$? # mount should fail
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test16: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test16: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/x
- umount parent1/child1
- umount share1
- umount share1
- umount parent2
- umount parent1
-
+ EXPECT_FAIL mount --rbind parent1/child1 parent2/child2
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -eq 0 ]
-then
- tst_resm TFAIL "rbind/test16: FAILED: rbind: uncloneable child to uncloneable parent."
- exit 1
-else
- tst_resm TPASS "rbind/test16: PASSED"
- exit 0
-fi
+ EXPECT_PASS umount parent1/child1/x
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+}
-tst_exit
+tst_run
@@ -1,98 +1,50 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test17} ${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 "***************TEST17***************"
-tst_resm TINFO "rbind: shared subtree with shared child to shared subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test17 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "rbind: shared subtree with shared child to shared subtree"
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" share1
+ EXPECT_PASS mount --rbind share1 parent1
- mount --rbind "$disk1" share1
- mount --rbind share1 parent1
+ fs_bind_makedir rshared parent1/child1
+ EXPECT_PASS mount --rbind parent1 parent2
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
- mount --rbind parent1 parent2
+ fs_bind_check parent1 share1 parent2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1
+ fs_bind_check parent1/child1 parent2/child1
+ fs_bind_check parent1/child1 share1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/a
- check parent1 share1 parent2
- mount --rbind "$disk2" parent1/child1
- check parent1/child1 parent2/child1
- check parent1/child1 share1/child1
- mount --rbind "$disk3" parent2/a
+ fs_bind_check parent1/a parent2/a share1/a
- check parent1/a parent2/a share1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK4" share1/b
- mount --rbind "$disk4" share1/b
+ fs_bind_check parent1/b parent2/b share1/b
- check parent1/b parent2/b share1/b
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test17: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test17: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount share1/b
- umount parent2/a
- umount parent1/child1
- umount parent1/child1
- umount parent2
- umount parent1
- umount share1
- umount parent2
- umount parent1
- umount share1
+ EXPECT_PASS umount share1/b
+ EXPECT_PASS umount parent2/a
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+}
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test17: FAILED: rbind: shared subtree with shared child to shared subtree."
- exit 1
-else
- tst_resm TPASS "rbind/test17: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,98 +1,50 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test18} ${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 "***************TEST18***************"
-tst_resm TINFO "rbind: shared subtree with shared child to private subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test18 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "rbind: shared subtree with shared child to private subtree"
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share1
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" share1
+ EXPECT_PASS mount --rbind share1 parent1
- mount --rbind "$disk1" share1
- mount --rbind share1 parent1
+ fs_bind_makedir rshared parent1/child1
+ EXPECT_PASS mount --rbind parent1 parent2
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
- mount --rbind parent1 parent2
+ fs_bind_check parent1 share1 parent2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1
+ fs_bind_check parent1/child1 parent2/child1
+ fs_bind_check parent1/child1 share1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/a
- check parent1 share1 parent2
- mount --rbind "$disk2" parent1/child1
- check parent1/child1 parent2/child1
- check parent1/child1 share1/child1
- mount --rbind "$disk3" parent2/a
+ fs_bind_check parent1/a parent2/a share1/a
- check parent1/a parent2/a share1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK4" share1/b
- mount --rbind "$disk4" share1/b
+ fs_bind_check parent1/b parent2/b share1/b
- check parent1/b parent2/b share1/b
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test18: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test18: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount share1/b
- umount parent2/a
- umount parent1/child1
- umount parent1/child1
- umount parent2
- umount parent1
- umount share1
- umount parent2
- umount parent1
- umount share1
+ EXPECT_PASS umount share1/b
+ EXPECT_PASS umount parent2/a
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+}
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test18: FAILED: rbind: shared subtree with shared child to private subtree."
- exit 1
-else
- tst_resm TPASS "rbind/test18: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,108 +1,53 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test19} ${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 "***************TEST19***************"
-tst_resm TINFO "rbind: shared subtree with shared child to slave subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test19 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
-
- ####### SETUP ######
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
-
- mount --rbind "$disk1" share1
- mount --rbind share1 parent1
- mount --rbind share2 parent2
- "${FS_BIND_ROOT}/bin/makedir" slave parent2
-
- ###### BODY ######
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
- mount --rbind parent1 parent2
- ##### VERIFICATION ######
- check parent1 share1 parent2
- mount --rbind "$disk2" parent1/child1
- check parent1/child1 parent2/child1
- check parent1/child1 share1/child1
- mount --rbind "$disk3" parent2/a
-
- check parent1/a parent2/a share1/a
-
- mount --rbind "$disk4" share1/b
-
- check parent1/b parent2/b share1/b
-
- ##### CLEANUP ######
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test19: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test19: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
+test()
{
- umount share1/b
- umount parent2/a
- umount parent1/child1
- umount parent1/child1
- umount parent2
- umount parent2
- umount parent1
- umount share1
- umount parent2
- umount parent1
- umount share1
- umount share2
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test19: FAILED: rbind: shared subtree with shared child to slave subtree."
- exit 1
-else
- tst_resm TPASS "rbind/test19: PASSED"
- exit 0
-fi
-tst_exit
+ tst_res TINFO "rbind: shared subtree with shared child to slave subtree"
+
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
+
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" share1
+ EXPECT_PASS mount --rbind share1 parent1
+ EXPECT_PASS mount --rbind share2 parent2
+ EXPECT_PASS mount --make-rslave parent2
+
+ fs_bind_makedir rshared parent1/child1
+ EXPECT_PASS mount --rbind parent1 parent2
+ fs_bind_check parent1 share1 parent2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1
+ fs_bind_check parent1/child1 parent2/child1
+ fs_bind_check parent1/child1 share1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/a
+
+ fs_bind_check parent1/a parent2/a share1/a
+
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK4" share1/b
+
+ fs_bind_check parent1/b parent2/b share1/b
+
+ EXPECT_PASS umount share1/b
+ EXPECT_PASS umount parent2/a
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+}
+
+tst_run
@@ -1,98 +1,50 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test20} ${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 "***************TEST20***************"
-tst_resm TINFO "rbind: shared subtree with shared child to uncloneable subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test20 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "rbind: shared subtree with shared child to uncloneable subtree"
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir runbindable parent2
+ fs_bind_makedir rshared share1
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" unclone parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" share1
+ EXPECT_PASS mount --rbind share1 parent1
- mount --rbind "$disk1" share1
- mount --rbind share1 parent1
+ fs_bind_makedir rshared parent1/child1
+ EXPECT_PASS mount --rbind parent1 parent2
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
- mount --rbind parent1 parent2
+ fs_bind_check parent1 share1 parent2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1
+ fs_bind_check parent1/child1 parent2/child1
+ fs_bind_check parent1/child1 share1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/a
- check parent1 share1 parent2
- mount --rbind "$disk2" parent1/child1
- check parent1/child1 parent2/child1
- check parent1/child1 share1/child1
- mount --rbind "$disk3" parent2/a
+ fs_bind_check parent1/a parent2/a share1/a
- check parent1/a parent2/a share1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK4" share1/b
- mount --rbind "$disk4" share1/b
+ fs_bind_check parent1/b parent2/b share1/b
- check parent1/b parent2/b share1/b
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test20: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test20: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount share1/b
- umount parent2/a
- umount parent1/child1
- umount parent1/child1
- umount parent2
- umount parent1
- umount share1
- umount parent2
- umount parent1
- umount share1
+ EXPECT_PASS umount share1/b
+ EXPECT_PASS umount parent2/a
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+}
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test20: FAILED: rbind: shared subtree with shared child to uncloneable subtree."
- exit 1
-else
- tst_resm TPASS "rbind/test20: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,106 +1,56 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test21} ${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 "***************TEST21***************"
-tst_resm TINFO "rbind: shared subtree with private child to shared subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test21 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "rbind: shared subtree with private child to shared subtree"
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
+ EXPECT_PASS mount --rbind share1 parent1
+ EXPECT_PASS mount --rbind share2 parent2
- mount --rbind share1 parent1
- mount --rbind share2 parent2
+ fs_bind_makedir private parent1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
+ EXPECT_PASS mount --rbind parent1 parent2
- "${FS_BIND_ROOT}/bin/makedir" priv parent1/child1
- mount --rbind "$disk1" parent1/child1
- mount --rbind parent1 parent2
+ fs_bind_check parent1 share1 parent2 share2
+ fs_bind_check parent1/child1/ parent2/child1
- check parent1 share1 parent2 share2
- check parent1/child1/ parent2/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1/a
- mount --rbind "$disk2" parent1/child1/a
+ fs_bind_check -n parent1/child1/a parent2/child1/a
+ fs_bind_check -n parent1/child1/a share1/child1/a
+ fs_bind_check parent2/child1/a share2/child1/a
- check -n parent1/child1/a parent2/child1/a
- check -n parent1/child1/a share1/child1/a
- check parent2/child1/a share2/child1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/child1/b
- mount --rbind "$disk3" parent2/child1/b
+ fs_bind_check -n parent1/child1/b parent2/child1/b
+ fs_bind_check parent2/child1/b share2/child1/b
- check -n parent1/child1/b parent2/child1/b
- check parent2/child1/b share2/child1/b
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test21: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test21: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent2/child1/b
- umount parent2/child1
- umount parent2/child1
- umount parent1/child1
- umount parent1/child1
- umount share2
- umount share2
- umount share2
- umount share2
- umount parent1
- umount parent2
- umount parent1
- umount share1
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child1/b
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+}
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test21: FAILED: rbind: shared subtree with private child to shared subtree."
- exit 1
-else
- tst_resm TPASS "rbind/test21: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,99 +1,49 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test22} ${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 "***************TEST22***************"
-tst_resm TINFO "rbind: shared subtree with private child to slave subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test22 failed" && tst_exit)
-export result=0
-
+FS_BIND_TESTFUNC=test
-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
-
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "rbind: shared subtree with private child to slave subtree"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share2
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share2
- mount --rbind share2 parent2
- "${FS_BIND_ROOT}/bin/makedir" slave parent2
- "${FS_BIND_ROOT}/bin/makedir" priv parent1/child1
- mount --rbind "$disk1" parent1/child1
- mount --rbind parent1 parent2
+ EXPECT_PASS mount --rbind share2 parent2
+ EXPECT_PASS mount --make-rslave parent2
+ fs_bind_makedir private parent1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
+ EXPECT_PASS mount --rbind parent1 parent2
- check parent1 parent2
- check parent1/child1/ parent2/child1
- check -n parent2 share2
- mount --rbind "$disk2" parent1/child1/a
+ fs_bind_check parent1 parent2
+ fs_bind_check parent1/child1/ parent2/child1
+ fs_bind_check -n parent2 share2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1/a
- check -n parent1/child1/a parent2/child1/a
+ fs_bind_check -n parent1/child1/a parent2/child1/a
- mount --rbind "$disk3" parent2/child1/b
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/child1/b
- check -n parent1/child1/b parent2/child1/b
+ fs_bind_check -n parent1/child1/b parent2/child1/b
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test22: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test22: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent2/child1/b
- umount parent2/child1
- umount parent2/child1
- umount parent1/child1
- umount parent1/child1
- umount parent2
- umount parent2
- umount parent1
- umount share2
- umount parent2
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child1/b
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+}
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test22: FAILED: rbind: shared subtree with private child to slave subtree."
- exit 1
-else
- tst_resm TPASS "rbind/test22: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,101 +1,49 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test23} ${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 "***************TEST23***************"
-tst_resm TINFO "rbind: shared subtree with private child to private subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test23 failed" && tst_exit)
-export result=0
-
+FS_BIND_TESTFUNC=test
-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
-
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "rbind: shared subtree with private child to private subtree"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" priv parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir private parent1/child1
- mount --rbind "$disk1" parent1/child1
- mount --rbind parent1 parent2
- mount --rbind parent1 share1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
+ EXPECT_PASS mount --rbind parent1 parent2
+ EXPECT_PASS mount --rbind parent1 share1
- check parent1 parent2
- check parent1/child1/ parent2/child1
+ fs_bind_check parent1 parent2
+ fs_bind_check parent1/child1/ parent2/child1
- mount --rbind "$disk2" parent1/child1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1/a
- check -n parent1/child1/a share1/child1/a
- check -n parent1/child1/a parent2/child1/a
+ fs_bind_check -n parent1/child1/a share1/child1/a
+ fs_bind_check -n parent1/child1/a parent2/child1/a
- mount --rbind "$disk3" parent2/child1/b
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/child1/b
- check -n parent1/child1/b parent2/child1/b
+ fs_bind_check -n parent1/child1/b parent2/child1/b
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test23: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test23: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent2/child1/b
- umount parent2/child1
- umount parent2/child1
- umount parent1/child1
- umount parent1/child1
- umount share1/child1
- umount share1/child1
- umount parent2
- umount parent2
- umount parent1
- umount parent1
- umount share1
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child1/b
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+}
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test23: FAILED: rbind: shared subtree with private child to private subtree."
- exit 1
-else
- tst_resm TPASS "rbind/test23: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,101 +1,49 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test24} ${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 "***************TEST24***************"
-tst_resm TINFO "rbind: shared subtree with unclonable child to private subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test24 failed" && tst_exit)
-export result=0
-
+FS_BIND_TESTFUNC=test
-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
-
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "rbind: shared subtree with unclonable child to private subtree"
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" unclone parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" priv parent1/child1
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir runbindable parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir private parent1/child1
- mount --rbind "$disk1" parent1/child1
- mount --rbind parent1 parent2
- mount --rbind parent1 share1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
+ EXPECT_PASS mount --rbind parent1 parent2
+ EXPECT_PASS mount --rbind parent1 share1
- check parent1 parent2
- check parent1/child1/ parent2/child1
+ fs_bind_check parent1 parent2
+ fs_bind_check parent1/child1/ parent2/child1
- mount --rbind "$disk2" parent1/child1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1/a
- check -n parent1/child1/a share1/child1/a
- check -n parent1/child1/a parent2/child1/a
+ fs_bind_check -n parent1/child1/a share1/child1/a
+ fs_bind_check -n parent1/child1/a parent2/child1/a
- mount --rbind "$disk3" parent2/child1/b
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/child1/b
- check -n parent1/child1/b parent2/child1/b
+ fs_bind_check -n parent1/child1/b parent2/child1/b
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test24: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test24: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent2/child1/b
- umount parent2/child1
- umount parent2/child1
- umount parent1/child1
- umount parent1/child1
- umount share1/child1
- umount share1/child1
- umount parent2
- umount parent2
- umount parent1
- umount parent1
- umount share1
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child1/b
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+}
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test24: FAILED: rbind: shared subtree with unclonable child to private subtree."
- exit 1
-else
- tst_resm TPASS "rbind/test24: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,106 +1,56 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test25} ${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 "***************TEST25***************"
-tst_resm TINFO "rbind: shared subtree with slave child to shared subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test25 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-trap 'ERR=$? ; ERR_MSG="caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"; break' ERR
+test()
+{
+ tst_res TINFO "rbind: shared subtree with slave child to shared subtree"
-while /bin/true ; do
- # This loop is for error recovery purposes only
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
+ mkdir parent1/child1
+ EXPECT_PASS mount --bind share1 parent1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
+ EXPECT_PASS mount --make-rslave parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- mkdir parent1/child1
+ EXPECT_PASS mount --rbind parent1 parent2
- mount --bind share1 parent1/child1
+ fs_bind_check parent1 parent2
+ fs_bind_check parent1/child1/ parent2/child1
- mount --rbind "$disk1" parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" slave parent1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1/a
- mount --rbind parent1 parent2
+ fs_bind_check -n parent1/child1/a parent2/child1/a
+ fs_bind_check -n parent1/child1/a share1/a
- check parent1 parent2
- check parent1/child1/ parent2/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/child1/b
- mount --rbind "$disk2" parent1/child1/a
+ fs_bind_check -n parent1/child1/b parent2/child1/b
+ fs_bind_check -n parent2/child1/b share1/b
- check -n parent1/child1/a parent2/child1/a
- check -n parent1/child1/a share1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK4" share1/c
+ fs_bind_check parent2/child1/c share1/c
+ fs_bind_check parent1/child1/c share1/c
- mount --rbind "$disk3" parent2/child1/b
- check -n parent1/child1/b parent2/child1/b
- check -n parent2/child1/b share1/b
+ EXPECT_PASS umount share1/c
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child1/b
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+}
- mount --rbind "$disk4" share1/c
- check parent2/child1/c share1/c
- check parent1/child1/c share1/c
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test25: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test25: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount share1/c
- umount parent1/child1/a
- umount parent2/child1/b
- umount parent2/child1
- umount parent2/child1
- umount parent1/child1
- umount parent2
- umount parent2
- umount parent1
-
-
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test25: FAILED: rbind: shared subtree with slave child to shared subtree."
- exit 1
-else
- tst_resm TPASS "rbind/test25: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,98 +1,51 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test26} ${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 "***************TEST26***************"
-tst_resm TINFO "rbind: shared subtree with slave child to private subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test26 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
+test()
+{
+ tst_res TINFO "rbind: shared subtree with slave child to private subtree"
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared parent1/child1
+ EXPECT_PASS mount --bind share1 parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
+ EXPECT_PASS mount --make-rslave parent1/child1
- mount --bind share1 parent1/child1
+ EXPECT_PASS mount --rbind parent1 parent2
- mount --rbind "$disk1" parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" slave parent1/child1
+ fs_bind_check parent1 parent2
+ fs_bind_check parent1/child1/ parent2/child1
- mount --rbind parent1 parent2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1/a
- check parent1 parent2
- check parent1/child1/ parent2/child1
+ fs_bind_check -n parent1/child1/a parent2/child1/a
+ fs_bind_check -n parent1/child1/a share1/a
- mount --rbind "$disk2" parent1/child1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/child1/b
- check -n parent1/child1/a parent2/child1/a
- check -n parent1/child1/a share1/a
+ fs_bind_check -n parent1/child1/b parent2/child1/b
- mount --rbind "$disk3" parent2/child1/b
- check -n parent1/child1/b parent2/child1/b
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child1/b
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+}
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test26: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test26: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent2/child1/b
- umount parent2/child1
- umount parent2/child1
- umount parent1/child1
- umount parent1/child1
- umount parent2
- umount parent2
- umount parent1
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test26: FAILED: rbind: shared subtree with slave child to private subtree."
- exit 1
-else
- tst_resm TPASS "rbind/test26: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,104 +1,56 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test27} ${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 "***************TEST27***************"
-tst_resm TINFO "rbind: shared subtree with slave child to slave subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test27 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "rbind: shared subtree with slave child to slave subtree"
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
+ fs_bind_makedir rshared parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
+ EXPECT_PASS mount --bind share1 parent1/child1
+ EXPECT_PASS mount --bind share2 parent2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
+ EXPECT_PASS mount --make-rslave parent1/child1
+ EXPECT_PASS mount --make-rslave parent2
- mount --bind share1 parent1/child1
- mount --bind share2 parent2
- mount --rbind "$disk1" parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" slave parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" slave parent2
+ EXPECT_PASS mount --rbind parent1 parent2
- mount --rbind parent1 parent2
+ fs_bind_check parent1 parent2
+ fs_bind_check parent1/child1/ parent2/child1
+ fs_bind_check -n parent2 share2
- check parent1 parent2
- check parent1/child1/ parent2/child1
- check -n parent2 share2
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1/a
- mount --rbind "$disk2" parent1/child1/a
+ fs_bind_check -n parent1/child1/a parent2/child1/a
+ fs_bind_check -n parent1/child1/a share1/a
- check -n parent1/child1/a parent2/child1/a
- check -n parent1/child1/a share1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/child1/b
- mount --rbind "$disk3" parent2/child1/b
+ fs_bind_check -n parent1/child1/b parent2/child1/b
- check -n parent1/child1/b parent2/child1/b
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test27: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test27: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent2/child1/b
- umount parent2/child1
- umount parent2/child1
- umount parent1/child1
- umount parent1/child1
- umount parent2
- umount parent2
- umount parent2
- umount share2
- umount parent1
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child1/b
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+}
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test27: FAILED: rbind: shared subtree with slave child to slave subtree."
- exit 1
-else
- tst_resm TPASS "rbind/test27: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,99 +1,51 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test28} ${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 "***************TEST28***************"
-tst_resm TINFO "rbind: shared subtree with slave child to unclone subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test28 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "rbind: shared subtree with slave child to unclone subtree"
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir runbindable parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" unclone parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
+ EXPECT_PASS mount --bind share1 parent1/child1
- mount --bind share1 parent1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
+ EXPECT_PASS mount --make-rslave parent1/child1
- mount --rbind "$disk1" parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" slave parent1/child1
+ EXPECT_PASS mount --rbind parent1 parent2
- mount --rbind parent1 parent2
+ fs_bind_check parent1 parent2
+ fs_bind_check parent1/child1/ parent2/child1
- check parent1 parent2
- check parent1/child1/ parent2/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" parent1/child1/a
- mount --rbind "$disk2" parent1/child1/a
+ fs_bind_check -n parent1/child1/a parent2/child1/a
+ fs_bind_check -n parent1/child1/a share1/a
- check -n parent1/child1/a parent2/child1/a
- check -n parent1/child1/a share1/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent2/child1/b
- mount --rbind "$disk3" parent2/child1/b
+ fs_bind_check -n parent1/child1/b parent2/child1/b
- check -n parent1/child1/b parent2/child1/b
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test28: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test28: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent2/child1/b
- umount parent2/child1
- umount parent2/child1
- umount parent1/child1
- umount parent2
- umount parent2
- umount parent1
- umount share1
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent2/child1/b
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+}
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test28: FAILED: rbind: shared subtree with slave child to unclone subtree."
- exit 1
-else
- tst_resm TPASS "rbind/test28: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,91 +1,43 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test29} ${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 "***************TEST29***************"
-tst_resm TINFO "rbind: shared subtree with uncloneable child to shared subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test29 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "rbind: shared subtree with uncloneable child to shared subtree"
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir rshared parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" share parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
+ EXPECT_PASS mount --rbind share1 parent1
+ EXPECT_PASS mount --rbind share2 parent2
- mount --rbind share1 parent1
- mount --rbind share2 parent2
+ fs_bind_makedir runbindable parent1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
+ EXPECT_PASS mount --rbind parent1 parent2
- "${FS_BIND_ROOT}/bin/makedir" unclone parent1/child1
- mount --rbind "$disk1" parent1/child1
- mount --rbind parent1 parent2
+ fs_bind_check -n parent1/child1 share1/child1
+ fs_bind_check -n parent1/child1 parent2/child1
+ fs_bind_check parent2/child1 share2/child1
- check -n parent1/child1 share1/child1
- check -n parent1/child1 parent2/child1
- check parent2/child1 share2/child1
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test29: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test29: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1
- umount parent1/child1
- umount share2
- umount share2
- umount parent2
- umount parent1
- umount share1
- umount parent1
- umount share2
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount parent2
+}
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test29: FAILED: rbind: shared subtree with uncloneable child to shared subtree."
- exit 1
-else
- tst_resm TPASS "rbind/test29: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,86 +1,38 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test30} ${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 "***************TEST30***************"
-tst_resm TINFO "rbind: shared subtree with uncloneable child to private subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test30 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "rbind: shared subtree with uncloneable child to private subtree"
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share1
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
+ EXPECT_PASS mount --rbind share1 parent1
- mount --rbind share1 parent1
+ fs_bind_makedir runbindable parent1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
+ EXPECT_PASS mount --rbind parent1 parent2
- "${FS_BIND_ROOT}/bin/makedir" unclone parent1/child1
- mount --rbind "$disk1" parent1/child1
- mount --rbind parent1 parent2
+ fs_bind_check -n parent1/child1 share1/child1
+ fs_bind_check -n parent1/child1 parent2/child1
- check -n parent1/child1 share1/child1
- check -n parent1/child1 parent2/child1
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test30: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test30: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1
- umount parent1/child1
- umount parent2
- umount parent2
- umount parent1
- umount share1
- umount parent1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent1
+}
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test30: FAILED: rbind: shared subtree with uncloneable child to private subtree."
- exit 1
-else
- tst_resm TPASS "rbind/test30: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,93 +1,45 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test31} ${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 "***************TEST31***************"
-tst_resm TINFO "rbind: shared subtree with uncloneable child to slave subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test31 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "rbind: shared subtree with uncloneable child to slave subtree"
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir private parent2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" priv parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
+ EXPECT_PASS mount --rbind share1 parent1
+ EXPECT_PASS mount --rbind share2 parent2
- mount --rbind share1 parent1
- mount --rbind share2 parent2
+ EXPECT_PASS mount --make-rslave parent2
- "${FS_BIND_ROOT}/bin/makedir" slave parent2
+ fs_bind_makedir runbindable parent1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
+ EXPECT_PASS mount --rbind parent1 parent2
- "${FS_BIND_ROOT}/bin/makedir" unclone parent1/child1
- mount --rbind "$disk1" parent1/child1
- mount --rbind parent1 parent2
+ fs_bind_check -n parent1/child1 share1/child1
+ fs_bind_check -n parent1/child1 parent2/child1
+ fs_bind_check -n parent2 share2
- check -n parent1/child1 share1/child1
- check -n parent1/child1 parent2/child1
- check -n parent2 share2
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test31: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test31: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1
- umount parent1/child1
- umount parent2
- umount parent2
- umount parent2
- umount parent1
- umount share1
- umount share2
- umount parent1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent1
+}
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test31: FAILED: rbind: shared subtree with uncloneable child to slave subtree."
- exit 1
-else
- tst_resm TPASS "rbind/test31: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,86 +1,38 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test32} ${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 "***************TEST32***************"
-tst_resm TINFO "rbind: shared subtree with uncloneable child to uncloneable subtree."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test32 failed" && tst_exit)
-export result=0
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
-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
-
+test()
+{
+ tst_res TINFO "rbind: shared subtree with uncloneable child to uncloneable subtree"
+ fs_bind_makedir rshared parent1
+ fs_bind_makedir runbindable parent2
+ fs_bind_makedir rshared share1
- "${FS_BIND_ROOT}/bin/makedir" share parent1
- "${FS_BIND_ROOT}/bin/makedir" unclone parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
+ EXPECT_PASS mount --rbind share1 parent1
- mount --rbind share1 parent1
+ fs_bind_makedir runbindable parent1/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" parent1/child1
+ EXPECT_PASS mount --rbind parent1 parent2
- "${FS_BIND_ROOT}/bin/makedir" unclone parent1/child1
- mount --rbind "$disk1" parent1/child1
- mount --rbind parent1 parent2
+ fs_bind_check -n parent1/child1 share1/child1
+ fs_bind_check -n parent1/child1 parent2/child1
- check -n parent1/child1 share1/child1
- check -n parent1/child1 parent2/child1
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test32: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test32: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1
- umount parent1/child1
- umount parent2
- umount parent2
- umount parent1
- umount share1
- umount parent1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount parent1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent1
+}
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test32: FAILED: rbind: shared subtree with uncloneable child to uncloneable subtree."
- exit 1
-else
- tst_resm TPASS "rbind/test32: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,114 +1,59 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test33} ${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 "***************TEST33***************"
-tst_resm TINFO "rbind: multi-level slave p-nodes."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test33 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
+FS_BIND_TESTFUNC=test
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "rbind: multi-level slave p-nodes"
- "${FS_BIND_ROOT}/bin/makedir" share dir1
+ fs_bind_makedir rshared dir1
mkdir dir1/x dir2 dir3 dir4
- mount --rbind dir1 dir2
- "${FS_BIND_ROOT}/bin/makedir" slave dir2
- "${FS_BIND_ROOT}/bin/makedir" -n share dir2
-
- mount --rbind dir2 dir3
- "${FS_BIND_ROOT}/bin/makedir" slave dir3
- "${FS_BIND_ROOT}/bin/makedir" -n share dir3
-
- mount --rbind dir3 dir4
- "${FS_BIND_ROOT}/bin/makedir" slave dir4
+ EXPECT_PASS mount --rbind dir1 dir2
+ EXPECT_PASS mount --make-rslave dir2
+ EXPECT_PASS mount --make-share dir2
- mount --rbind "$disk1" dir1/x
+ EXPECT_PASS mount --rbind dir2 dir3
+ EXPECT_PASS mount --make-rslave dir3
+ EXPECT_PASS mount --make-share dir3
- check dir1/x dir2/x dir3/x dir4/x
+ EXPECT_PASS mount --rbind dir3 dir4
+ EXPECT_PASS mount --make-rslave dir4
- mount --rbind "$disk2" dir2/x/a
- check -n dir1/x/a dir2/x/a
- check dir2/x/a dir3/x/a dir4/x/a
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK1" dir1/x
- mount --rbind "$disk3" dir3/x/b
- check -n dir1/x/b dir3/x/b
- check -n dir2/x/b dir3/x/b
- check dir3/x/b dir4/x/b
-
- mount --rbind "$disk4" dir4/x/c
- check -n dir1/x/c dir4/x/c
- check -n dir2/x/c dir4/x/c
- check -n dir3/x/c dir4/x/c
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test33: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test33: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount dir2/x/a
- umount dir3/x/b
- umount dir4/x/c
- umount dir1/x
- umount dir1
- umount dir1
- umount dir2
- umount dir3
- umount dir4
+ fs_bind_check dir1/x dir2/x dir3/x dir4/x
- rm -rf dir*
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK2" dir2/x/a
+ fs_bind_check -n dir1/x/a dir2/x/a
+ fs_bind_check dir2/x/a dir3/x/a dir4/x/a
- cleanup
-} >& /dev/null
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" dir3/x/b
+ fs_bind_check -n dir1/x/b dir3/x/b
+ fs_bind_check -n dir2/x/b dir3/x/b
+ fs_bind_check dir3/x/b dir4/x/b
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test33: FAILED: rbind: multi-level slave p-nodes."
- exit 1
-else
- tst_resm TPASS "rbind/test33: PASSED"
- exit 0
-fi
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK4" dir4/x/c
+ fs_bind_check -n dir1/x/c dir4/x/c
+ fs_bind_check -n dir2/x/c dir4/x/c
+ fs_bind_check -n dir3/x/c dir4/x/c
+ EXPECT_PASS umount dir2/x/a
+ EXPECT_PASS umount dir3/x/b
+ EXPECT_PASS umount dir4/x/c
+ EXPECT_PASS umount dir1/x
+ EXPECT_PASS umount dir1
+ EXPECT_PASS umount dir2
+ EXPECT_PASS umount dir3
+ EXPECT_PASS umount dir4
+}
-tst_exit
+tst_run
@@ -1,93 +1,43 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test34} ${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 "***************TEST34***************"
-tst_resm TINFO "rbind: rbind within same tree - root to child, child is shared "
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test34 failed" && tst_exit)
-export result=0
-
+FS_BIND_TESTFUNC=test
-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
-
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "rbind: rbind within same tree - root to child, child is shared "
- "${FS_BIND_ROOT}/bin/makedir" share parent
- "${FS_BIND_ROOT}/bin/makedir" share parent/child1
- "${FS_BIND_ROOT}/bin/makedir" share parent/child2
+ fs_bind_makedir rshared parent
+ fs_bind_makedir rshared parent/child1
+ fs_bind_makedir rshared parent/child2
- mount --rbind "$disk3" parent/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent/child1
- mount --rbind parent parent/child2/
- check parent parent/child2/
- check parent/child1 parent/child2/child1
+ EXPECT_PASS mount --rbind parent parent/child2/
+ fs_bind_check parent parent/child2/
+ fs_bind_check parent/child1 parent/child2/child1
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test34: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test34: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent/child2/child1
- check parent/child1 parent/child2/child1
+ EXPECT_PASS umount parent/child2/child1
+ fs_bind_check parent/child1 parent/child2/child1
- umount parent/child1
- check parent/child1 parent/child2/child1
+ EXPECT_PASS umount parent/child1
+ fs_bind_check parent/child1 parent/child2/child1
- mount --rbind "$disk4" parent/child2/child1
- check parent/child1 parent/child2/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK4" parent/child2/child1
+ fs_bind_check parent/child1 parent/child2/child1
- umount parent/child1
- check parent/child1 parent/child2/child1
+ EXPECT_PASS umount parent/child1
+ fs_bind_check parent/child1 parent/child2/child1
- umount parent/child2/child2
- umount parent/child2
- umount parent/child2
- umount parent
- rm -rf parent
+ EXPECT_PASS umount parent/child2/child2
+ EXPECT_PASS umount parent/child2
+ EXPECT_PASS umount parent
+}
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test34: FAILED: rbind: rbind within same tree - root to child, child is shared "
- exit 1
-else
- tst_resm TPASS "rbind/test34: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,95 +1,46 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test35} ${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 "***************TEST35***************"
-tst_resm TINFO "rbind: rbind within same tree - root to child, child is private "
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test35 failed" && tst_exit)
-export result=0
-
+FS_BIND_TESTFUNC=test
-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
-
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "rbind: rbind within same tree - root to child, child is private "
- "${FS_BIND_ROOT}/bin/makedir" share parent
- "${FS_BIND_ROOT}/bin/makedir" priv parent/child1
- "${FS_BIND_ROOT}/bin/makedir" share parent/child2
+ fs_bind_makedir rshared parent
+ fs_bind_makedir private parent/child1
+ fs_bind_makedir rshared parent/child2
- mount --rbind "$disk3" parent/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent/child1
- mount --rbind parent parent/child2/
- check parent parent/child2/
- check parent/child1 parent/child2/child1
+ EXPECT_PASS mount --rbind parent parent/child2/
+ fs_bind_check parent parent/child2/
+ fs_bind_check parent/child1 parent/child2/child1
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test35: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test35: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent/child2/child1
+ EXPECT_PASS umount parent/child2/child1
#added -n
- check -n parent/child1 parent/child2/child1
+ fs_bind_check -n parent/child1 parent/child2/child1
- umount parent/child1
- check parent/child1 parent/child2/child1
+ EXPECT_PASS umount parent/child1
+ fs_bind_check parent/child1 parent/child2/child1
- mount --rbind "$disk4" parent/child2/child1
- check -n parent/child1 parent/child2/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK4" parent/child2/child1
+ fs_bind_check -n parent/child1 parent/child2/child1
- umount parent/child2/child1
- check parent/child1 parent/child2/child1
+ EXPECT_PASS umount parent/child2/child1
+ fs_bind_check parent/child1 parent/child2/child1
- umount parent/child2/child2
- umount parent/child2/child1
- umount parent/child2
- umount parent/child2
- umount parent
- rm -rf parent
+ EXPECT_PASS umount parent/child2/child2
+ EXPECT_PASS umount parent/child2/child1
+ EXPECT_PASS umount parent/child2
+ EXPECT_PASS umount parent/child2
+ EXPECT_PASS umount parent
+}
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test35: FAILED: rbind: rbind within same tree - root to child, child is private "
- exit 1
-else
- tst_resm TPASS "rbind/test35: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,91 +1,41 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test36} ${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 "***************TEST36***************"
-tst_resm TINFO "rbind: rbind within same tree - root to child, child is uncloneable"
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test36 failed" && tst_exit)
-export result=0
-
+FS_BIND_TESTFUNC=test
-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
-
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "rbind: rbind within same tree - root to child, child is uncloneable"
- "${FS_BIND_ROOT}/bin/makedir" share parent
- "${FS_BIND_ROOT}/bin/makedir" unclone parent/child1
- "${FS_BIND_ROOT}/bin/makedir" share parent/child2
+ fs_bind_makedir rshared parent
+ fs_bind_makedir runbindable parent/child1
+ fs_bind_makedir rshared parent/child2
- mount --rbind "$disk3" parent/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK3" parent/child1
- mount --rbind parent parent/child2/
- check parent parent/child2/
- check -n parent/child1 parent/child2/child1
+ EXPECT_PASS mount --rbind parent parent/child2/
+ fs_bind_check parent parent/child2/
+ fs_bind_check -n parent/child1 parent/child2/child1
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test36: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test36: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent/child1
- check parent/child1 parent/child2/child1
+ EXPECT_PASS umount parent/child1
+ fs_bind_check parent/child1 parent/child2/child1
- mount --rbind "$disk4" parent/child2/child1
- check -n parent/child1 parent/child2/child1
+ EXPECT_PASS mount --rbind "$FS_BIND_DISK4" parent/child2/child1
+ fs_bind_check -n parent/child1 parent/child2/child1
- umount parent/child2/child1
- check parent/child1 parent/child2/child1
+ EXPECT_PASS umount parent/child2/child1
+ fs_bind_check parent/child1 parent/child2/child1
- umount parent/child2/child2
- umount parent/child1
- umount parent/child2
- umount parent/child2
- umount parent
- rm -rf parent
+ EXPECT_PASS umount parent/child2/child2
+ EXPECT_PASS umount parent/child1
+ EXPECT_PASS umount parent/child2
+ EXPECT_PASS umount parent
+}
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test36: FAILED: rbind: rbind within same tree - root to child, child is uncloneable"
- exit 1
-else
- tst_resm TPASS "rbind/test36: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,102 +1,55 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test37} ${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 "***************TEST37***************"
-tst_resm TINFO "rbind: private to private - with shared children."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test37 failed" && tst_exit)
-export result=0
-
+FS_BIND_TESTFUNC=test
-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
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "rbind: private to private - with shared children"
mkdir parent1 parent2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
- "${FS_BIND_ROOT}/bin/makedir" share parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" share parent2/child2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
+ fs_bind_makedir rshared parent1/child1
+ fs_bind_makedir rshared parent2/child2
- mount --bind "$disk1" parent1/child1
- mount --rbind parent1/child1 share1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent1/child1
+ EXPECT_PASS mount --rbind parent1/child1 share1
- mount --rbind parent2/child2 share2
+ EXPECT_PASS mount --rbind parent2/child2 share2
- mount --rbind parent1 parent2
+ EXPECT_PASS mount --rbind parent1 parent2
- check parent1 parent2
- check parent1/child1 parent2/child1
+ fs_bind_check parent1 parent2
+ fs_bind_check parent1/child1 parent2/child1
- mount --bind "$disk2" parent2/child1/a
- check parent1/child1/a parent2/child1/a share1//a
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" parent2/child1/a
+ fs_bind_check parent1/child1/a parent2/child1/a share1//a
- mount --bind "$disk3" parent1/child1/b
- check parent1/child1/b parent2/child1/b share1/b
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent1/child1/b
+ fs_bind_check parent1/child1/b parent2/child1/b share1/b
- mount --bind "$disk4" share1/c
- check parent1/child1/c parent2/child1/c share1/c
+ EXPECT_PASS mount --bind "$FS_BIND_DISK4" share1/c
+ fs_bind_check parent1/child1/c parent2/child1/c share1/c
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test37: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test37: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1/a
- umount parent1/child1/b
- umount share1/c
- umount parent2/child1
- umount parent2/child1
- umount parent1/child1
- umount parent2
- umount share2
- umount share2
- umount share1
- umount share1
- umount parent2/child2
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test37: FAILED: rbind: private to private - with shared children."
- exit 1
-else
- tst_resm TPASS "rbind/test37: PASSED"
- exit 0
-fi
-tst_exit
+ EXPECT_PASS umount parent1/child1/a
+ EXPECT_PASS umount parent1/child1/b
+ EXPECT_PASS umount share1/c
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount parent2/child2
+}
+
+tst_run
@@ -1,101 +1,54 @@
-#!/bin/bash
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test38} ${TST_COUNT=1} ${TST_TOTAL=1}"
-declare -r TCID
-declare -r TST_COUNT
-declare -r TST_TOTAL
-export TCID TST_COUNT TST_TOTAL
+FS_BIND_TESTFUNC=test
-tst_resm TINFO "***************TEST38***************"
-tst_resm TINFO "rbind: private to private - with slave children."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test38 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
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "rbind: private to private - with slave children"
mkdir parent1 parent2 parent1/child1 parent2/child2
- "${FS_BIND_ROOT}/bin/makedir" share share1
- "${FS_BIND_ROOT}/bin/makedir" share share2
- mount --rbind share1 parent1/child1
- mount --rbind share2 parent2/child2
- "${FS_BIND_ROOT}/bin/makedir" slave parent1/child1
- "${FS_BIND_ROOT}/bin/makedir" slave parent2/child2
+ fs_bind_makedir rshared share1
+ fs_bind_makedir rshared share2
+ EXPECT_PASS mount --rbind share1 parent1/child1
+ EXPECT_PASS mount --rbind share2 parent2/child2
+ EXPECT_PASS mount --make-rslave parent1/child1
+ EXPECT_PASS mount --make-rslave parent2/child2
- mount --bind "$disk1" share1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" share1
- mount --rbind parent1 parent2
+ EXPECT_PASS mount --rbind parent1 parent2
- check parent1 parent2
- check parent1/child1 parent2/child1
+ fs_bind_check parent1 parent2
+ fs_bind_check parent1/child1 parent2/child1
- mount --bind "$disk2" share1/a
- check parent1/child1/a parent2/child1/a share1/a
+ EXPECT_PASS mount --bind "$FS_BIND_DISK2" share1/a
+ fs_bind_check parent1/child1/a parent2/child1/a share1/a
- mount --bind "$disk3" parent1/child1/b
- check -n parent1/child1/b share1/b
+ EXPECT_PASS mount --bind "$FS_BIND_DISK3" parent1/child1/b
+ fs_bind_check -n parent1/child1/b share1/b
- mount --bind "$disk4" parent2/child1/c
- check -n parent2/child1/c share1/c
+ EXPECT_PASS mount --bind "$FS_BIND_DISK4" parent2/child1/c
+ fs_bind_check -n parent2/child1/c share1/c
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test38: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test38: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount share1/a
- umount parent1/child1/b
- umount parent2/child1/c
- umount parent1/child1
- umount parent1/child1
- umount parent2/child1
- umount parent2/child1
- umount parent2
- umount share1
- umount share1
- umount share2
- umount parent2/child2
+ EXPECT_PASS umount share1/a
+ EXPECT_PASS umount parent1/child1/b
+ EXPECT_PASS umount parent2/child1/c
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent2/child1
+ EXPECT_PASS umount parent2
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share1
+ EXPECT_PASS umount share2
+ EXPECT_PASS umount parent2/child2
+}
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test38: FAILED: rbind: private to private - with slave children."
- exit 1
-else
- tst_resm TPASS "rbind/test38: PASSED"
- exit 0
-fi
-tst_exit
+tst_run
@@ -1,78 +1,31 @@
-#!/bin/bash
-
-#
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2005
+# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
# 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=test39} ${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 "***************TEST39***************"
-tst_resm TINFO "rbind: private to private - with unclonable children."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of rbind/test39 failed" && tst_exit)
-export result=0
-
+FS_BIND_TESTFUNC=test
-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
+. fs_bind_lib.sh
+test()
+{
+ tst_res TINFO "rbind: private to private - with unclonable children"
mkdir parent1 parent2
- "${FS_BIND_ROOT}/bin/makedir" unclone parent1/child1
+ fs_bind_makedir runbindable parent1/child1
- mount --bind "$disk1" parent1/child1
+ EXPECT_PASS mount --bind "$FS_BIND_DISK1" parent1/child1
- mount --rbind parent1 parent2
+ EXPECT_PASS mount --rbind parent1 parent2
- check parent1 parent2
- check -n parent1/child1 parent2/child1
+ fs_bind_check parent1 parent2
+ fs_bind_check -n parent1/child1 parent2/child1
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "rbind/test39: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "rbind/test39: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount parent1/child1
- umount parent1/child1
- umount parent2
- rm -rf parent* share*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "rbind/test39: FAILED: rbind: private to private - with unclonable children."
- exit 1
-else
- tst_resm TPASS "rbind/test39: PASSED"
- exit 0
-fi
-tst_exit
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent1/child1
+ EXPECT_PASS umount parent2
+}
+
+tst_run
deleted file mode 100644
@@ -1,44 +0,0 @@
-/******************************************************************************/
-/* */
-/* Copyright (c) International Business Machines Corp., 2008 */
-/* */
-/* This program is free software; you can redistribute it and/or modify */
-/* it under the terms of the GNU General Public License as published by */
-/* the Free Software Foundation; either version 2 of the License, or */
-/* (at your option) any later version. */
-/* */
-/* This program 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 General Public License for more details. */
-/* */
-/* You should have received a copy of the GNU General Public License */
-/* along with this program; if not, write to the Free Software */
-/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
-/* */
-/******************************************************************************/
-
-OO_DESCRIPTION.txt
-==================
-
-The contents of the regression directory:
-test01 - bind unshared directory to unshare mountpoint.
-test02 - rbind unshared directory to unshare mountpoint.
-test03 - move unshared directory to unshare mountpoint.
-
-
-test01:
-=======
-bind unshared directory to unshare mountpoint.
-
-
-test02:
-=======
-rbind unshared directory to unshare mountpoint.
-
-
-test03:
-=======
-move unshared directory to unshare mountpoint.
-
-
deleted file mode 100755
@@ -1,71 +0,0 @@
-#!/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=test01} ${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 "***************TEST01***************"
-tst_resm TINFO "regression: bind unshared directory to unshare mountpoint."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of regression/test01 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 dir
- mount --bind "$disk1" dir
- check "$disk1" dir
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "regression/test01: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "regression/test01: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount dir
-
- rm -rf dir
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "regression/test01: FAILED: regression: bind unshared directory to unshare mountpoint."
- exit 1
-else
- tst_resm TPASS "regression/test01: PASSED"
- exit 0
-fi
-tst_exit
deleted file mode 100755
@@ -1,78 +0,0 @@
-#!/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=test02} ${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 "***************TEST02***************"
-tst_resm TINFO "regression: rbind unshared directory to unshare mountpoint."
-tst_resm TINFO "************************************"
-
-. "${FS_BIND_ROOT}/bin/setup" || (tst_resm TWARN "Setup of regression/test02 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 --rbind dir1 dir2
-
- check dir1/a dir2/a
-
- break
-done
-trap 'ERR=$? ; tst_resm TWARN "regression/test02: caught error near: ${BASH_SOURCE[0]}:${FUNCNAME[0]}:${LINENO}:$_ (returned ${ERR})"' ERR
-if [ -n "${ERR_MSG}" ]; then
- tst_resm TWARN "regression/test02: ${ERR_MSG}"
- ERR_MSG=""
- result=$ERR
-fi
-trap '' ERR
-{
- umount dir1/a
- umount dir2/a
- umount dir2
- umount dir1
-
- rm -rf dir*
- cleanup
-} >& /dev/null
-if [ $result -ne 0 ]
-then
- tst_resm TFAIL "regression/test02: FAILED: regression: rbind unshared directory to unshare mountpoint."
- exit 1
-else
- tst_resm TPASS "regression/test02: PASSED"
- exit 0
-fi
-tst_exit
deleted file mode 100755
@@ -1,77 +0,0 @@
-#!/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
deleted file mode 100755
@@ -1,526 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright (c) International Business Machines Corp., 2005
-# Authors: Avantika Mathur (mathurav@us.ibm.com)
-# Matt Helsley (matthltc@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
-#
-
-if tst_kvcmp -lt "2.6.15"; then
- tst_resm TCONF "System kernel version is less than 2.6.15"
- tst_resm TCONF "Cannot execute test"
- exit 0
-fi
-
-test_setup()
-{
- #######################################################################
- ## Configure
- #######################################################################
- dopts='-dEBb'
-
- ## Remove logged test state depending on results. 0 means do not remove,
- ## 1 means OK to remove.
- # rm saved state from tests that appear to have cleaned up properly?
- rm_ok=1
- # rm saved state from tests that don't appear to have fully cleaned up?
- rm_err=0
-
- #######################################################################
- ## Initialize some variables
- #######################################################################
- TCID="$0"
- TST_COUNT=0
-
- test_dirs=( move bind rbind regression ) #cloneNS
- nfailed=0
- nsucceeded=0
-
- # set the LTPROOT directory
- cd `dirname $0`
- LTPROOT="${PWD}"
- echo "${LTPROOT}" | grep testscripts > /dev/null 2>&1
- if [ $? -eq 0 ]; then
- cd ..
- LTPROOT="${PWD}"
- fi
-
- FS_BIND_ROOT="${LTPROOT}/testcases/bin/fs_bind"
-
- total=0 # total number of tests
- for dir in "${test_dirs[@]}" ; do
- ((total += `ls "${FS_BIND_ROOT}/${dir}/"*.sh | wc -l`))
- done
- TST_TOTAL=${total}
-
- # set the PATH to include testcases/bin
- LTPBIN="${LTPROOT}/testcases/bin"
- PATH="${PATH}:/usr/sbin:${LTPBIN}:${FS_BIND_ROOT}/bin"
-
- # Results directory
- resdir="${LTPROOT}/results/fs_bind"
- if [ ! -d "${resdir}" ]; then
- mkdir -p "${resdir}" 2> /dev/null
- fi
-
- TMPDIR="${TMPDIR:-/tmp}"
- # A temporary directory where we can do stuff and that is
- # safe to remove
- sandbox="${TMPDIR}/sandbox"
-
- ERR_MSG=""
-
- export LTPBIN PATH FS_BIND_ROOT ERR_MSG TCID TST_COUNT TST_TOTAL
-
- if [ ! -d "${resdir}" ]; then
- tst_brkm TBROK true "$0: failed to make results directory"
- exit 1
- fi
-}
-
-test_prereqs()
-{
- # Must be root to run the containers testsuite
- if [ $UID != 0 ]; then
- tst_brkm TBROK true "FAILED: Must be root to execute this script"
- exit 1
- fi
-
- mkdir "${sandbox}" >& /dev/null
- if [ ! -d "${sandbox}" -o ! -x "${sandbox}" ]; then
- tst_brkm TBROK true "$0: failed to make directory \"${sandbox}\""
- exit -1
- fi
-
- mount --bind "${sandbox}" "${sandbox}" >& /dev/null
- if [ $? -ne 0 ]; then
- tst_brkm TBROK true "$0: failed to perform bind mount on directory \"${sandbox}\""
- exit 1
- fi
-
- mount --make-private "${sandbox}" >& /dev/null
- if [ $? -ne 0 ]; then
- tst_brkm TBROK true "$0: failed to make private mountpoint on directory \"${sandbox}\""
- exit 1
- fi
-
- local mnt_bind=1
- local mnt_move=1
-
- pushd "${sandbox}" > /dev/null && {
- mkdir bind_test move_test && {
- mount --bind bind_test bind_test && {
- mnt_bind=0
- mount --move bind_test move_test && {
- mnt_move=0
- umount move_test
- } || {
- # bind mount succeeded but move mount
- # failed
- umount bind_test
- }
- } || {
- # mount failed -- check if it's because we
- # don't have privileges we need
- if [ $? -eq 32 ]; then
- tst_brkm TBROK true "$0 requires the privilege to use the mount command"
- exit 32
- fi
- }
- rmdir bind_test move_test
- }
- popd > /dev/null
- }
-
- if [ ${mnt_bind} -eq 1 -o ${mnt_move} -eq 1 ]; then
- tst_brkm TBROK true "$0: requires that mount support the --bind and --move options"
- exit 1
- fi
-
- if tst_kvcmp -lt "2.6.15"; then
- tst_resm TWARN "$0: the remaining tests require 2.6.15 or later"
- tst_exit 0
- exit
- else
- tst_resm TINFO "$0: kernel >= 2.6.15 detected -- continuing"
- fi
-
- mount --make-shared "${sandbox}" > /dev/null 2>&1 || "${FS_BIND_ROOT}/bin/smount" "${sandbox}" shared
- umount "${sandbox}" || {
- tst_resm TFAIL "$0: failed to umount simplest shared subtree"
- exit 1
- }
- tst_resm TPASS "$0: umounted simplest shared subtree"
-
-}
-
-# mounts we are concerned with in a well-defined order (helps diff)
-# returns grep return codes
-grep_proc_mounts()
-{
- local rc=0
-
- # Save the pipefail shell option
- shopt -o -q pipefail
- local save=$?
- set -o pipefail
-
- # Grep /proc/mounts which is often more up-to-date than mounts
- # We use pipefail because if the grep fails we want to pass that along
- grep -F "${sandbox}" /proc/mounts | sort -b
- rc=$?
-
- # Restore the pipefail shell options
- [ $save -eq 0 ] && shopt -o -s pipefail || shopt -o -u pipefail
-
- return $rc
-}
-
-# Record the mount state
-save_proc_mounts()
-{
- touch "$2/proc_mounts.before" >& /dev/null
- if [ $? -ne 0 ]; then
- tst_brkm TBROK true "$1: failed to record proc mounts"
- return 1
- fi
-
- grep_proc_mounts 2> /dev/null > "$2/proc_mounts.before"
- return 0
-}
-
-# Compare mount list after the test with the list from before.
-# If there are no differences then remove the before list and silently
-# return 0. Else print the differences to stderr and return 1.
-check_proc_mounts()
-{
- local tname="$1"
-
- if [ ! -r "$2/proc_mounts.before" ]; then
- tst_brkm TBROK true "${tname}: Could not find pre-test proc mount list"
- return 1
- fi
-
- grep_proc_mounts 2> /dev/null > "$2/proc_mounts.after"
- # If the mounts are the same then just return
- diff ${dopts} -q "$2/proc_mounts.before" "$2/proc_mounts.after" >& /dev/null
- if [ $? -eq 0 ]; then
- [ $rm_ok -eq 1 ] && rm -f "$2/proc_mounts."{before,after}
- return 0
- fi
-
- tst_resm TWARN "${tname}: did not properly clean up its proc mounts"
- diff ${dopts} -U 0 "$2/proc_mounts.before" "$2/proc_mounts.after" | grep -vE '^\@\@' 1>&2
- [ $rm_err -eq 1 ] && rm -f "$2/proc_mounts."{before,after}
- return 1
-}
-
-# Undo leftover mounts
-restore_proc_mounts()
-{
- #local tname="$1"
-
- # do lazy umounts -- we're assuming that tests will only leave
- # new mounts around and will never remove mounts outside the test
- # directory
- ( while grep_proc_mounts ; do
- grep_proc_mounts | awk '{print $2}' | xargs -r -n 1 umount -l
- done ) >& /dev/null
-
- # mount list and exit with 0
- [ $rm_err -eq 1 ] && rm -f "$2/proc_mounts."{before,after} 1>&2 # >& /dev/null
- return 0
- # if returning error do this:
- # tst_brkm TBROK true "${tname}: failed to restore mounts"
-}
-
-# mounts we are concerned with in a well-defined order (helps diff)
-# returns grep return codes
-grep_mounts()
-{
- local rc=0
-
- # Save the pipefail shell option
- shopt -o -q pipefail
- local save=$?
- set -o pipefail
-
- # Grep mount command output (which tends to come from /etc/mtab)
- # We use pipefail because if the grep fails we want to pass that along
- mount | grep -F "${sandbox}" | sort -b
- rc=$?
-
- # Restore the pipefail shell options
- [ $save -eq 0 ] && shopt -o -s pipefail || shopt -o -u pipefail
-
- return $rc
-}
-
-# Record the mount state
-save_mounts()
-{
- touch "$2/mtab.before" >& /dev/null
- if [ $? -ne 0 ]; then
- tst_brkm TBROK true "$1: failed to record mtab mounts"
- return 1
- fi
-
- grep_mounts 2> /dev/null > "$2/mtab.before"
- return 0
-}
-
-# Compare mount list after the test with the list from before.
-# If there are no differences then remove the before list and silently
-# return 0. Else print the differences to stderr and return 1.
-check_mounts()
-{
- local tname="$1"
-
- if [ ! -r "$2/mtab.before" ]; then
- tst_brkm TBROK true "${tname}: Could not find pre-test mtab mount list"
- return 1
- fi
-
- grep_mounts 2> /dev/null > "$2/mtab.after"
- # If the mounts are the same then just return
- diff ${dopts} -q "$2/mtab.before" "$2/mtab.after" >& /dev/null
- if [ $? -eq 0 ]; then
- [ $rm_ok -eq 1 ] && rm -f "$2/mtab."{before,after}
- return 0
- fi
-
- tst_resm TWARN "${tname}: did not properly clean up its mtab mounts"
- diff ${dopts} -U 0 "$2/mtab.before" "$2/mtab.after" | grep -vE '^\@\@' 1>&2
- [ $rm_err -eq 1 ] && rm -f "$2/mtab."{before,after}
- return 1
-}
-
-# Undo leftover mounts
-restore_mounts()
-{
- #local tname="$1"
-
- # do lazy umounts -- we're assuming that tests will only leave
- # new mounts around and will never remove mounts outside the test
- # directory
- ( while grep_mounts ; do
- grep_mounts | awk '{print $3}' | xargs -r -n 1 umount -l
- done ) >& /dev/null
-
- # mount list and exit with 0
- [ $rm_err -eq 1 ] && rm -f "$2/mtab."{before,after} 1>&2 # >& /dev/null
- return 0
- # if returning error do this:
- # tst_brkm TBROK true "${tname}: failed to restore mounts"
-}
-
-# Record the sandbox state
-# We don't save full sandbox state -- just the names of files and dirs present
-save_sandbox()
-{
- local when="before"
- local tname="$1"
-
- if [ -e "$2/files.before" ]; then
- if [ -e "$2/files.after" ]; then
- tst_brkm TBROK true "${tname}: stale catalog of \"${sandbox}\""
- return 1
- fi
- when="after"
- fi
-
- ( find "${sandbox}" -type d -print | sort > "$2/dirs.$when"
- find "${sandbox}" -type f -print | sort | \
- grep -vE '^'"$2"'/(dirs|files)\.(before|after)$' > "$2/files.$when" ) >& /dev/null
- return 0
-}
-
-# Save sandbox after test and then compare. If the sandbox state is not
-# clean then print the differences to stderr and return 1. Else remove all
-# saved sandbox state and silently return 0
-check_sandbox()
-{
- local tname="$1"
-
- if [ ! -r "$2/files.before" -o ! -r "$2/dirs.before" ]; then
- tst_brkm TBROK true "${tname} missing saved catalog of \"${sandbox}\""
- return 1
- fi
-
- save_sandbox "${tname} (check)" "$2"
-
- ( diff ${dopts} -q "$2/dirs.before" "$2/dirs.after" && \
- diff ${dopts} -q "$2/files.before" "$2/files.after" ) >& /dev/null \
- && {
- [ $rm_ok -eq 1 ] && rm -f "$2/"{files,dirs}.{before,after}
- return 0
- }
-
- tst_resm TWARN "${tname} did not properly clean up \"${sandbox}\""
- diff ${dopts} -U 0 "$2/dirs.before" "$2/dirs.after" 1>&2
- diff ${dopts} -U 0 "$2/files.before" "$2/files.after" 1>&2
- [ $rm_err -eq 1 ] && rm -f "$2/"{files,dirs}.{before,after} 1>&2
- return 1
-}
-
-# Robust sandbox cleanup
-clean_sandbox()
-{
- local tname="$1"
-
- { rm -rf "${sandbox}" ; mkdir "${sandbox}" ; } >& /dev/null
- if [ ! -d "${sandbox}" -o ! -x "${sandbox}" ]; then
- tst_brkm TBROK true "$tname: failed to make directory \"${sandbox}\""
- return 1
- fi
- return 0
-}
-
-# Check file for non-whitespace chars
-is_file_empty()
-{
- awk '/^[[:space:]]*$/ { next }
- { exit 1; }' < "$1"
-}
-
-#
-# Run the specified test script.
-#
-# Return 1 if the test was broken but should not stop the remaining test
-# categories from being run.
-# Return 2 if the test was broken and no further tests should be run.
-# Return 0 otherwise (if the test was broken but it shouldn't affect other
-# test runs)
-# Note that this means the return status is not the success or failure of the
-# test itself.
-#
-run_test()
-{
- local t="$1"
- local tname="$(basename "$(dirname "$t")")/$(basename "$t")"
- local log="$resdir/$tname/log"
- local errlog="$resdir/$tname/err"
- local do_break=0
-
- ERR_MSG=""
-
- # Pre-test
- mkdir -p "$resdir/$tname"
- if [ ! -d "$resdir/$tname" -o ! -x "$resdir/$tname" ]; then
- tst_brkm TBROK true "$0: can't make or use \"$resdir/$tname\" as a log directory"
- return 1
- fi
-
- save_sandbox "$tname" "$resdir/$tname" || do_break=1
- save_mounts "$tname" "$resdir/$tname" || do_break=1
- save_proc_mounts "$tname" "$resdir/$tname" || do_break=1
- mount --bind "${sandbox}" "${sandbox}" >& /dev/null || do_break=1
- mount --make-private "${sandbox}" >& /dev/null || do_break=1
-
- if [ $do_break -eq 1 ]; then
- umount -l "${sandbox}" >& /dev/null
- tst_brkm TBROK true "$tname: failed to save pre-test state of \"${sandbox}\""
- return 2
- fi
- pushd "${sandbox}" > /dev/null
-
- # Run the test
- (
- TCID="$tname"
- declare -r TST_COUNT
- export LTPBIN PATH FS_BIND_ROOT ERR_MSG TCID TST_COUNT TST_TOTAL
- "$t" #> "$log" 2> "$errlog"
- )
- local rc=$?
- TCID="$0"
-
- # Post-test
- popd > /dev/null
- if [ $rc -ne 0 ]; then
- #echo "FAILED"
- ((nfailed++))
- else
- #echo "SUCCEEDED"
- ((nsucceeded++))
- fi
- umount -l "${sandbox}" >& /dev/null
- check_proc_mounts "$tname" "$resdir/$tname" || \
- restore_proc_mounts "$tname" "$resdir/$tname" || do_break=1
- check_mounts "$tname" "$resdir/$tname" || \
- restore_mounts "$tname" "$resdir/$tname" || do_break=1
- check_sandbox "$tname" "$resdir/$tname"
- clean_sandbox "$tname" || do_break=1
- if [ $do_break -eq 1 ]; then
- tst_brkm TBROK true "$tname: failed to restore pre-test state of \"${sandbox}\""
- return 2
- fi
-
- # If we succeeded and the error log is empty remove it
- if [ $rc -eq 0 -a -w "$errlog" ] && is_file_empty "$errlog" ; then
- rm -f "$errlog"
- fi
- return 0
-}
-
-main()
-{
- TST_COUNT=1
- for dir in "${test_dirs[@]}" ; do
- tests=( $(find "${FS_BIND_ROOT}/${dir}" -type f -name '*.sh') )
- clean_sandbox "$0" || break
- for t in "${tests[@]}" ; do
- run_test "$t"
- local rc=$?
-
- if [ $rc -ne 0 ]; then
- break $rc
- fi
-
- ((TST_COUNT++))
- done
- done
- rm -rf "${sandbox}"
- return 0
-
- skipped=$((total - nsucceeded - nfailed))
- if [ $nfailed -eq 0 -a $skipped -eq 0 ]; then
- # Use PASSED for the summary rather than SUCCEEDED to make it
- # easy to determine 100% success from a calling script
- summary="PASSED"
- else
- # Use FAILED to make it easy to find > 0% failure from a
- # calling script
- summary="FAILED"
- fi
- cat - <<-EOF
- *********************************
- RESULTS SUMMARY:
-
- passed: $nsucceeded/$total
- failed: $nfailed/$total
- skipped: $skipped/$total
- summary: $summary
-
- *********************************
- EOF
-}
-
-test_setup || exit 1
-test_prereqs || exit 1
-declare -r FS_BIND_ROOT
-declare -r TST_TOTAL
-main #2> "$resdir/errors" 1> "$resdir/summary"