add usage() to the test_runner
This commit is contained in:
+15
-3
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user