test/test-automation/src/runner/runner.c
changeset 5827 ef0942587b80
parent 5826 ac41301850c1
child 5830 e1a6cc820772
equal deleted inserted replaced
5826:ac41301850c1 5827:ef0942587b80
    76 static int enable_verbose_logger = 0;
    76 static int enable_verbose_logger = 0;
    77 //! Flag for using user supplied run seed
    77 //! Flag for using user supplied run seed
    78 static int userRunSeed = 0;
    78 static int userRunSeed = 0;
    79 //! Whether or not logger should log to stdout instead of file
    79 //! Whether or not logger should log to stdout instead of file
    80 static int log_stdout_enabled = 0;
    80 static int log_stdout_enabled = 0;
       
    81 //! Whether or not dummy suite should be included to the test run
       
    82 static int include_dummy_suite = 0;
    81 
    83 
    82 //!< Size of the test and suite name buffers
    84 //!< Size of the test and suite name buffers
    83 #define NAME_BUFFER_SIZE 1024
    85 #define NAME_BUFFER_SIZE 1024
    84 
    86 
    85 //!< Name of the selected test
    87 //!< Name of the selected test
   106 //! Default directory of the test suites
   108 //! Default directory of the test suites
   107 #define DEFAULT_LOG_FILENAME "runner"
   109 #define DEFAULT_LOG_FILENAME "runner"
   108 
   110 
   109 //! Defines directory separator
   111 //! Defines directory separator
   110 #define DIRECTORY_SEPARATOR '/'
   112 #define DIRECTORY_SEPARATOR '/'
       
   113 
       
   114 #define DUMMY_TEST_NAME "libtestdummy"
   111 
   115 
   112 //! Name of the default stylesheet
   116 //! Name of the default stylesheet
   113 const char *defaultXSLStylesheet = "style.xsl";
   117 const char *defaultXSLStylesheet = "style.xsl";
   114 
   118 
   115 //! Fuzzer seed for the harness
   119 //! Fuzzer seed for the harness
   243 
   247 
   244 			if(name == NULL || ext == NULL) {
   248 			if(name == NULL || ext == NULL) {
   245 				goto error;
   249 				goto error;
   246 			}
   250 			}
   247 
   251 
       
   252 
       
   253 			int ok = 1; // on default, we want to include all tests
       
   254 
   248 			// filter out all other suites but the selected test suite
   255 			// filter out all other suites but the selected test suite
   249 			int ok = 1;
       
   250 			if(only_selected_suite) {
   256 			if(only_selected_suite) {
   251 				ok = SDL_strncmp(selected_suite_name, name, NAME_BUFFER_SIZE) == 0;
   257 				ok = SDL_strncmp(selected_suite_name, name, NAME_BUFFER_SIZE) == 0;
       
   258 			}
       
   259 
       
   260 			if(SDL_strncmp(name, DUMMY_TEST_NAME, NAME_BUFFER_SIZE) == 0) {
       
   261 				if(include_dummy_suite) {
       
   262 					ok =  1;
       
   263 				} else {
       
   264 					ok = 0;
       
   265 				}
   252 			}
   266 			}
   253 
   267 
   254 			if(ok && SDL_strncmp(ext, extension, SDL_strlen(extension))  == 0) {
   268 			if(ok && SDL_strncmp(ext, extension, SDL_strlen(extension))  == 0) {
   255 				// create test suite reference
   269 				// create test suite reference
   256 				reference = (TestSuiteReference *) SDL_malloc(sizeof(TestSuiteReference));
   270 				reference = (TestSuiteReference *) SDL_malloc(sizeof(TestSuiteReference));
  1076 	  printf("                              note: doesn't work with --in-proc option.\n");
  1090 	  printf("                              note: doesn't work with --in-proc option.\n");
  1077 	  printf(" -t  --test TEST              Executes only tests with given name\n");
  1091 	  printf(" -t  --test TEST              Executes only tests with given name\n");
  1078 	  printf(" -ts --name-contains SUBSTR   Executes only tests that have given\n");
  1092 	  printf(" -ts --name-contains SUBSTR   Executes only tests that have given\n");
  1079 	  printf("                              substring in test name\n");
  1093 	  printf("                              substring in test name\n");
  1080 	  printf(" -s  --suite SUITE            Executes only the given test suite\n");
  1094 	  printf(" -s  --suite SUITE            Executes only the given test suite\n");
       
  1095 	  printf("     --include-dummy          Includes dummy test suite in the test run\n");
  1081 
  1096 
  1082 	  printf("     --version                Print version information\n");
  1097 	  printf("     --version                Print version information\n");
  1083 	  printf(" -h  --help                   Print this help\n");
  1098 	  printf(" -h  --help                   Print this help\n");
  1084 }
  1099 }
  1085 
  1100 
  1252     	  }
  1267     	  }
  1253 
  1268 
  1254     	  memset(selected_suite_name, 0, NAME_BUFFER_SIZE);
  1269     	  memset(selected_suite_name, 0, NAME_BUFFER_SIZE);
  1255     	  strcpy(selected_suite_name, suiteName);
  1270     	  strcpy(selected_suite_name, suiteName);
  1256       }
  1271       }
       
  1272       else if(SDL_strcmp(arg, "--include-dummy") == 0) {
       
  1273     	  include_dummy_suite = 1;
       
  1274       }
  1257       else if(SDL_strcmp(arg, "--version") == 0) {
  1275       else if(SDL_strcmp(arg, "--version") == 0) {
  1258     	  fprintf(stdout, "SDL test harness (version %s)\n", PACKAGE_VERSION);
  1276     	  fprintf(stdout, "SDL test harness (version %s)\n", PACKAGE_VERSION);
  1259 
  1277 
  1260      	  // print: Testing against SDL version fuu (rev: bar)
  1278      	  // print: Testing against SDL version fuu (rev: bar)
  1261 
  1279