add usage() to the test_runner
This commit is contained in:
+15
-3
@@ -61,6 +61,15 @@ static suite_func suites[] = {
|
||||
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
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
@@ -68,7 +77,7 @@ main (int argc, char *argv[])
|
||||
int c;
|
||||
const char *test_case = NULL;
|
||||
|
||||
while ((c = getopt(argc, argv, "xk:")) != -1) {
|
||||
while ((c = getopt(argc, argv, "xk:h")) != -1) {
|
||||
switch (c) {
|
||||
case 'x':
|
||||
xml_output = 1;
|
||||
@@ -77,8 +86,11 @@ main (int argc, char *argv[])
|
||||
test_case = optarg;
|
||||
break;
|
||||
default:
|
||||
printf("Ignoring unknown option %c\n", c);
|
||||
break;
|
||||
printf("Unknown option %c\n", c);
|
||||
/*fallthrough*/
|
||||
case 'h':
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user