xfs
[Top] [All Lists]

[PATCH] xfstests: support post-udev device mapper nodes

To: xfs@xxxxxxxxxxx
Subject: [PATCH] xfstests: support post-udev device mapper nodes
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Mon, 2 May 2011 12:02:32 -0400
User-agent: Mutt/1.5.21 (2010-09-15)
Because of udevs complaining device mapper now creates /dev/dm-N as the real
device nodes, and just symlinks the /dev/mapper/ names to it.  This would be
easy if everything used the /dev/mapper clear names, but most system utilities
translate them back to the /dev/mapper/ names and thus confuse various test
cases.  Add support to _is_block_dev to read symlinks, and add documentation
on how to run xfstests on device mapper volumes.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Index: xfstests-dev/common.rc
===================================================================
--- xfstests-dev.orig/common.rc 2011-05-02 12:45:25.000000000 +0000
+++ xfstests-dev/common.rc      2011-05-02 12:45:28.000000000 +0000
@@ -587,7 +587,14 @@ _is_block_dev()
        exit 1
     fi
 
-    [ -b $1 ] && src/lstat64 $1 | $AWK_PROG '/Device type:/ { print $9 }'
+    _dev=$1
+    if [ -L ${_dev} ]; then
+        _dev=`readlink -f ${_dev}`
+    fi
+
+    if [ -b ${_dev} ]; then
+        src/lstat64 ${_dev} | $AWK_PROG '/Device type:/ { print $9 }'
+    fi
 }
 
 # Do a command, log it to $seq.full, optionally test return status
@@ -700,10 +707,12 @@ _require_scratch()
        *)
                 if [ -z "$SCRATCH_DEV" -o "`_is_block_dev $SCRATCH_DEV`" = "" ]
                 then
+                    echo "no a block device";
                     _notrun "this test requires a valid \$SCRATCH_DEV"
                 fi
                 if [ "`_is_block_dev $SCRATCH_DEV`" = "`_is_block_dev 
$TEST_DEV`" ]
                 then
+                   echo "foo"
                     _notrun "this test requires a valid \$SCRATCH_DEV"
                 fi
                if [ ! -d "$SCRATCH_MNT" ]
Index: xfstests-dev/README.device-mapper
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ xfstests-dev/README.device-mapper   2011-05-02 15:51:24.000000000 +0000
@@ -0,0 +1,8 @@
+
+To use xfstests on device mapper always use the /dev/mapper/<name> symlinks,
+not the /dev/dm-* devices, or the symlinks created by LVM.
+
+For example:
+
+TEST_DEV=/dev/mapper/test
+SCRATCH_DEV=/dev/mapper/scratch

<Prev in Thread] Current Thread [Next in Thread>