All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Tmpfs support and fixes for tmpfs/nfs
@ 2013-05-02 14:03 ranto.boris
  2013-05-02 14:03 ` [PATCH 1/3] xfstests: Add tmpfs support ranto.boris
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ranto.boris @ 2013-05-02 14:03 UTC (permalink / raw)
  To: xfs

Hi all,

This series contains three patches related to support of tmpfs file system in xfstests.

First patch provides the support itself. Second patch fixes a regression where ./check -nfs -n -g auto stopped working for nfs (and tmpfs) and the last patch changes the failure on empty exclude group to warning to simplify automated testing.

Regards,
Boris

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* [PATCH 1/3] xfstests: Add tmpfs support
  2013-05-02 14:03 [PATCH 0/3] Tmpfs support and fixes for tmpfs/nfs ranto.boris
@ 2013-05-02 14:03 ` ranto.boris
  2013-05-02 14:03 ` [PATCH 2/3] xfstests: Do not fail on non-existing tests/FSTYP directory ranto.boris
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ranto.boris @ 2013-05-02 14:03 UTC (permalink / raw)
  To: xfs; +Cc: Boris Ranto

From: Boris Ranto <ranto.boris@gmail.com>

This is just a simple patch to get the tmpfs working as a target file
system. The patch copies the way nfs is handled in xfstests.

I didn't change the xfstests logic to recognize a proper SCRATCH_DEV.
Hence, the SCRATCH_DEV for tmpfs should be in nfs form (with ':' sign
in it) in order for this to work properly.

Signed-off-by: Boris Ranto <ranto.boris@gmail.com>
---
 check     |    2 ++
 common/rc |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/check b/check
index 966fbe5..fc335ec 100755
--- a/check
+++ b/check
@@ -76,6 +76,7 @@ check options
     -xfs                test XFS (default)
     -udf                test UDF
     -nfs                test NFS
+    -tmpfs              test TMPFS
     -l			line mode diff
     -udiff		show unified diff (default)
     -n			show me, do not run tests
@@ -162,6 +163,7 @@ while [ $# -gt 0 ]; do
 	-udf)	FSTYP=udf ;;
 	-xfs)	FSTYP=xfs ;;
 	-nfs)	FSTYP=nfs ;;
+	-tmpfs)	FSTYP=tmpfs ;;
 
 	-g)	group=$2 ; shift ;
 		group_list=$(get_group_list $group)
diff --git a/common/rc b/common/rc
index 8e37368..4825371 100644
--- a/common/rc
+++ b/common/rc
@@ -97,6 +97,10 @@ _mount_opts()
 	# acls aren't turned on by default on gfs2
 	export MOUNT_OPTIONS="-o acl $GFS2_MOUNT_OPTIONS"
 	;;
+    tmpfs)
+	# We need to specify the size at mount, use 512 MB by default
+	export MOUNT_OPTIONS="-o size=512M $TMPFS_MOUNT_OPTIONS"
+	;;
     *)
 	;;
     esac
@@ -125,6 +129,9 @@ _mkfs_opts()
     jfs)
 	export MKFS_OPTIONS="$JFS_MKFS_OPTIONS -q"
 	;;
+    tmpfs)
+	export MKFS_OPTIONS="$TMPFS_MKFS_OPTIONS"
+	;;
     *)
 	;;
     esac
@@ -520,6 +527,9 @@ _scratch_mkfs()
     ext4)
 	_scratch_mkfs_ext4 $*
 	;;
+    tmpfs)
+	# do nothing for tmpfs
+	;;
     *)
 	yes | $MKFS_PROG -t $FSTYP -- $MKFS_OPTIONS $* $SCRATCH_DEV
 	;;
@@ -930,6 +940,12 @@ _require_scratch()
 		     _notrun "this test requires a valid \$SCRATCH_DEV"
 		 fi
 		 ;;
+	tmpfs)
+		if [ -z "$SCRATCH_DEV" -o ! -d "$SCRATCH_MNT" ];
+		then
+		    _notrun "this test requires a valid \$SCRATCH_MNT and unique $SCRATCH_DEV"
+		fi
+		;;
 	*)
 		 if [ -z "$SCRATCH_DEV" -o "`_is_block_dev $SCRATCH_DEV`" = "" ]
 		 then
@@ -1626,6 +1642,9 @@ _check_test_fs()
     btrfs)
 	_check_btrfs_filesystem $TEST_DEV
 	;;
+    tmpfs)
+	# no way to check the consistency of tmpfs
+	;;
     *)
 	_check_generic_filesystem $TEST_DEV
 	;;
@@ -1655,6 +1674,9 @@ _check_scratch_fs()
     btrfs)
 	_check_btrfs_filesystem $SCRATCH_DEV
 	;;
+    tmpfs)
+	# No way to check the consistency of tmpfs
+	;;
     *)
 	_check_generic_filesystem $SCRATCH_DEV
 	;;
@@ -1743,6 +1765,32 @@ _setup_nfs_scratchdir()
     testdir=$SCRATCH_MNT
 }
 
+_setup_tmpfs_scratchdir()
+{
+    [ "$FSTYP" != "tmpfs" ] \
+        && _fail "setup_tmpfs_testdir: \$FSTYP is not tmpfs"
+    [ -z "$SCRATCH_DEV" ] \
+	&& _notrun "this test requires a valid host fs for \$SCRATCH_DEV"
+    [ -z "$SCRATCH_MNT" ] \
+	&& _notrun "this test requires a valid \$SCRATCH_MNT"
+
+    # mounted?
+    if _mount | grep -q $SCRATCH_DEV
+    then
+        # if it's mounted, make sure its on $SCRATCH_MNT
+        if ! _mount | grep $SCRATCH_DEV | grep -q $SCRATCH_MNT
+        then
+            _fail "\$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT - aborting"
+        fi
+        $UMOUNT_PROG $SCRATCH_DEV
+    fi
+
+    _scratch_mkfs
+    _scratch_mount
+
+    testdir=$SCRATCH_MNT
+}
+
 #
 # Warning for UDF and NFS:
 # this function calls _setup_udf_scratchdir and _setup_udf_scratchdir
@@ -1761,6 +1809,9 @@ _setup_testdir()
     nfs*)
 	_setup_nfs_scratchdir
 	;;
+    tmpfs)
+	_setup_tmpfs_scratchdir
+	;;
     *)
 	testdir=$TEST_DIR
 	;;
@@ -1778,6 +1829,10 @@ _cleanup_testdir()
 	# umount testdir as it is $SCRATCH_MNT which could be used by xfs next
 	[ -n "$testdir" ] && $UMOUNT_PROG $testdir
 	;;
+    tmpfs)
+	# umount testdir since it is actually a scrath mount
+	[ -n "$testdir" ] && $UMOUNT_PROG $testdir
+	;;
     *)
 	# do nothing, testdir is $TEST_DIR
 	:
-- 
1.7.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* [PATCH 2/3] xfstests: Do not fail on non-existing tests/FSTYP directory
  2013-05-02 14:03 [PATCH 0/3] Tmpfs support and fixes for tmpfs/nfs ranto.boris
  2013-05-02 14:03 ` [PATCH 1/3] xfstests: Add tmpfs support ranto.boris
