r3276 - trunk/varnish-cache/bin/varnishtest

phk at projects.linpro.no phk at projects.linpro.no
Fri Oct 10 12:16:24 CEST 2008


Author: phk
Date: 2008-10-10 12:16:23 +0200 (Fri, 10 Oct 2008)
New Revision: 3276

Modified:
   trunk/varnish-cache/bin/varnishtest/vtc.c
Log:
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




Modified: trunk/varnish-cache/bin/varnishtest/vtc.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc.c	2008-10-10 08:32:24 UTC (rev 3275)
+++ trunk/varnish-cache/bin/varnishtest/vtc.c	2008-10-10 10:16:23 UTC (rev 3276)
@@ -320,7 +320,7 @@
 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 @@
 int
 main(int argc, char * const *argv)
 {
-	int ch;
+	int ch, i, ntest;
 	FILE *fok;
 	static struct vtclog	*vl;
 
@@ -339,8 +339,11 @@
 	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 @@
 		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);




More information about the varnish-commit mailing list