cifs: skip tests that need POSIX support for nounix mounts
authorPavel Shilovsky <pshilovsky@samba.org>
Mon, 8 Sep 2014 12:26:52 +0000 (22:26 +1000)
committerDave Chinner <david@fromorbit.com>
Mon, 8 Sep 2014 12:26:52 +0000 (22:26 +1000)
CIFS/SMB protocol without POSIX extensions doesn't support operations
with symbolic links and advisory byte-range locks from the same process.
Add checks these features and use them in generic tests that require
such operations.

Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Reviewed-by: Steve French <smfrench@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
common/rc
tests/generic/005
tests/generic/023
tests/generic/024
tests/generic/025
tests/generic/131

index 4f32469f16fcef1a3715c831c2cd1bd221b74109..2158121843849dc980ecc9917f64a247df68f835 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -2428,6 +2428,29 @@ _require_btrfs_fs_feature()
                _notrun "Feature $feat not supported by the available btrfs version"
 }
 
+_require_test_symlinks()
+{
+       # IRIX UDF does not support symlinks
+       [ "$HOSTOS" = "IRIX" -a "$FSTYP" = 'udf' ] && \
+               _notrun "Require symlinks support"
+       target=`mktemp -p $TEST_DIR`
+       link=`mktemp -p $TEST_DIR -u`
+       ln -s `basename $target` $link
+       if [ "$?" -ne 0 ]; then
+               rm -f $target
+               _notrun "Require symlinks support"
+       fi
+       rm -f $target $link
+}
+
+_require_test_fcntl_advisory_locks()
+{
+       [ "$FSTYP" != "cifs" ] && return 0
+       cat /proc/mounts | grep $TEST_DEV | grep cifs | grep -q "nobrl" && return 0
+       cat /proc/mounts | grep $TEST_DEV | grep cifs | grep -qE "nounix|forcemand" && \
+               _notrun "Require fcntl advisory locks support"
+}
+
 _get_total_inode()
 {
        if [ -z "$1" ]; then
index d78e43fbd301a989b1bcc00f74fbd7d8797cf955..70f60738027817e2d415be058eb097abccc5f44b 100755 (executable)
@@ -67,13 +67,9 @@ _touch()
 # real QA test starts here
 _supported_fs generic
 _require_test
+_require_test_symlinks
 
-# IRIX UDF does not support symlinks
-if [ $FSTYP == 'udf' ]; then
-    _supported_os Linux
-else
-    _supported_os Linux IRIX
-fi
+_supported_os Linux IRIX
 
 cd $TEST_DIR
 
index 114485c22719a9999f799b135b7a74825b071e7c..1062b5b62b4c94e5081758253f7f2cab17de338e 100755 (executable)
@@ -45,6 +45,7 @@ _supported_os Linux
 
 _require_test
 _requires_renameat2
+_require_test_symlinks
 
 # real QA test starts here
 
index 8945191cfd34c81fc9c866a1dd958d771d2779f7..bcc246e89e91d2dbc0809f9601c3b5f3f4e08766 100755 (executable)
@@ -45,6 +45,7 @@ _supported_os Linux
 
 _require_test
 _requires_renameat2
+_require_test_symlinks
 
 rename_dir=$TEST_DIR/$$
 mkdir $rename_dir
index 6b6c8abb12578bcdae7b040e2f126442cca96b46..da295a30185d82644306e29989c2d5f09a348ebc 100755 (executable)
@@ -45,6 +45,7 @@ _supported_os Linux
 
 _require_test
 _requires_renameat2
+_require_test_symlinks
 
 rename_dir=$TEST_DIR/$$
 mkdir $rename_dir
index b4e3ff067b0ca802c904f2b844a0f0ac987a3984..3bcb0d16a34b2306156939d5941225bddd6918d5 100755 (executable)
@@ -45,6 +45,7 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 _require_test
+_require_test_fcntl_advisory_locks
 
 TESTFILE=$TEST_DIR/lock_file