Fix compiler warning; minor harness driver cleanup; fix test build for SDL versions compiled with --disable-joystick or --disable-haptic
authorAndreas Schiffler <aschiffler@ferzkopp.net>
Sat, 22 Dec 2012 20:43:51 -0800
changeset 677155337ff4256f
parent 6770 9a111d2aa992
child 6772 5229a117ef97
Fix compiler warning; minor harness driver cleanup; fix test build for SDL versions compiled with --disable-joystick or --disable-haptic
src/test/SDL_test_harness.c
test/testautomation.c
test/testgamecontroller.c
test/testhaptic.c
test/testjoystick.c
test/testrumble.c
     1.1 --- a/src/test/SDL_test_harness.c	Sat Dec 22 20:13:25 2012 -0800
     1.2 +++ b/src/test/SDL_test_harness.c	Sat Dec 22 20:43:51 2012 -0800
     1.3 @@ -502,7 +502,7 @@
     1.4  						if (userExecKey != 0) {
     1.5  							execKey = userExecKey;
     1.6  						} else {
     1.7 -							execKey = SDLTest_GenerateExecKey(runSeed, testSuite->name, testCase->name, iterationCounter);
     1.8 +							execKey = SDLTest_GenerateExecKey((char *)runSeed, testSuite->name, testCase->name, iterationCounter);
     1.9  						}
    1.10  
    1.11  						SDLTest_Log("Test Iteration %i: execKey %llu", iterationCounter, execKey);
     2.1 --- a/test/testautomation.c	Sat Dec 22 20:13:25 2012 -0800
     2.2 +++ b/test/testautomation.c	Sat Dec 22 20:43:51 2012 -0800
     2.3 @@ -21,7 +21,6 @@
     2.4  
     2.5  static SDLTest_CommonState *state;
     2.6  
     2.7 -
     2.8  /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
     2.9  static void
    2.10  quit(int rc)
    2.11 @@ -46,9 +45,6 @@
    2.12          return 1;
    2.13      }
    2.14  
    2.15 -    // Needed?
    2.16 -    // state->window_flags |= SDL_WINDOW_RESIZABLE;
    2.17 -
    2.18      /* Parse commandline */
    2.19      for (i = 1; i < argc;) {
    2.20          int consumed;
    2.21 @@ -84,7 +80,7 @@
    2.22          }
    2.23          if (consumed < 0) {
    2.24              fprintf(stderr,
    2.25 -                    "Usage: %s %s [--iterations #] [--execKey #] [--seed string]\n",
    2.26 +                    "Usage: %s %s [--iterations #] [--execKey #] [--seed string] [--filter suite_name|test_name]\n",
    2.27                      argv[0], SDLTest_CommonUsage(state));
    2.28              quit(1);
    2.29          }
     3.1 --- a/test/testgamecontroller.c	Sat Dec 22 20:13:25 2012 -0800
     3.2 +++ b/test/testgamecontroller.c	Sat Dec 22 20:43:51 2012 -0800
     3.3 @@ -18,6 +18,8 @@
     3.4  
     3.5  #include "SDL.h"
     3.6  
     3.7 +#ifndef SDL_JOYSTICK_DISABLED
     3.8 +
     3.9  #ifdef __IPHONEOS__
    3.10  #define SCREEN_WIDTH	320
    3.11  #define SCREEN_HEIGHT	480
    3.12 @@ -203,3 +205,14 @@
    3.13  
    3.14      return (0);
    3.15  }
    3.16 +
    3.17 +#else
    3.18 +
    3.19 +int
    3.20 +main(int argc, char *argv[])
    3.21 +{
    3.22 +    fprintf(stderr, "SDL compiled without Joystick support.\n");
    3.23 +    exit(1);
    3.24 +}
    3.25 +
    3.26 +#endif
     4.1 --- a/test/testhaptic.c	Sat Dec 22 20:13:25 2012 -0800
     4.2 +++ b/test/testhaptic.c	Sat Dec 22 20:43:51 2012 -0800
     4.3 @@ -26,13 +26,15 @@
     4.4   * includes
     4.5   */
     4.6  #include <stdlib.h>
     4.7 -#include "SDL.h"
     4.8 -#include "SDL_haptic.h"
     4.9 -
    4.10  #include <stdio.h>              /* printf */
    4.11  #include <string.h>             /* strstr */
    4.12  #include <ctype.h>              /* isdigit */
    4.13  
    4.14 +#include "SDL.h"
    4.15 +
    4.16 +#ifndef SDL_HAPTIC_DISABLED
    4.17 +
    4.18 +#include "SDL_haptic.h"
    4.19  
    4.20  static SDL_Haptic *haptic;
    4.21  
    4.22 @@ -286,3 +288,14 @@
    4.23      if (supported & SDL_HAPTIC_STATUS)
    4.24          printf("      status\n");
    4.25  }
    4.26 +
    4.27 +#else
    4.28 +
    4.29 +int
    4.30 +main(int argc, char *argv[])
    4.31 +{
    4.32 +    fprintf(stderr, "SDL compiled without Haptic support.\n");
    4.33 +    exit(1);
    4.34 +}
    4.35 +
    4.36 +#endif
     5.1 --- a/test/testjoystick.c	Sat Dec 22 20:13:25 2012 -0800
     5.2 +++ b/test/testjoystick.c	Sat Dec 22 20:43:51 2012 -0800
     5.3 @@ -18,6 +18,8 @@
     5.4  
     5.5  #include "SDL.h"
     5.6  
     5.7 +#ifndef SDL_JOYSTICK_DISABLED
     5.8 +
     5.9  #ifdef __IPHONEOS__
    5.10  #define SCREEN_WIDTH	320
    5.11  #define SCREEN_HEIGHT	480
    5.12 @@ -29,6 +31,7 @@
    5.13  #define MAX_NUM_AXES 6
    5.14  #define MAX_NUM_HATS 2
    5.15  
    5.16 +
    5.17  static void
    5.18  DrawRect(SDL_Renderer *r, const int x, const int y, const int w, const int h)
    5.19  {
    5.20 @@ -269,3 +272,14 @@
    5.21  
    5.22      return 0;
    5.23  }
    5.24 +
    5.25 +#else
    5.26 +
    5.27 +int
    5.28 +main(int argc, char *argv[])
    5.29 +{
    5.30 +    fprintf(stderr, "SDL compiled without Joystick support.\n");
    5.31 +    exit(1);
    5.32 +}
    5.33 +
    5.34 +#endif
     6.1 --- a/test/testrumble.c	Sat Dec 22 20:13:25 2012 -0800
     6.2 +++ b/test/testrumble.c	Sat Dec 22 20:43:51 2012 -0800
     6.3 @@ -26,13 +26,15 @@
     6.4   * includes
     6.5   */
     6.6  #include <stdlib.h>
     6.7 -#include "SDL.h"
     6.8 -#include "SDL_haptic.h"
     6.9 -
    6.10  #include <stdio.h>              /* printf */
    6.11  #include <string.h>             /* strstr */
    6.12  #include <ctype.h>              /* isdigit */
    6.13  
    6.14 +#include "SDL.h"
    6.15 +
    6.16 +#ifndef SDL_HAPTIC_DISABLED
    6.17 +
    6.18 +#include "SDL_haptic.h"
    6.19  
    6.20  static SDL_Haptic *haptic;
    6.21  
    6.22 @@ -142,3 +144,13 @@
    6.23      return 0;
    6.24  }
    6.25  
    6.26 +#else
    6.27 +
    6.28 +int
    6.29 +main(int argc, char *argv[])
    6.30 +{
    6.31 +    fprintf(stderr, "SDL compiled without Haptic support.\n");
    6.32 +    exit(1);
    6.33 +}
    6.34 +
    6.35 +#endif