public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] test multi-level bind and shared subtree mounts
@ 2017-02-14  0:55 Theodore Ts'o
  2017-02-14  0:55 ` [PATCH 1/4] common/rc: new functions for multi-level mount/umount operations Theodore Ts'o
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Theodore Ts'o @ 2017-02-14  0:55 UTC (permalink / raw)
  To: fstests; +Cc: Zorro Lang, Theodore Ts'o

This is a respon if of Zorro Lang's patch set from May 20, 2016.  I've
reviewed them, and tested them against a recent development kernel.

The two main changes which I made to Zorro's patches:

  * I changed the numbers to the most recent unallocated test numbers
  * I added code to delete the test files in the end_test function

Zorro Lang (4):
  common/rc: new functions for multi-level mount/umount operations
  generic: new case for test mount bind operation
  generic: new case for test mount shared subtrees state transition
  generic: new case test two vfsmount no peers

 common/rc             |  31 ++
 tests/generic/409     | 182 +++++++++++
 tests/generic/409.out | 365 ++++++++++++++++++++++
 tests/generic/410     | 215 +++++++++++++
 tests/generic/410.out | 813 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/411     | 147 +++++++++
 tests/generic/411.out |  12 +
 tests/generic/group   |   3 +
 8 files changed, 1768 insertions(+)
 create mode 100644 tests/generic/409
 create mode 100644 tests/generic/409.out
 create mode 100644 tests/generic/410
 create mode 100644 tests/generic/410.out
 create mode 100644 tests/generic/411
 create mode 100644 tests/generic/411.out

-- 
2.11.0.rc0.7.gbe5a750


^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH 1/4] common/rc: new functions for multi-level mount/umount operations
@ 2016-05-20 14:00 Zorro Lang
  0 siblings, 0 replies; 9+ messages in thread
From: Zorro Lang @ 2016-05-20 14:00 UTC (permalink / raw)
  To: fstests; +Cc: Zorro Lang

When I try to write cases about mount shared subtrees test, I find
I always need to do many mount operations, then then umount those
mount point one by one.

For make the code clear, I use a stack to save mounted points
sequentially, then I write 3 common functions to operate this
stack.

1. The global stack named MOUNTED_POINT_STACK
2. _get_mount() accept mount parameters likes _mount(), but the
   mountpoint parameter must be the last one. It will run the
   mount operation and push the mountpoint name into stack.
3. _put_mount() don't need any parameters. It will pull the newest
   mountpoint name from the stack, and umount it.
4. _clear_mount_stack() don't need any parameters either. It will
   umount all mountpoints in the stack sequentially, and set
   MOUNTED_POINT_STACK=""

Generally, the _clear_mount_stack() function also can be used as
_init_mount_stack() at the beginning of a case. Because it will
prepare an empty stack.

Signed-off-by: Zorro Lang <zlang@redhat.com>
---

Hi,

I just wrote 4 patches for cover mount shared subtree test:

0001-common-rc-new-functions-for-multi-level-mount-umount.patch
0002-generic-353-new-case-for-test-mount-bind-operation.patch
0003-generic-354-new-case-for-test-mount-shared-subtrees-.patch
0004-generic-355-new-case-test-two-vfsmount-no-peers.patch

Due to I have sent two patches which taken generic/352(not reviewed),
so above new cases named from generic/353 to 355.

I will write more cases about mount shared subtrees feature, after
above 4 patches can be review and merged.

Thanks,
Zorro

 common/rc | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/common/rc b/common/rc
index 9c532cc..c0fec02 100644
--- a/common/rc
+++ b/common/rc
@@ -162,6 +162,37 @@ _mount()
     $MOUNT_PROG `_mount_ops_filter $*`
 }
 
+# the mount point must be the last parameter
+_get_mount()
+{
+    local mnt_point=${!#}
+
+    _mount $*
+    if [ $? -eq 0 ];then
+	MOUNTED_POINT_STACK=`echo "$mnt_point $MOUNTED_POINT_STACK"`
+    else
+	return 1
+    fi
+}
+
+_put_mount()
+{
+    local last_mnt=`echo $MOUNTED_POINT_STACK | awk '{print $1}'`
+
+    if [ -n "$last_mnt" ];then
+	umount $last_mnt
+    fi
+    MOUNTED_POINT_STACK=`echo $MOUNTED_POINT_STACK | cut -d\  -f2-`
+}
+
+_clear_mount_stack()
+{
+    if [ -n "$MOUNTED_POINT_STACK" ];then
+	umount $MOUNTED_POINT_STACK
+    fi
+    MOUNTED_POINT_STACK=""
+}
+
 _scratch_options()
 {
     type=$1
-- 
2.5.5


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-02-15  9:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-14  0:55 [PATCH 0/4] test multi-level bind and shared subtree mounts Theodore Ts'o
2017-02-14  0:55 ` [PATCH 1/4] common/rc: new functions for multi-level mount/umount operations Theodore Ts'o
2017-02-14  0:55 ` [PATCH 2/4] generic: new case for test mount bind operation Theodore Ts'o
2017-02-15  9:53   ` Eryu Guan
2017-02-14  0:55 ` [PATCH 3/4] generic: new case for test mount shared subtrees state transition Theodore Ts'o
2017-02-14  0:55 ` [PATCH 4/4] generic: new case test two vfsmount no peers Theodore Ts'o
2017-02-14  2:28 ` [PATCH 0/4] test multi-level bind and shared subtree mounts Zorro Lang
2017-02-15  9:46 ` Eryu Guan
  -- strict thread matches above, loose matches on Subject: below --
2016-05-20 14:00 [PATCH 1/4] common/rc: new functions for multi-level mount/umount operations Zorro Lang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox