From patchwork Mon Jan 28 07:32:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Liu X-Patchwork-Id: 216120 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 68E8C2C007E for ; Mon, 28 Jan 2013 18:20:43 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752716Ab3A1HUn (ORCPT ); Mon, 28 Jan 2013 02:20:43 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:59693 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751948Ab3A1HUn (ORCPT ); Mon, 28 Jan 2013 02:20:43 -0500 Received: by mail-pa0-f43.google.com with SMTP id fb10so1344918pad.2 for ; Sun, 27 Jan 2013 23:20:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=/HSsKSzmhXWrp8F/n5keOmcvC9NQ+VoIUbJSx18TGpk=; b=pMJUCQsw/KrfAvoGt1d+SoFFD5cSykBrGypEctLZNmhQjxQfa/jgGnhBuIGoJj1AW1 uTtYtJFA/sFBNGA4eBH5OCdh6b0PFFK/2PWuuiJFgXrkjF4TLqYnyjKcyBXUQ+4z4dLn DaM0Dr+ADhKX9OUzysK0cfSM6Wj2QgD2dR0gvqNZQXAZizArXJ5nM4ybPHrr4ICue0CK 4MAF2ncRvlSbDWeQBvnBLYjdS3oUJEvDlPrjU2Oc7G5Zte3aSPOWw27KX9KbaGmz8wGu iP1q0wzMnQLY5xAbAU67Onhg39pS1C5Z5WVSiTHzmdOMz5DNHhbSNAMYyd5qtNWfEWBQ B5JQ== X-Received: by 10.68.227.97 with SMTP id rz1mr35244482pbc.54.1359357642683; Sun, 27 Jan 2013 23:20:42 -0800 (PST) Received: from lz-desktop.taobao.ali.com ([182.92.247.2]) by mx.google.com with ESMTPS id t6sm6226006paz.11.2013.01.27.23.20.37 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 27 Jan 2013 23:20:41 -0800 (PST) From: Zheng Liu To: xfs@oss.sgi.com, linux-ext4@vger.kernel.org Cc: Zheng Liu , "Theodore Ts'o" , Dave Chinner Subject: [PATCH 4/4] xfstests: 296: add a seek data/hole test w/o unwritten extent Date: Mon, 28 Jan 2013 15:32:51 +0800 Message-Id: <1359358371-21411-5-git-send-email-wenqing.lz@taobao.com> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: <1359358371-21411-1-git-send-email-wenqing.lz@taobao.com> References: <1359358371-21411-1-git-send-email-wenqing.lz@taobao.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Zheng Liu Now ext4 has supported seek data/hole w/o unwritten extent. This commit creates a new test case to do seek data/hole sanity test w/o unwritten extent. All file systems that support seek_data/hole should survive after running this test. Signed-off-by: Zheng Liu Cc: "Theodore Ts'o" Cc: Dave Chinner --- 296 | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 296.out | 1 + group | 1 + src/seek_sanity_test.c | 30 +++++++++++++++++++++----- 4 files changed, 84 insertions(+), 5 deletions(-) create mode 100755 296 create mode 100644 296.out diff --git a/296 b/296 new file mode 100755 index 0000000..8a49a0f --- /dev/null +++ b/296 @@ -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 diff --git a/296.out b/296.out new file mode 100644 index 0000000..7921f57 --- /dev/null +++ b/296.out @@ -0,0 +1 @@ +QA output created by 296 diff --git a/group b/group index a07d7f3..3019924 100644 --- a/group +++ b/group @@ -414,3 +414,4 @@ deprecated 293 auto quick 294 auto quick 295 auto quick prealloc +296 auto rw diff --git a/src/seek_sanity_test.c b/src/seek_sanity_test.c index b1ef006..bfa5e52 100644 --- a/src/seek_sanity_test.c +++ b/src/seek_sanity_test.c @@ -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; }