FS/XFS testing framework
 help / color / mirror / Atom feed
From: "zhangyi (F)" <yi.zhang@huawei.com>
To: fstests@vger.kernel.org
Cc: eguan@redhat.com, linux-unionfs@vger.kernel.org,
	miklos@szeredi.hu, amir73il@gmail.com, yi.zhang@huawei.com,
	miaoxie@huawei.com
Subject: [xfstest PATCH V2 1/2] overlay/031: factor out _create_whiteout() helper
Date: Fri, 30 Jun 2017 11:20:10 +0800	[thread overview]
Message-ID: <1498792811-17311-2-git-send-email-yi.zhang@huawei.com> (raw)
In-Reply-To: <1498792811-17311-1-git-send-email-yi.zhang@huawei.com>

Factor out helper for create an leftover whiteout,
this is common to repeat test of whiteout check in
different underlaying directories.

Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
---
 tests/overlay/031 | 38 +++++++++++++++++++++++---------------
 1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/tests/overlay/031 b/tests/overlay/031
index 674c11f..cb29ee5 100755
--- a/tests/overlay/031
+++ b/tests/overlay/031
@@ -38,6 +38,20 @@ _cleanup()
 	rm -f $tmp.*
 }
 
+# create test directory and test file, mount overlayfs and remove
+# testfile to create a whiteout in upper dir.
+_create_whiteout()
+{
+	mkdir -p $1/testdir
+	touch $1/testdir/$4
+
+	_overlay_mount_dirs $1 $2 $3 $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT
+
+	rm -f $SCRATCH_MNT/testdir/$4
+
+	$UMOUNT_PROG $SCRATCH_MNT
+}
+
 # get standard environment, filters and checks
 . ./common/rc
 . ./common/filter
@@ -52,26 +66,20 @@ _require_scratch
 # remove all files from previous runs
 _scratch_mkfs
 
-# create test directory and test file
-lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
-upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
-workdir=$OVL_BASE_SCRATCH_MNT/$OVL_WORK
-mkdir -p $lowerdir/testdir
-touch $lowerdir/testdir/a
-
-# mount overlayfs and remove testfile to create a whiteout
-_scratch_mount
+# create test directorys and whiteout
+lowerdir=$OVL_BASE_SCRATCH_MNT/lower
+upperdir=$OVL_BASE_SCRATCH_MNT/upper
+workdir=$OVL_BASE_SCRATCH_MNT/workdir
+testfile=a
+mkdir -p $lowerdir $upperdir $workdir
 
-rm -f $SCRATCH_MNT/testdir/a
-
-# unmount overlayfs but not base fs
-$UMOUNT_PROG $SCRATCH_MNT
+_create_whiteout $lowerdir $upperdir $workdir $testfile
 
 # clean up the lower directory and mount overlay again,
 # whiteout will expose.
 rm -rf $lowerdir/testdir
 
-_scratch_mount
+_overlay_mount_dirs $lowerdir $upperdir $workdir $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT
 
 ls $SCRATCH_MNT/testdir
 
@@ -84,7 +92,7 @@ rm -rf $SCRATCH_MNT/testdir 2>&1 | _filter_scratch
 $UMOUNT_PROG $SCRATCH_MNT
 touch $lowerdir/testdir
 
-_scratch_mount
+_overlay_mount_dirs $lowerdir $upperdir $workdir $OVL_BASE_SCRATCH_MNT $SCRATCH_MNT
 
 # try to remove test dir from overlay dir, trigger ovl_remove_and_whiteout,
 # it will not clean up the dir and lead to residue.
-- 
2.5.0


  reply	other threads:[~2017-06-30  3:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30  3:20 [xfstest PATCH V2 0/2] overlay/031: add two tests of whiteout check in origin dir zhangyi (F)
2017-06-30  3:20 ` zhangyi (F) [this message]
2017-06-30 14:28   ` [xfstest PATCH V2 1/2] overlay/031: factor out _create_whiteout() helper Amir Goldstein
2017-06-30  3:20 ` [xfstest PATCH V2 2/2] overlay/031: add tests of whiteouts in lowerdir and both dirs zhangyi (F)
2017-06-30 14:28   ` Amir Goldstein
2017-07-03  1:42     ` zhangyi (F)
2017-07-03  6:41       ` Amir Goldstein
2017-07-03  8:10         ` zhangyi (F)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1498792811-17311-2-git-send-email-yi.zhang@huawei.com \
    --to=yi.zhang@huawei.com \
    --cc=amir73il@gmail.com \
    --cc=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miaoxie@huawei.com \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox