test/testautomation.c
changeset 6757 9935f71c8c81
parent 6756 398073b195bb
child 6763 9cbd31a3450b
     1.1 --- a/test/testautomation.c	Fri Dec 14 23:05:34 2012 -0800
     1.2 +++ b/test/testautomation.c	Sat Dec 15 21:50:17 2012 -0800
     1.3 @@ -34,6 +34,9 @@
     1.4  main(int argc, char *argv[])
     1.5  {
     1.6      int result;
     1.7 +    int testIterations = 1;
     1.8 +    Uint64 userExecKey = 0;
     1.9 +    char *userRunSeed = NULL;
    1.10      int i;
    1.11  
    1.12      /* Initialize test framework */
    1.13 @@ -52,27 +55,33 @@
    1.14          consumed = SDLTest_CommonArg(state, i);
    1.15          if (consumed == 0) {
    1.16              consumed = -1;
    1.17 -/* Parse additional parameters
    1.18 -
    1.19 -            if (SDL_strcasecmp(argv[i], "--BLAH") == 0) {
    1.20 +            if (SDL_strcasecmp(argv[i], "--iterations") == 0) {
    1.21                  if (argv[i + 1]) {
    1.22 -                    if (SDL_strcasecmp(argv[i + 1], "BLUB") == 0) {
    1.23 -                        blah = blub;
    1.24 -                        consumed = 2;
    1.25 -                    }
    1.26 +                    testIterations = SDL_atoi(argv[i + 1]);
    1.27 +                    if (testIterations < 1) testIterations = 1;
    1.28 +                    consumed = 2;                    
    1.29                  }
    1.30 -            } else if (SDL_strcasecmp(argv[i], "--BINGO") == 0) {
    1.31 -                bingo = SDL_TRUE;
    1.32 -                consumed = 1;
    1.33 -            }
    1.34 -*/
    1.35 +            } 
    1.36 +            else if (SDL_strcasecmp(argv[i], "--execKey") == 0) {
    1.37 +                if (argv[i + 1]) {
    1.38 +                    SDL_sscanf(argv[i + 1], "%llu", &userExecKey);
    1.39 +                    consumed = 2;                    
    1.40 +                }
    1.41 +            } 
    1.42 +            else if (SDL_strcasecmp(argv[i], "--seed") == 0) {
    1.43 +                if (argv[i + 1]) {
    1.44 +                    userRunSeed = SDL_strdup(argv[i + 1]);
    1.45 +                    consumed = 2;
    1.46 +                }
    1.47 +            } 
    1.48          }
    1.49          if (consumed < 0) {
    1.50              fprintf(stderr,
    1.51 -                    "Usage: %s %s [--BLAH BLUB --BINGO]\n",
    1.52 +                    "Usage: %s %s [--iterations #] [--execKey #] [--seed string]\n",
    1.53                      argv[0], SDLTest_CommonUsage(state));
    1.54              quit(1);
    1.55          }
    1.56 +        
    1.57          i += consumed;
    1.58      }
    1.59  
    1.60 @@ -89,10 +98,13 @@
    1.61      }
    1.62  
    1.63      /* Call Harness */
    1.64 -    // TODO: pass custom parameters
    1.65 -    result = SDLTest_RunSuites(testSuites, NULL, 0, 1);
    1.66 -//int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites, char *userRunSeed, Uint64 userExecKey, int testIterations);
    1.67 -    
    1.68 +    result = SDLTest_RunSuites(testSuites, userRunSeed, userExecKey, testIterations);
    1.69 +
    1.70 +    /* Clean up */
    1.71 +    if (userRunSeed != NULL) {
    1.72 +        SDL_free(userRunSeed);
    1.73 +    }
    1.74 +        
    1.75      /* Shutdown everything */
    1.76      quit(result);        
    1.77      return(result);