@ 2013-05-02 14:03 ` ranto.boris
  2013-05-02 14:03 ` [PATCH 3/3] xfstests: Do not fail on empty exclude groups ranto.boris
  2013-05-13 12:57 ` [PATCH 0/3] Tmpfs support and fixes for tmpfs/nfs Boris Ranto
  3 siblings, 0 replies; 5+ messages in thread
From: ranto.boris @ 2013-05-02 14:03 UTC (permalink / raw)
  To: xfs; +Cc: Boris Ranto

From: Boris Ranto <ranto.boris@gmail.com>

Currently, if a user runs ./check -n to get the list of tests to run on
a file system such as nfs or tmpfs, then the ./check script will fail
since there are no tests/nfs and tests/tmpfs subdirectories (and hence,
no group files and no specific tests for the directories). This patch
will conditionally add FSTYP to SRC_GROUPS and remove all further
additions of FSTYP to the variable.

Signed-off-by: Boris Ranto <ranto.boris@gmail.com>
---
 check |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/check b/check
index fc335ec..4af2dbd 100755
--- a/check
+++ b/check
@@ -64,7 +64,12 @@ fi
 export FSTYP
 
 SUPPORTED_TESTS="[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]"
-SRC_GROUPS="generic shared"
+# Include FSTYP to SRC_GROUPS if a directory for it exists
+if [ -d $SRC_DIR/$d ]; then
+	SRC_GROUPS="generic shared $FSTYP"
+else
+	SRC_GROUPS="generic shared"
+fi
 export SRC_DIR="tests"
 export RESULT_BASE=${RESULT_BASE:="$here/results"}
 
@@ -97,7 +102,7 @@ get_group_list()
 {
 	grp=$1
 
-	for d in $SRC_GROUPS $FSTYP; do
+	for d in $SRC_GROUPS; do
 		l=$(sed -n < $SRC_DIR/$d/group \
 			-e 's/#.*//' \
 			-e 's/$/ /' \
@@ -113,7 +118,7 @@ get_group_list()
 get_all_tests()
 {
 	touch $tmp.list
-	for d in $SRC_GROUPS $FSTYP; do
+	for d in $SRC_GROUPS; do
 		ls $SRC_DIR/$d/* | \
 			grep -v "\..*" | \
 			grep -v group >> $tmp.list 2>/dev/null
@@ -198,7 +203,7 @@ while [ $# -gt 0 ]; do
 		;;
 
 	-X)	xfile=$2; shift ;
-		for d in $SRC_GROUPS $FSTYP; do
+		for d in $SRC_GROUPS; do
 			[ -f $SRC_DIR/$d/$xfile ] || continue
 			for f in `cat $SRC_DIR/$d/$xfile`; do
 				echo $d/$f >> $tmp.xlist
-- 
1.7.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* [PATCH 3/3] xfstests: Do not fail on empty exclude groups
  2013-05-02 14:03 [PATCH 0/3] Tmpfs support and fixes for tmpfs/nfs ranto.boris
  2013-05-02 14:03 ` [PATCH 1/3] xfstests: Add tmpfs support ranto.boris
  2013-05-02 14:03 ` [PATCH 2/3] xfstests: Do not fail on non-existing tests/FSTYP directory ranto.boris
@ 2013-05-02 14:03 ` ranto.boris
  2013-05-13 12:57 ` [PATCH 0/3] Tmpfs support and fixes for tmpfs/nfs Boris Ranto
  3 siblings, 0 replies; 5+ messages in thread
From: ranto.boris @ 2013-05-02 14:03 UTC (permalink / raw)
  To: xfs; +Cc: Boris Ranto

From: Boris Ranto <ranto.boris@gmail.com>

Currently, xfstests will fail as soon as it detects an empty exclude
group. However, this may cause problems in automated testing. For
example, if one wishes to exclude otherwise valid group dmapi for file
system like tmpfs or nfs, the ./check script will hit the error about
empty group and fail. This simple patch changes the error to warning,
prints the warning to stderr and simply continue without excluding
anything as there are no tests to be excluded.

Signed-off-by: Boris Ranto <ranto.boris@gmail.com>
---
 check |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/check b/check
index 4af2dbd..b888030 100755
--- a/check
+++ b/check
@@ -194,12 +194,13 @@ while [ $# -gt 0 ]; do
 		[ ! -s $tmp.list ] && get_all_tests
 
 		group_list=$(get_group_list $xgroup)
+		# Trim the test list only if there is something to trim it with
 		if [ -z "$group_list" ]; then
-		    echo "Group \"$xgroup\" is empty or not defined?"
-		    exit 1
+		    echo "Warning: Group \"$xgroup\" seems empty." 1>&2
+		else
+		    trim_test_list $group_list
 		fi
 
-		trim_test_list $group_list
 		;;
 
 	-X)	xfile=$2; shift ;
-- 
1.7.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: [PATCH 0/3] Tmpfs support and fixes for tmpfs/nfs
  2013-05-02 14:03 [PATCH 0/3] Tmpfs support and fixes for tmpfs/nfs ranto.boris
                   ` (2 preceding siblings ...)
  2013-05-02 14:03 ` [PATCH 3/3] xfstests: Do not fail on empty exclude groups ranto.boris
@ 2013-05-13 12:57 ` Boris Ranto
  3 siblings, 0 replies; 5+ messages in thread
