add usage() to the test_runner

This commit is contained in:
Nils O. Selåsdal
2015-05-05 18:19:54 +02:00
parent 70d5c2b600
commit 99297b153c
+15 -3
View File
@@ -61,6 +61,15 @@ static suite_func suites[] = {
restart_counter_suite restart_counter_suite
}; };
void
usage(const char *progname)
{
printf("Usage: %s [-h] [-k testcase] [-x]\n", progname);
puts("\t-h This help");
puts("\t-k testcase Run the given testcase");
puts("\t-x Ouput results in XML to the file result.xml");
}
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
@@ -68,7 +77,7 @@ main (int argc, char *argv[])
int c; int c;
const char *test_case = NULL; const char *test_case = NULL;
while ((c = getopt(argc, argv, "xk:")) != -1) { while ((c = getopt(argc, argv, "xk:h")) != -1) {
switch (c) { switch (c) {
case 'x': case 'x':
xml_output = 1; xml_output = 1;
@@ -77,8 +86,11 @@ main (int argc, char *argv[])
test_case = optarg; test_case = optarg;
break; break;
default: default:
printf("Ignoring unknown option %c\n", c); printf("Unknown option %c\n", c);
break; /*fallthrough*/
case 'h':
usage(argv[0]);
return 1;
} }
} }