From 8a674243b444da9e0742ac837334aaf38e6a703a Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Sun, 24 Mar 2019 20:36:16 +0300 Subject: [PATCH] tinytest: fix parsing --timeout argument Fixes: 15b2f41d ("tinytest: implement per-test timeout (via alarm() under !win32 only)") --- test/tinytest.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/tinytest.c b/test/tinytest.c index 1588e89a..a94fb9d4 100644 --- a/test/tinytest.c +++ b/test/tinytest.c @@ -339,7 +339,7 @@ tinytest_set_flag_(struct testgroup_t *groups, const char *arg, int set, unsigne static void usage(struct testgroup_t *groups, int list_groups) { - puts("Options are: [--verbose|--quiet|--terse] [--no-fork]"); + puts("Options are: [--verbose|--quiet|--terse] [--no-fork] [--timeout ]"); puts(" Specify tests by name, or using a prefix ending with '..'"); puts(" To skip a test, prefix its name with a colon."); puts(" To enable a disabled test, prefix its name with a plus."); @@ -437,7 +437,8 @@ tinytest_main(int c, const char **v, struct testgroup_t *groups) } else if (!strcmp(v[i], "--list-tests")) { usage(groups, 1); } else if (!strcmp(v[i], "--timeout")) { - if (i < c) { + ++i; + if (i >= c) { fprintf(stderr, "--timeout requires argument\n"); return -1; } -- 2.40.0