]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfstests: Add tmpfs support
authorBoris Ranto <branto@redhat.com>
Tue, 10 Dec 2013 20:11:52 +0000 (20:11 +0000)
committerRich Johnston <rjohnston@sgi.com>
Tue, 17 Dec 2013 16:32:12 +0000 (10:32 -0600)
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 <branto@redhat.com>
Signed-off-by: Junho Ryu <jayr@google.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
check
common/rc

diff --git a/check b/check
index c88bcf2876d8001c8ecc22b55caae3ff57e6d6ed..320ad26b7c2cc2cd63770570608685dacc6eefaf 100755 (executable)
--- a/check
+++ b/check
@@ -73,6 +73,7 @@ usage()
 
 check options
     -nfs                test NFS
+    -tmpfs              test TMPFS
     -l                 line mode diff
     -udiff             show unified diff (default)
     -n                 show me, do not run tests
@@ -207,6 +208,7 @@ while [ $# -gt 0 ]; do
        -\? | -h | --help) usage ;;
 
        -nfs)   FSTYP=nfs ;;
+       -tmpfs) FSTYP=tmpfs ;;
 
        -g)     group=$2 ; shift ;
                GROUP_LIST="$GROUP_LIST $group"
index 5f61d5784e32fbbeef6338ea538360cc6a497c05..a2005c992932aaa9dade9d51c3f1fcf6ee2daacf 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -112,6 +112,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
@@ -140,6 +144,9 @@ _mkfs_opts()
     jfs)
        export MKFS_OPTIONS="$JFS_MKFS_OPTIONS -q"
        ;;
+    tmpfs)
+       export MKFS_OPTIONS="$TMPFS_MKFS_OPTIONS"
+       ;;
     *)
        ;;
     esac
@@ -544,6 +551,9 @@ _scratch_mkfs()
     ext4)
        _scratch_mkfs_ext4 $*
        ;;
+    tmpfs)
+       # do nothing for tmpfs
+       ;;
     *)
        yes | $MKFS_PROG -t $FSTYP -- $MKFS_OPTIONS $* $SCRATCH_DEV
        ;;
@@ -977,6 +987,12 @@ _require_scratch()
        nfs*)
                  _notrun "requires a scratch device"
                 ;;
+       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
@@ -1701,6 +1717,9 @@ _check_test_fs()
     btrfs)
        _check_btrfs_filesystem $TEST_DEV
        ;;
+    tmpfs)
+       # no way to check consistency for tmpfs
+       ;;
     *)
        _check_generic_filesystem $TEST_DEV
        ;;
@@ -1733,6 +1752,9 @@ _check_scratch_fs()
     btrfs)
        _check_btrfs_filesystem $device
        ;;
+    tmpfs)
+       # no way to check consistency for tmpfs
+       ;;
     *)
        _check_generic_filesystem $device
        ;;