From patchwork Fri May 24 05:14:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 246056 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 9E2912C0082 for ; Fri, 24 May 2013 15:14:44 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752758Ab3EXFOn (ORCPT ); Fri, 24 May 2013 01:14:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33122 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752685Ab3EXFOn (ORCPT ); Fri, 24 May 2013 01:14:43 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4O5Efm0018623 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 24 May 2013 01:14:41 -0400 Received: from liberator.sandeen.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r4O5Ee2i023855 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 24 May 2013 01:14:41 -0400 Message-ID: <519EF740.1000907@redhat.com> Date: Fri, 24 May 2013 00:14:40 -0500 From: Eric Sandeen User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: xfs-oss , ext4 development Subject: [PATCH V2] xfstests: fix src/seek_sanity_test -t option References: <519EF4AE.60702@redhat.com> In-Reply-To: <519EF4AE.60702@redhat.com> X-Enigmail-Version: 1.5.1 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org _require_seek_data_hole() does not work because the -t (test) option of seek_sanity_test is broken, because of an early check for (argc != 2): # src/seek_sanity_test -t foo Usage: src/seek_sanity_test base_file_path So _require_seek_data_hole() doesn't see the "Kernel does not support" string it's looking for, and passes the check. So rather than _notrun-ing the test, it proceeds to fail with noisy errors. Fix that, make a common usage() function, and check for too many args as well. Signed-off-by: Eric Sandeen Reviewed-by: Jie Liu Reviewed-by: Zheng Liu --- V2: saner test for too many args -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/src/seek_sanity_test.c b/src/seek_sanity_test.c index 4275a84..f957178 100644 --- a/src/seek_sanity_test.c +++ b/src/seek_sanity_test.c @@ -656,6 +656,12 @@ out: return ret; } +void usage(char *cmd) +{ + fprintf(stdout, "Usage: %s [-t] base_file_path\n", cmd); + exit(1); +} + int main(int argc, char **argv) { int ret = -1; @@ -664,23 +670,20 @@ int main(int argc, char **argv) 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(stderr, "Usage: %s [-t] base_file_path\n", - argv[0]); - return ret; + usage(argv[0]); } } + /* should be exactly one arg left, the filename */ + if (optind != argc - 1) + usage(argv[0]); + base_file_path = (char *)strdup(argv[optind]); ret = test_basic_support();