From 6ed6a4635003fb5dc492589e8a2dac6cd577b2e6 Mon Sep 17 00:00:00 2001 From: Andreas Schiffler Date: Sat, 22 Dec 2012 20:43:51 -0800 Subject: [PATCH] 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 | 2 +- test/testautomation.c | 6 +----- test/testgamecontroller.c | 13 +++++++++++++ test/testhaptic.c | 19 ++++++++++++++++--- test/testjoystick.c | 14 ++++++++++++++ test/testrumble.c | 18 +++++++++++++++--- 6 files changed, 60 insertions(+), 12 deletions(-) diff --git a/src/test/SDL_test_harness.c b/src/test/SDL_test_harness.c index 5dd17d9a8..bccdd0f3d 100644 --- a/src/test/SDL_test_harness.c +++ b/src/test/SDL_test_harness.c @@ -502,7 +502,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user if (userExecKey != 0) { execKey = userExecKey; } else { - execKey = SDLTest_GenerateExecKey(runSeed, testSuite->name, testCase->name, iterationCounter); + execKey = SDLTest_GenerateExecKey((char *)runSeed, testSuite->name, testCase->name, iterationCounter); } SDLTest_Log("Test Iteration %i: execKey %llu", iterationCounter, execKey); diff --git a/test/testautomation.c b/test/testautomation.c index 160d9f9db..19a4e6099 100644 --- a/test/testautomation.c +++ b/test/testautomation.c @@ -21,7 +21,6 @@ static SDLTest_CommonState *state; - /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void quit(int rc) @@ -46,9 +45,6 @@ main(int argc, char *argv[]) return 1; } - // Needed? - // state->window_flags |= SDL_WINDOW_RESIZABLE; - /* Parse commandline */ for (i = 1; i < argc;) { int consumed; @@ -84,7 +80,7 @@ main(int argc, char *argv[]) } if (consumed < 0) { fprintf(stderr, - "Usage: %s %s [--iterations #] [--execKey #] [--seed string]\n", + "Usage: %s %s [--iterations #] [--execKey #] [--seed string] [--filter suite_name|test_name]\n", argv[0], SDLTest_CommonUsage(state)); quit(1); } diff --git a/test/testgamecontroller.c b/test/testgamecontroller.c index 2afa9baea..7c1d9bcc2 100644 --- a/test/testgamecontroller.c +++ b/test/testgamecontroller.c @@ -18,6 +18,8 @@ #include "SDL.h" +#ifndef SDL_JOYSTICK_DISABLED + #ifdef __IPHONEOS__ #define SCREEN_WIDTH 320 #define SCREEN_HEIGHT 480 @@ -203,3 +205,14 @@ main(int argc, char *argv[]) return (0); } + +#else + +int +main(int argc, char *argv[]) +{ + fprintf(stderr, "SDL compiled without Joystick support.\n"); + exit(1); +} + +#endif diff --git a/test/testhaptic.c b/test/testhaptic.c index 670d9af73..2a8c2f42c 100644 --- a/test/testhaptic.c +++ b/test/testhaptic.c @@ -26,13 +26,15 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * includes */ #include -#include "SDL.h" -#include "SDL_haptic.h" - #include /* printf */ #include /* strstr */ #include /* isdigit */ +#include "SDL.h" + +#ifndef SDL_HAPTIC_DISABLED + +#include "SDL_haptic.h" static SDL_Haptic *haptic; @@ -286,3 +288,14 @@ HapticPrintSupported(SDL_Haptic * haptic) if (supported & SDL_HAPTIC_STATUS) printf(" status\n"); } + +#else + +int +main(int argc, char *argv[]) +{ + fprintf(stderr, "SDL compiled without Haptic support.\n"); + exit(1); +} + +#endif diff --git a/test/testjoystick.c b/test/testjoystick.c index 74ac476a3..af990ad9a 100644 --- a/test/testjoystick.c +++ b/test/testjoystick.c @@ -18,6 +18,8 @@ #include "SDL.h" +#ifndef SDL_JOYSTICK_DISABLED + #ifdef __IPHONEOS__ #define SCREEN_WIDTH 320 #define SCREEN_HEIGHT 480 @@ -29,6 +31,7 @@ #define MAX_NUM_AXES 6 #define MAX_NUM_HATS 2 + static void DrawRect(SDL_Renderer *r, const int x, const int y, const int w, const int h) { @@ -269,3 +272,14 @@ main(int argc, char *argv[]) return 0; } + +#else + +int +main(int argc, char *argv[]) +{ + fprintf(stderr, "SDL compiled without Joystick support.\n"); + exit(1); +} + +#endif diff --git a/test/testrumble.c b/test/testrumble.c index 0f159ca04..6efc42c2b 100644 --- a/test/testrumble.c +++ b/test/testrumble.c @@ -26,13 +26,15 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * includes */ #include -#include "SDL.h" -#include "SDL_haptic.h" - #include /* printf */ #include /* strstr */ #include /* isdigit */ +#include "SDL.h" + +#ifndef SDL_HAPTIC_DISABLED + +#include "SDL_haptic.h" static SDL_Haptic *haptic; @@ -142,3 +144,13 @@ main(int argc, char **argv) return 0; } +#else + +int +main(int argc, char *argv[]) +{ + fprintf(stderr, "SDL compiled without Haptic support.\n"); + exit(1); +} + +#endif