[master] 8309f55 Display usage if we don't have any tests to run

Federico G. Schwindt fgsch at lodoss.net
Sat May 6 01:53:05 CEST 2017


commit 8309f5541127967b81fbe7dca3c0c4056d958091
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Sat May 6 00:51:06 2017 +0100

    Display usage if we don't have any tests to run

diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index e7e778f..e872807 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -145,7 +145,6 @@ usage(void)
 	fprintf(stderr, FMT, "-t duration", "Time tests out after this long");
 	fprintf(stderr, FMT, "-v", "Verbose mode: always report test log");
 	fprintf(stderr, FMT, "-W", "Enable the witness facility for locking");
-	fprintf(stderr, "\n");
 	exit(1);
 }
 
@@ -653,7 +652,10 @@ main(int argc, char * const *argv)
 	argc -= optind;
 	argv += optind;
 
-	for (;argc > 0; argc--, argv++) {
+	if (argc < 1)
+		usage();
+
+	for (; argc > 0; argc--, argv++) {
 		if (!read_file(*argv, ntest))
 			continue;
 		if (!vtc_continue)



More information about the varnish-commit mailing list