From: phk Date: Fri, 10 Oct 2008 10:16:23 +0000 (+0000) Subject: Add "-n iter" argument so that it is possible to run a certain set of X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43a5c3ca90e2e7165c9cce4193fb825551e8a0e3;p=varnish Add "-n iter" argument so that it is possible to run a certain set of tests a given number of times: varnishtest -n 100 tests/b*.vtc git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3276 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishtest/vtc.c b/varnish-cache/bin/varnishtest/vtc.c index 9270a4c6..be39d37c 100644 --- a/varnish-cache/bin/varnishtest/vtc.c +++ b/varnish-cache/bin/varnishtest/vtc.c @@ -320,7 +320,7 @@ exec_file(const char *fn, struct vtclog *vl) static void usage(void) { - fprintf(stderr, "usage: varnishtest [-qv] file ...\n"); + fprintf(stderr, "usage: varnishtest [-n iter] [-qv] file ...\n"); exit(1); } @@ -331,7 +331,7 @@ usage(void) int main(int argc, char * const *argv) { - int ch; + int ch, i, ntest; FILE *fok; static struct vtclog *vl; @@ -339,8 +339,11 @@ main(int argc, char * const *argv) setbuf(stderr, NULL); vl = vtc_logopen("top"); AN(vl); - while ((ch = getopt(argc, argv, "qv")) != -1) { + while ((ch = getopt(argc, argv, "n:qv")) != -1) { switch (ch) { + case 'n': + ntest = strtoul(optarg, NULL, 0); + break; case 'q': vtc_verbosity--; break; @@ -358,8 +361,10 @@ main(int argc, char * const *argv) usage(); init_sema(); - for (ch = 0; ch < argc; ch++) - exec_file(argv[ch], vl); + for (i = 0; i < ntest; i++) { + for (ch = 0; ch < argc; ch++) + exec_file(argv[ch], vl); + } fok = fopen("_.ok", "w"); if (fok != NULL) fclose(fok);