Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Added new command line option: --show-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mkauppila committed Jun 13, 2011
1 parent d548006 commit 4655d83
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions test/test-automation/runner.c
Expand Up @@ -41,6 +41,8 @@ typedef int (*TestCaseQuitFp)(void);

//!< Flag for executing tests in-process
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
static int only_selected_test = 0;
//!< Flag for executing only the selected test suite
Expand Down Expand Up @@ -514,6 +516,7 @@ printUsage() {
printf(" [--name-contains SUBSTR] [--help]\n");
printf("Options:\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(" -ts --name-contains SUBSTR Executes only tests that have given\n");
printf(" substring in test name\n");
Expand All @@ -539,9 +542,8 @@ ParseOptions(int argc, char *argv[])
if(SDL_strcmp(arg, "--in-proc") == 0) {
execute_inproc = 1;
}
else if(SDL_strcmp(arg, "--help") == 0 || SDL_strcmp(arg, "-h") == 0) {
printUsage();
exit(0);
else if(SDL_strcmp(arg, "--show-tests") == 0) {
only_print_tests = 1;
}
else if(SDL_strcmp(arg, "--test") == 0 || SDL_strcmp(arg, "-t") == 0) {
only_selected_test = 1;
Expand Down Expand Up @@ -588,6 +590,10 @@ ParseOptions(int argc, char *argv[])
memset(selected_suite_name, 0, NAME_BUFFER_SIZE);
strcpy(selected_suite_name, suiteName);
}
else if(SDL_strcmp(arg, "--help") == 0 || SDL_strcmp(arg, "-h") == 0) {
printUsage();
exit(0);
}
else {
printf("runner: unknown command '%s'\n", arg);
printUsage();
Expand Down Expand Up @@ -627,6 +633,16 @@ main(int argc, char *argv[])

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;
for(testItem = testCases; testItem; testItem = testItem->next) {
int retVal = ExecuteTest(testItem);
Expand Down

0 comments on commit 4655d83

Please sign in to comment.