From: Boris Ranto @ 2013-05-13 12:57 UTC (permalink / raw)
  To: xfs; +Cc: ranto.boris, Boris Ranto

On Thu, 2013-05-02 at 16:03 +0200, ranto.boris@gmail.com wrote:
> Hi all,
> 
> This series contains three patches related to support of tmpfs file system in xfstests.
> 
> First patch provides the support itself. Second patch fixes a regression where ./check -nfs -n -g auto stopped working for nfs (and tmpfs) and the last patch changes the failure on empty exclude group to warning to simplify automated testing.
> 
> Regards,
> Boris
> 

Could this small patchset get any review, please?

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

end of thread, other threads:[~2013-05-13 12:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-02 14:03 [PATCH 0/3] Tmpfs support and fixes for tmpfs/nfs ranto.boris
2013-05-02 14:03 ` [PATCH 1/3] xfstests: Add tmpfs support ranto.boris
2013-05-02 14:03 ` [PATCH 2/3] xfstests: Do not fail on non-existing tests/FSTYP directory ranto.boris
2013-05-02 14:03 ` [PATCH 3/3] xfstests: Do not fail on empty exclude groups ranto.boris
2013-05-13 12:57 ` [PATCH 0/3] Tmpfs support and fixes for tmpfs/nfs Boris Ranto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.