* [PATCH] xfstests: fix src/seek_sanity_test -t option @ 2013-05-24 5:03 ` Eric Sandeen 0 siblings, 0 replies; 8+ messages in thread From: Eric Sandeen @ 2013-05-24 5:03 UTC (permalink / raw) To: xfs-oss, ext4 development _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> --- 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; - } ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] xfstests: fix src/seek_sanity_test -t option @ 2013-05-24 5:03 ` Eric Sandeen 0 siblings, 0 replies; 8+ messages in thread From: Eric Sandeen @ 2013-05-24 5:03 UTC (permalink / raw) To: xfs-oss, ext4 development _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> --- 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 (!argv[optind] || argv[optind+1]) + usage(argv[0]); + base_file_path = (char *)strdup(argv[optind]); ret = test_basic_support(); _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH V2] xfstests: fix src/seek_sanity_test -t option 2013-05-24 5:03 ` Eric Sandeen @ 2013-05-24 5:14 ` Eric Sandeen -1 siblings, 0 replies; 8+ messages in thread From: Eric Sandeen @ 2013-05-24 5:14 UTC (permalink / raw) To: xfs-oss, ext4 development _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; - } ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH V2] xfstests: fix src/seek_sanity_test -t option @ 2013-05-24 5:14 ` Eric Sandeen 0 siblings, 0 replies; 8+ messages in thread From: Eric Sandeen @ 2013-05-24 5:14 UTC (permalink / raw) To: xfs-oss, ext4 development _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(); _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH V2] xfstests: fix src/seek_sanity_test -t option 2013-05-24 5:14 ` Eric Sandeen (?) @ 2013-05-24 6:54 ` Jeff Liu -1 siblings, 0 replies; 8+ messages in thread From: Jeff Liu @ 2013-05-24 6:54 UTC (permalink / raw) To: Eric Sandeen; +Cc: ext4 development, xfs-oss 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V2] xfstests: fix src/seek_sanity_test -t option 2013-05-24 5:14 ` Eric Sandeen (?) (?) @ 2013-05-24 8:02 ` Zheng Liu -1 siblings, 0 replies; 8+ messages in thread From: Zheng Liu @ 2013-05-24 8:02 UTC (permalink / raw) To: Eric Sandeen; +Cc: ext4 development, xfs-oss On Fri, May 24, 2013 at 12:14:40AM -0500, 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> Sorry, my apologies. I made a mistake when I rebased the patch. Thanks for fixing it. Reviewed-by: Zheng Liu <wenqing.lz@taobao.com> - Zheng > --- > > 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(); > > > > _______________________________________________ > xfs mailing list > xfs@oss.sgi.com > http://oss.sgi.com/mailman/listinfo/xfs _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] xfstests: fix src/seek_sanity_test -t option 2013-05-24 5:03 ` Eric Sandeen @ 2013-05-28 15:57 ` Rich Johnston -1 siblings, 0 replies; 8+ messages in thread From: Rich Johnston @ 2013-05-28 15:57 UTC (permalink / raw) To: Eric Sandeen; +Cc: xfs-oss, ext4 development On 05/24/2013 12:03 AM, 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> Thanks, this has been committed: commit bd13bf9e2a87a40d3aab2644967029b854ed2d11 Author: Eric Sandeen <sandeen@redhat.com> Date: Tue May 28 10:37:39 2013 -0500 xfstests: fix src/seek_sanity_test -t option --Rich ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] xfstests: fix src/seek_sanity_test -t option @ 2013-05-28 15:57 ` Rich Johnston 0 siblings, 0 replies; 8+ messages in thread From: Rich Johnston @ 2013-05-28 15:57 UTC (permalink / raw) To: Eric Sandeen; +Cc: ext4 development, xfs-oss On 05/24/2013 12:03 AM, 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> Thanks, this has been committed: commit bd13bf9e2a87a40d3aab2644967029b854ed2d11 Author: Eric Sandeen <sandeen@redhat.com> Date: Tue May 28 10:37:39 2013 -0500 xfstests: fix src/seek_sanity_test -t option --Rich _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-05-28 15:56 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-05-24 5:03 [PATCH] xfstests: fix src/seek_sanity_test -t option Eric Sandeen 2013-05-24 5:03 ` Eric Sandeen 2013-05-24 5:14 ` [PATCH V2] " Eric Sandeen 2013-05-24 5:14 ` Eric Sandeen 2013-05-24 6:54 ` Jeff Liu 2013-05-24 8:02 ` Zheng Liu 2013-05-28 15:57 ` [PATCH] " Rich Johnston 2013-05-28 15:57 ` Rich Johnston
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.