]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
In xfstest 285/286 we don't check whether the target file system
authorZheng Liu <wenqing.lz@taobao.com>
Tue, 14 May 2013 18:25:44 +0000 (13:25 -0500)
committerRich Johnston <rjohnston@sgi.com>
Tue, 14 May 2013 18:25:44 +0000 (13:25 -0500)
supports seek data/hole operation or not.  Here _require_seek_data_hole
is defined to do this work.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Reviewed-by: Rich Johnston <rjohnston@sgi.com>
Signed-off-by: Rich Johnston <rjohnston@sgi.com>
common/rc
src/seek_sanity_test.c
tests/generic/285
tests/generic/286 [changed mode: 0755->0644]

index f7e95560f236a26b8ad8d74ea4204fc9e0ccd36b..7adf8b8cd587f1c249b8632232d5ded8bc10c362 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -1283,6 +1283,18 @@ _require_fail_make_request()
  not found. Seems that CONFIG_FAIL_MAKE_REQUEST kernel config option not enabled"
 }
 
+#
+# Check if the file system supports seek_data/hole
+#
+_require_seek_data_hole()
+{
+    testfile=$TEST_DIR/$$.seek
+    testseek=`$here/src/seek_sanity_test -t $testfile 2>&1`
+    rm -f $testfile &>/dev/null
+    echo $testseek | grep -q "Kernel does not support" && \
+        _notrun "File system does not support llseek(2) SEEK_DATA/HOLE"
+}
+
 # check that a FS on a device is mounted
 # if so, return mount point
 #
index 3897f025fafaee3e19072ed8d5a44b6f2bab2599..4275a846737b1b27064a2dcaa940730d01c969c0 100644 (file)
@@ -660,6 +660,8 @@ int main(int argc, char **argv)
 {
        int ret = -1;
        int i = 0;
+       int opt;
+       int check_support = 0;
        int numtests = sizeof(seek_tests) / sizeof(struct testrec);
 
        if (argc != 2) {
@@ -667,10 +669,22 @@ int main(int argc, char **argv)
                return ret;
        }
 
-       base_file_path = (char *)strdup(argv[1]);
+       while ((opt = getopt(argc, argv, "t")) != -1) {
+               switch (opt) {
+               case 't':
+                       check_support++;
+                       break;
+               default:
+                       fprintf(stderr, "Usage: %s [-t] base_file_path\n",
+                               argv[0]);
+                       return ret;
+               }
+       }
+
+       base_file_path = (char *)strdup(argv[optind]);
 
        ret = test_basic_support();
-       if (ret)
+       if (ret || check_support)
                goto out;
 
        for (i = 0; i < numtests; ++i) {
index 22b4a0889f9df265a4d65590bbd686114885a166..b700a157188b438d4812fa600d2734067708428a 100644 (file)
@@ -40,6 +40,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fs generic
 _supported_os Linux
 
+_require_seek_data_hole
+
 BASE_TEST_FILE=$TEST_DIR/seek_sanity_testfile
 
 [ -x $here/src/seek_sanity_test ] || _notrun "seek_sanitfy_tester not built"
old mode 100755 (executable)
new mode 100644 (file)
index 0652fd4..f4fe39a
@@ -38,6 +38,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fs generic
 _supported_os Linux
 
+_require_seek_data_hole
+
 src=$TEST_DIR/seek_copy_testfile
 dest=$TEST_DIR/seek_copy_testfile.dest