Fixed option parsing code of test harness.
authorMarkus Kauppila <markus.kauppila@gmail.com>
Sun, 18 Sep 2011 13:01:33 +0300
changeset 5959d773f75cea1a
parent 5958 e1624f3b29b5
child 5961 3bd7ed5f3895
Fixed option parsing code of test harness.
test/test-automation/src/runner/runner.c
     1.1 --- a/test/test-automation/src/runner/runner.c	Sun Sep 18 03:52:08 2011 +0000
     1.2 +++ b/test/test-automation/src/runner/runner.c	Sun Sep 18 13:01:33 2011 +0300
     1.3 @@ -1146,7 +1146,7 @@
     1.4        else if(SDL_strcmp(arg, "--logdir") == 0) {
     1.5      	  char *dirString = NULL;
     1.6  
     1.7 -    	  if( (i + 1) < argc)  {
     1.8 +    	  if( (i + 1) < argc && argv[i+1][0] != '-')  {
     1.9      		  dirString = argv[++i];
    1.10      	  }  else {
    1.11      		  printf("runner: dir is missing\n");
    1.12 @@ -1162,7 +1162,7 @@
    1.13        else if(SDL_strcmp(arg, "--logfile") == 0) {
    1.14  		  char *fileString = NULL;
    1.15  
    1.16 -		  if( (i + 1) < argc)  {
    1.17 +		  if( (i + 1) < argc && argv[i+1][0] != '-')  {
    1.18  			  fileString = argv[++i];
    1.19  		  }  else {
    1.20  			  fileString = DEFAULT_LOG_FILENAME;
    1.21 @@ -1177,7 +1177,7 @@
    1.22      	  universal_timeout_enabled = 1;
    1.23      	  char *timeoutString = NULL;
    1.24  
    1.25 -    	  if( (i + 1) < argc)  {
    1.26 +    	  if( (i + 1) < argc && argv[i+1][0] != '-')  {
    1.27      		  timeoutString = argv[++i];
    1.28      	  }  else {
    1.29      		  printf("runner: timeout is missing\n");
    1.30 @@ -1190,7 +1190,7 @@
    1.31        else if(SDL_strcmp(arg, "--seed") == 0) {
    1.32      	  userRunSeed = 1;
    1.33  
    1.34 -    	  if( (i + 1) < argc)  {
    1.35 +    	  if( (i + 1) < argc && argv[i+1][0] != '-')  {
    1.36      		  runSeed = argv[++i];
    1.37      	  }  else {
    1.38      		  printf("runner: seed value is missing\n");
    1.39 @@ -1201,7 +1201,7 @@
    1.40        }
    1.41        else if(SDL_strcmp(arg, "--iterations") == 0) {
    1.42      	  char *iterationsString = NULL;
    1.43 -    	  if( (i + 1) < argc)  {
    1.44 +    	  if( (i + 1) < argc && argv[i+1][0] != '-')  {
    1.45      		  iterationsString = argv[++i];
    1.46      	  }  else {
    1.47      		  printf("runner: iterations value is missing\n");
    1.48 @@ -1217,7 +1217,7 @@
    1.49        }
    1.50        else if(SDL_strcmp(arg, "--exec-key") == 0) {
    1.51      	  char *execKeyString = NULL;
    1.52 -    	  if( (i + 1) < argc)  {
    1.53 +    	  if( (i + 1) < argc && argv[i+1][0] != '-')  {
    1.54      		  execKeyString = argv[++i];
    1.55      	  }  else {
    1.56      		  printf("runner: execkey value is missing\n");
    1.57 @@ -1235,7 +1235,7 @@
    1.58      	  only_selected_test = 1;
    1.59      	  char *testName = NULL;
    1.60  
    1.61 -    	  if( (i + 1) < argc)  {
    1.62 +    	  if( (i + 1) < argc && argv[i+1][0] != '-')  {
    1.63      		  testName = argv[++i];
    1.64      	  }  else {
    1.65      		  printf("runner: test name is missing\n");
    1.66 @@ -1249,7 +1249,7 @@
    1.67        else if(SDL_strcmp(arg, "--xsl") == 0) {
    1.68      	  xsl_enabled = 1;
    1.69  
    1.70 -    	  if( (i + 1) < argc)  {
    1.71 +    	  if( (i + 1) < argc && argv[i+1][0] != '-')  {
    1.72      		  char *stylesheet = argv[++i];
    1.73      		  if(stylesheet[0] != '-') {
    1.74      	    	  custom_xsl_enabled = 1;
    1.75 @@ -1263,7 +1263,7 @@
    1.76      	  only_tests_with_string = 1;
    1.77      	  char *substring = NULL;
    1.78  
    1.79 -    	  if( (i + 1) < argc)  {
    1.80 +    	  if( (i + 1) < argc && argv[i+1][0] != '-')  {
    1.81      		  substring = argv[++i];
    1.82      	  }  else {
    1.83      		  printf("runner: substring of test name is missing\n");
    1.84 @@ -1278,7 +1278,7 @@
    1.85      	  only_selected_suite = 1;
    1.86  
    1.87      	  char *suiteName = NULL;
    1.88 -    	  if( (i + 1) < argc)  {
    1.89 +    	  if( (i + 1) < argc && argv[i+1][0] != '-')  {
    1.90      		  suiteName = argv[++i];
    1.91      	  }  else {
    1.92      		  printf("runner: suite name is missing\n");