From: Boris Ranto <ranto.boris@xxxxxxxxx> 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@xxxxxxxxx> --- 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@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs