public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] xfstests: add _require_seek_data_hole to check seek data/hole
@ 2013-05-12  9:24 Zheng Liu
  2013-05-14 18:51 ` Rich Johnston
  2013-05-14 18:54 ` Rich Johnston
  0 siblings, 2 replies; 3+ messages in thread
From: Zheng Liu @ 2013-05-12  9:24 UTC (permalink / raw)
  To: xfs; +Cc: Rich Johnston, Zheng Liu

From: Zheng Liu <wenqing.lz@taobao.com>

In xfstest 285/286 we don't check whether the target file system
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>
Cc: Rich Johnston <rjohnston@sgi.com>
---
changelog:
 * rebase against the latest master branch of xfstests tree

Hi Rich,

Sorry for the late.  Could you please look at this patch?

Thanks,
						- Zheng

 common/rc              | 12 ++++++++++++
 src/seek_sanity_test.c | 18 ++++++++++++++++--
 tests/generic/285      |  2 ++
 tests/generic/286      |  2 ++
 4 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/common/rc b/common/rc
index f97924a..f24a6aa 100644
--- 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
 #
diff --git a/src/seek_sanity_test.c b/src/seek_sanity_test.c
index 3897f02..4275a84 100644
--- a/src/seek_sanity_test.c
+++ b/src/seek_sanity_test.c
@@ -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) {
diff --git a/tests/generic/285 b/tests/generic/285
index 22b4a08..b700a15 100644
--- a/tests/generic/285
+++ b/tests/generic/285
@@ -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"
diff --git a/tests/generic/286 b/tests/generic/286
index a0d4df9..5ab174f 100644
--- a/tests/generic/286
+++ b/tests/generic/286
@@ -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
 
-- 
1.7.12.rc2.18.g61b472e

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] xfstests: add _require_seek_data_hole to check seek data/hole
  2013-05-12  9:24 [PATCH v2] xfstests: add _require_seek_data_hole to check seek data/hole Zheng Liu
@ 2013-05-14 18:51 ` Rich Johnston
  2013-05-14 18:54 ` Rich Johnston
  1 sibling, 0 replies; 3+ messages in thread
From: Rich Johnston @ 2013-05-14 18:51 UTC (permalink / raw)
  To: Zheng Liu; +Cc: Zheng Liu, xfs

On 05/12/2013 04:24 AM, Zheng Liu wrote:
> From: Zheng Liu <wenqing.lz@taobao.com>
>
> In xfstest 285/286 we don't check whether the target file system
> 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>
> Cc: Rich Johnston <rjohnston@sgi.com>

Looks good.

Reviewed-by: Rich Johnston <rjohnston@sgi.com>

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] xfstests: add _require_seek_data_hole to check seek data/hole
  2013-05-12  9:24 [PATCH v2] xfstests: add _require_seek_data_hole to check seek data/hole Zheng Liu
  2013-05-14 18:51 ` Rich Johnston
@ 2013-05-14 18:54 ` Rich Johnston
  1 sibling, 0 replies; 3+ messages in thread
From: Rich Johnston @ 2013-05-14 18:54 UTC (permalink / raw)
  To: Zheng Liu; +Cc: Zheng Liu, xfs

On 05/12/2013 04:24 AM, Zheng Liu wrote:
> From: Zheng Liu <wenqing.lz@taobao.com>
>
> In xfstest 285/286 we don't check whether the target file system
> 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>
> Cc: Rich Johnston <rjohnston@sgi.com>
> ---
> changelog:
>   * rebase against the latest master branch of xfstests tree
>
> Hi Rich,
>
> Sorry for the late.  Could you please look at this patch?
>
> Thanks,
> 						- Zheng
>
>   common/rc              | 12 ++++++++++++
>   src/seek_sanity_test.c | 18 ++++++++++++++++--
>   tests/generic/285      |  2 ++
>   tests/generic/286      |  2 ++
>   4 files changed, 32 insertions(+), 2 deletions(-)
>
> diff --git a/common/rc b/common/rc
> index f97924a..f24a6aa 100644
> --- 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
>   #
> diff --git a/src/seek_sanity_test.c b/src/seek_sanity_test.c
> index 3897f02..4275a84 100644
> --- a/src/seek_sanity_test.c
> +++ b/src/seek_sanity_test.c
> @@ -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) {
> diff --git a/tests/generic/285 b/tests/generic/285
> index 22b4a08..b700a15 100644
> --- a/tests/generic/285
> +++ b/tests/generic/285
> @@ -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"
> diff --git a/tests/generic/286 b/tests/generic/286
> index a0d4df9..5ab174f 100644
> --- a/tests/generic/286
> +++ b/tests/generic/286
> @@ -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
>
>
Hi Zheng, this has been committed:

commit 92449b7f36aba627adc3b2f11c1184292c5e43c7
Author: Zheng Liu <wenqing.lz@taobao.com>
Date:   Tue May 14 13:25:44 2013 -0500

     In xfstest 285/286 we don't check whether the target file system
     supports seek data/hole operation or not.  Here _require_seek_data_hole
     is defined to do this work.

Thanks
--Rich

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-14 18:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-12  9:24 [PATCH v2] xfstests: add _require_seek_data_hole to check seek data/hole Zheng Liu
2013-05-14 18:51 ` Rich Johnston
2013-05-14 18:54 ` Rich Johnston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox