From: Jeff Liu <jeff.liu@oracle.com>
To: Eric Sandeen <sandeen@redhat.com>
Cc: ext4 development <linux-ext4@vger.kernel.org>, xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH V2] xfstests: fix src/seek_sanity_test -t option
Date: Fri, 24 May 2013 14:54:32 +0800 [thread overview]
Message-ID: <519F0EA8.8010305@oracle.com> (raw)
In-Reply-To: <519EF740.1000907@redhat.com>
On 05/24/2013 01:14 PM, Eric Sandeen wrote:
> _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 <sandeen@redhat.com>
> ---
>
> V2: saner test for too many args
>
> 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();
This looks good to me.
Reviewed-by: Jie Liu <jeff.liu@oracle.com>
Thanks,
-Jeff
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2013-05-24 6:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-24 5:03 [PATCH] xfstests: fix src/seek_sanity_test -t option Eric Sandeen
2013-05-24 5:14 ` [PATCH V2] " Eric Sandeen
2013-05-24 6:54 ` Jeff Liu [this message]
2013-05-24 8:02 ` Zheng Liu
2013-05-28 15:57 ` [PATCH] " Rich Johnston
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=519F0EA8.8010305@oracle.com \
--to=jeff.liu@oracle.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).