Added new command line option: --show-tests
This commit is contained in:
parent
523fa1f6b7
commit
f7397f3579
1 changed files with 19 additions and 3 deletions
|
@ -41,6 +41,8 @@ typedef int (*TestCaseQuitFp)(void);
|
||||||
|
|
||||||
//!< Flag for executing tests in-process
|
//!< Flag for executing tests in-process
|
||||||
static int execute_inproc = 0;
|
static int execute_inproc = 0;
|
||||||
|
//!< Flag for only printing out the test names
|
||||||
|
static int only_print_tests = 0;
|
||||||
//!< Flag for executing only test with selected name
|
//!< Flag for executing only test with selected name
|
||||||
static int only_selected_test = 0;
|
static int only_selected_test = 0;
|
||||||
//!< Flag for executing only the selected test suite
|
//!< Flag for executing only the selected test suite
|
||||||
|
@ -514,6 +516,7 @@ printUsage() {
|
||||||
printf(" [--name-contains SUBSTR] [--help]\n");
|
printf(" [--name-contains SUBSTR] [--help]\n");
|
||||||
printf("Options:\n");
|
printf("Options:\n");
|
||||||
printf(" --in-proc Executes tests in-process\n");
|
printf(" --in-proc Executes tests in-process\n");
|
||||||
|
printf(" --show-tests Prints out all the executable tests\n");
|
||||||
printf(" -t --test TEST Executes only tests with given name\n");
|
printf(" -t --test TEST Executes only tests with given name\n");
|
||||||
printf(" -ts --name-contains SUBSTR Executes only tests that have given\n");
|
printf(" -ts --name-contains SUBSTR Executes only tests that have given\n");
|
||||||
printf(" substring in test name\n");
|
printf(" substring in test name\n");
|
||||||
|
@ -539,9 +542,8 @@ ParseOptions(int argc, char *argv[])
|
||||||
if(SDL_strcmp(arg, "--in-proc") == 0) {
|
if(SDL_strcmp(arg, "--in-proc") == 0) {
|
||||||
execute_inproc = 1;
|
execute_inproc = 1;
|
||||||
}
|
}
|
||||||
else if(SDL_strcmp(arg, "--help") == 0 || SDL_strcmp(arg, "-h") == 0) {
|
else if(SDL_strcmp(arg, "--show-tests") == 0) {
|
||||||
printUsage();
|
only_print_tests = 1;
|
||||||
exit(0);
|
|
||||||
}
|
}
|
||||||
else if(SDL_strcmp(arg, "--test") == 0 || SDL_strcmp(arg, "-t") == 0) {
|
else if(SDL_strcmp(arg, "--test") == 0 || SDL_strcmp(arg, "-t") == 0) {
|
||||||
only_selected_test = 1;
|
only_selected_test = 1;
|
||||||
|
@ -588,6 +590,10 @@ ParseOptions(int argc, char *argv[])
|
||||||
memset(selected_suite_name, 0, NAME_BUFFER_SIZE);
|
memset(selected_suite_name, 0, NAME_BUFFER_SIZE);
|
||||||
strcpy(selected_suite_name, suiteName);
|
strcpy(selected_suite_name, suiteName);
|
||||||
}
|
}
|
||||||
|
else if(SDL_strcmp(arg, "--help") == 0 || SDL_strcmp(arg, "-h") == 0) {
|
||||||
|
printUsage();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
printf("runner: unknown command '%s'\n", arg);
|
printf("runner: unknown command '%s'\n", arg);
|
||||||
printUsage();
|
printUsage();
|
||||||
|
@ -627,6 +633,16 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
TestCase *testCases = LoadTestCases(suites);
|
TestCase *testCases = LoadTestCases(suites);
|
||||||
|
|
||||||
|
// if --show-tests option is given, only print tests and exit
|
||||||
|
if(only_print_tests) {
|
||||||
|
TestCase *testItem = NULL;
|
||||||
|
for(testItem = testCases; testItem; testItem = testItem->next) {
|
||||||
|
printf("%s (in %s)\n", testItem->testName, testItem->suiteName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
TestCase *testItem = NULL;
|
TestCase *testItem = NULL;
|
||||||
for(testItem = testCases; testItem; testItem = testItem->next) {
|
for(testItem = testCases; testItem; testItem = testItem->next) {
|
||||||
int retVal = ExecuteTest(testItem);
|
int retVal = ExecuteTest(testItem);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue