old mode 100644
new mode 100755
@@ -1,7 +1,7 @@
#! /bin/bash
# FS QA Test No. 285
#
-# SEEK_DATA/SEEK_HOLE sanity tests.
+# SEEK_DATA/SEEK_HOLE sanity tests w/ unwritten extent.
#
# Improved by Jeff.liu@oracle.com
# Creater: josef@redhat.com
@@ -41,9 +41,12 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_supported_fs generic
_supported_os Linux
+_require_seek_data_hole
+_require_xfs_io_falloc
+
BASE_TEST_FILE=$TEST_DIR/seek_sanity_testfile
-[ -x $here/src/seek_sanity_test ] || _notrun "seek_sanitfy_tester not built"
+[ -x $here/src/seek_sanity_test ] || _notrun "seek_sanity_tester not built"
_cleanup()
{
@@ -1049,6 +1049,18 @@ _require_sparse_files()
esac
}
+#
+# Check if the filesystem 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 2>&1 > /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
#
@@ -660,17 +660,25 @@ 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) {
- fprintf(stdout, "Usage: %s base_file_path\n", argv[0]);
- return ret;
+ while ((opt = getopt(argc, argv, "t")) != -1) {
+ switch (opt) {
+ case 't':
+ check_support++;
+ break;
+ default:
+ fprintf(stdout, "Usage: %s [-t] base_file_path\n", argv[0]);
+ return ret;
+ }
}
- base_file_path = (char *)strdup(argv[1]);
+ 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) {