testautomation.c File Reference
`#include <stdlib.h>`
`#include <stdio.h>`
`#include <time.h>`
`#include "SDL.h"`
`#include "SDL_test.h"`
`#include "testautomation_suites.h"`
Include dependency graph for testautomation.c:

Go to the source code of this file.

## Functions

static void | quit (int rc)
int | main (int argc, char *argv[])

## Variables

static SDLTest_CommonState * | state

## Function Documentation

int main | ( | int | argc,
|  | char * | argv[]
| ) |  |

Definition at line 33 of file testautomation.c.

References done, i, NULL, SDLTest_CommonState::num_windows, quit(), renderer, SDLTest_CommonState::renderers, SDL_atoi, SDL_Delay, SDL_free(), SDL_INIT_VIDEO, SDL_Log, SDL_PollEvent, SDL_PRIu64, SDL_RenderClear, SDL_SetRenderDrawColor, SDL_sscanf, SDL_strcasecmp, SDL_strdup, SDLTest_CommonArg(), SDLTest_CommonCreateState(), SDLTest_CommonEvent(), SDLTest_CommonInit(), SDLTest_CommonUsage(), SDLTest_RunSuites(), and testSuites.

{
int result;
int testIterations = 1;
Uint64 userExecKey = 0;
char *userRunSeed = NULL;
char *filter = NULL;
int i, done;
SDL_Event event;
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
if (!state) {
return 1;
}
/* Parse commandline */
for (i = 1; i < argc;) {
int consumed;
consumed = SDLTest_CommonArg(state, i);
if (consumed == 0) {
consumed = -1;
if (SDL_strcasecmp(argv[i], "--iterations") == 0) {
if (argv[i + 1]) {
testIterations = SDL_atoi(argv[i + 1]);
if (testIterations < 1) testIterations = 1;
consumed = 2;
}
}
else if (SDL_strcasecmp(argv[i], "--execKey") == 0) {
if (argv[i + 1]) {
SDL_sscanf(argv[i + 1], "%"SDL_PRIu64, (long long unsigned int *)&userExecKey);
consumed = 2;
}
}
else if (SDL_strcasecmp(argv[i], "--seed") == 0) {
if (argv[i + 1]) {
userRunSeed = SDL_strdup(argv[i + 1]);
consumed = 2;
}
}
else if (SDL_strcasecmp(argv[i], "--filter") == 0) {
if (argv[i + 1]) {
filter = SDL_strdup(argv[i + 1]);
consumed = 2;
}
}
}
if (consumed < 0) {
SDL_Log("Usage: %s %s [--iterations #] [--execKey #] [--seed string] [--filter suite_name|test_name]\n",
argv[0], SDLTest_CommonUsage(state));
quit(1);
}
i += consumed;
}
/* Initialize common state */
if (!SDLTest_CommonInit(state)) {
quit(2);
}
/* Create the windows, initialize the renderers */
for (i = 0; i < state->num_windows; ++i) {
SDL_Renderer *renderer = state->renderers[i];
SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
SDL_RenderClear(renderer);
}
/* Call Harness */
result = SDLTest_RunSuites(testSuites, (const char *)userRunSeed, userExecKey, (const char *)filter, testIterations);
/* Empty event queue */
done = 0;
for (i=0; i<100; i++) {
while (SDL_PollEvent(&event)) {
SDLTest_CommonEvent(state, &event, &done);
}
SDL_Delay(10);
}
/* Clean up */
SDL_free(userRunSeed);
SDL_free(filter);
/* Shutdown everything */
quit(result);
return(result);
}
SDL_PollEvent
#define SDL_PollEvent
Definition: SDL_dynapi_overrides.h:128
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9432
SDLTest_CommonCreateState
SDLTest_CommonState * SDLTest_CommonCreateState(char **argv, Uint32 flags)
Parse command line parameters and create common state.
Definition: SDL_test_common.c:36
SDLTest_CommonArg
int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
Process one common argument.
Definition: SDL_test_common.c:83
SDL_Renderer
Definition: SDL_sysrender.h:76
quit
static void quit(int rc)
Definition: testautomation.c:26
SDL_strcasecmp
#define SDL_strcasecmp
Definition: SDL_dynapi_overrides.h:425
SDLTest_CommonInit
SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state)
Open test window.
Definition: SDL_test_common.c:645
Uint64
uint64_t Uint64
An unsigned 64-bit integer type.
Definition: SDL_stdinc.h:166
SDLTest_CommonState::num_windows
int num_windows
Definition: SDL_test_common.h:77
renderer
SDL_Renderer * renderer
Definition: testautomation_render.c:27
SDL_Log
#define SDL_Log
Definition: SDL_dynapi_overrides.h:37
SDLTest_CommonEvent
void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done)
Common event handler for test windows.
Definition: SDL_test_common.c:1295
event
struct _cl_event * event
Definition: SDL_opengl_glext.h:2649
SDL_free
void SDL_free(void *mem)
done
int done
Definition: checkkeys.c:28
SDL_sscanf
#define SDL_sscanf
Definition: SDL_dynapi_overrides.h:45
SDLTest_CommonUsage
const char * SDLTest_CommonUsage(SDLTest_CommonState *state)
Returns common usage information.
Definition: SDL_test_common.c:451
SDL_atoi
#define SDL_atoi
Definition: SDL_dynapi_overrides.h:416
SDL_Delay
#define SDL_Delay
Definition: SDL_dynapi_overrides.h:490
SDLTest_CommonState::renderers
SDL_Renderer ** renderers
Definition: SDL_test_common.h:84
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
NULL
#define NULL
Definition: begin_code.h:143
SDL_RenderClear
#define SDL_RenderClear
Definition: SDL_dynapi_overrides.h:340
SDL_strdup
#define SDL_strdup
Definition: SDL_dynapi_overrides.h:403
SDL_PRIu64
#define SDL_PRIu64
Definition: SDL_stdinc.h:188
SDL_Event
General event structure.
Definition: SDL_events.h:521
SDL_SetRenderDrawColor
#define SDL_SetRenderDrawColor
Definition: SDL_dynapi_overrides.h:336
SDLTest_RunSuites
int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations)
Execute a test suite using the given run seed and execution key.
Definition: SDL_test_harness.c:365
state
static SDLTest_CommonState * state
Definition: testautomation.c:22
SDL_INIT_VIDEO
#define SDL_INIT_VIDEO
Definition: SDL.h:77
filter
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: SDL_opengl_glext.h:1184
testSuites
SDLTest_TestSuiteReference * testSuites[]
Definition: testautomation_suites.h:32

static void quit | ( | int | rc | ) |

static

Definition at line 26 of file testautomation.c.

References SDLTest_CommonQuit().

Referenced by main().

{
SDLTest_CommonQuit(state);
exit(rc);
}
state
static SDLTest_CommonState * state
Definition: testautomation.c:22
SDLTest_CommonQuit
void SDLTest_CommonQuit(SDLTest_CommonState *state)
Close test window.
Definition: SDL_test_common.c:1560

## Variable Documentation

SDLTest_CommonState* state

static

Definition at line 22 of file testautomation.c.