new file mode 100755
@@ -0,0 +1,57 @@
+#! /bin/bash
+# FS QA Test No. 296
+#
+# SEEK_DATA/SEEK_HOLE sanity test w/o unwritten extent.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2013 Alibaba Group. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#-----------------------------------------------------------------------
+#
+# creator
+owner=wenqing.lz@taobao.com
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1 # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+ eval "rm -f $BASE_TEST_FILE.*"
+}
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+_supported_fs generic
+_supported_os IRIX Linux
+
+_require_seek_data_hole
+
+BASE_TEST_FILE=$TEST_DIR/seek_sanity_testfile
+
+[ -x $here/src/seek_sanity_test ] || _notrun "seek_sanity_tester not built"
+
+$here/src/seek_sanity_test -u $BASE_TEST_FILE > $seq.full 2>&1 ||
+ _fail "seek sanity check failed!"
+
+# success, all done
+status=0
+exit
new file mode 100644
@@ -0,0 +1 @@
+QA output created by 296
@@ -414,3 +414,4 @@ deprecated
293 auto quick
294 auto quick
295 auto quick prealloc
+296 auto rw
@@ -567,7 +567,16 @@ struct testrec {
char *test_desc;
};
-struct testrec seek_tests[] = {
+struct testrec no_unwritten_seek_tests[] = {
+ { 1, test01, "Test empty file" },
+ { 2, test02, "Test a tiny full file" },
+ { 3, test03, "Test a larger full file" },
+ { 4, test04, "Test file hole at beg, data at end" },
+ { 5, test05, "Test file data at beg, hole at end" },
+ { 6, test06, "Test file hole data hole data" },
+};
+
+struct testrec full_seek_tests[] = {
{ 1, test01, "Test empty file" },
{ 2, test02, "Test a tiny full file" },
{ 3, test03, "Test a larger full file" },
@@ -662,15 +671,20 @@ int main(int argc, char **argv)
int i = 0;
int opt;
int check_support = 0;
- int numtests = sizeof(seek_tests) / sizeof(struct testrec);
+ int dont_unwritten = 0;
+ int numtests = sizeof(full_seek_tests) / sizeof(struct testrec);
+ struct testrec *tests = full_seek_tests;
- while ((opt = getopt(argc, argv, "t")) != -1) {
+ while ((opt = getopt(argc, argv, "tu")) != -1) {
switch (opt) {
case 't':
check_support++;
break;
+ case 'u':
+ dont_unwritten++;
+ break;
default:
- fprintf(stdout, "Usage: %s [-t] base_file_path\n", argv[0]);
+ fprintf(stdout, "Usage: %s [-tu] base_file_path\n", argv[0]);
return ret;
}
}
@@ -681,8 +695,14 @@ int main(int argc, char **argv)
if (ret || check_support)
goto out;
+ if (dont_unwritten) {
+ numtests = sizeof(no_unwritten_seek_tests) /
+ sizeof(struct testrec);
+ tests = no_unwritten_seek_tests;
+ }
+
for (i = 0; i < numtests; ++i) {
- ret = run_test(&seek_tests[i]);
+ ret = run_test(&tests[i]);
if (ret)
break;
}