visualtest/include/SDL_visualtest_harness_argparser.h
author Ryan C. Gordon <icculus@icculus.org>
Sun, 10 Nov 2013 00:32:23 -0500
changeset 7924 fcb86d323770
child 11382 2c50e79b19e0
permissions -rwxr-xr-x
Added Apoorv Upreti's GSoC2013 work: visual test suite.

See visualtest/README.txt for details.
icculus@7924
     1
/**
icculus@7924
     2
 *  \file SDL_visualtest_harness_argparser.h
icculus@7924
     3
 *
icculus@7924
     4
 *  Provides functionality to parse command line arguments to the test harness.
icculus@7924
     5
 */
icculus@7924
     6
icculus@7924
     7
#include <SDL.h>
icculus@7924
     8
#include "SDL_visualtest_sut_configparser.h"
icculus@7924
     9
#include "SDL_visualtest_variator_common.h"
icculus@7924
    10
#include "SDL_visualtest_action_configparser.h"
icculus@7924
    11
icculus@7924
    12
#ifndef _SDL_visualtest_harness_argparser_h
icculus@7924
    13
#define _SDL_visualtest_harness_argparser_h
icculus@7924
    14
icculus@7924
    15
/** Maximum length of a path string */
icculus@7924
    16
#define MAX_PATH_LEN 300
icculus@7924
    17
/** Maximum length of a string of SUT arguments */
icculus@7924
    18
#define MAX_SUT_ARGS_LEN 600
icculus@7924
    19
icculus@7924
    20
/* Set up for C function definitions, even when using C++ */
icculus@7924
    21
#ifdef __cplusplus
icculus@7924
    22
extern "C" {
icculus@7924
    23
#endif
icculus@7924
    24
icculus@7924
    25
/**
icculus@7924
    26
 * Stores the state of the test harness.
icculus@7924
    27
 */
icculus@7924
    28
typedef struct SDLVisualTest_HarnessState
icculus@7924
    29
{
icculus@7924
    30
    /*! Path to the System Under Test (SUT) executable */
icculus@7924
    31
    char sutapp[MAX_PATH_LEN];
icculus@7924
    32
    /*! Command line arguments to be passed to the SUT */
icculus@7924
    33
    char sutargs[MAX_SUT_ARGS_LEN];
icculus@7924
    34
    /*! Time in milliseconds after which to kill the SUT */
icculus@7924
    35
    int timeout;
icculus@7924
    36
    /*! Configuration object for the SUT */
icculus@7924
    37
    SDLVisualTest_SUTConfig sut_config;
icculus@7924
    38
    /*! What type of variator to use to generate argument strings */
icculus@7924
    39
    SDLVisualTest_VariatorType variator_type;
icculus@7924
    40
    /*! The number of variations to generate */
icculus@7924
    41
    int num_variations;
icculus@7924
    42
    /*! If true, the test harness will just print the different variations
icculus@7924
    43
        without launching the SUT for each one */
icculus@7924
    44
    SDL_bool no_launch;
icculus@7924
    45
    /*! A queue with actions to be performed while the SUT is running */
icculus@7924
    46
    SDLVisualTest_ActionQueue action_queue;
icculus@7924
    47
    /*! Output directory to save the screenshots */
icculus@7924
    48
    char output_dir[MAX_PATH_LEN];
icculus@7924
    49
    /*! Path to directory with the verification images */
icculus@7924
    50
    char verify_dir[MAX_PATH_LEN];
icculus@7924
    51
} SDLVisualTest_HarnessState;
icculus@7924
    52
icculus@7924
    53
/**
icculus@7924
    54
 * Parse command line paramters to the test harness and populate a state object.
icculus@7924
    55
 *
icculus@7924
    56
 * \param argv  The array of command line parameters.
icculus@7924
    57
 * \param state Pointer to the state object to be populated.
icculus@7924
    58
 *
icculus@7924
    59
 * \return Non-zero on success, zero on failure.
icculus@7924
    60
 */
icculus@7924
    61
int SDLVisualTest_ParseHarnessArgs(char** argv, SDLVisualTest_HarnessState* state);
icculus@7924
    62
icculus@7924
    63
/**
icculus@7924
    64
 * Frees any resources associated with the state object pointed to by \c state.
icculus@7924
    65
 */
icculus@7924
    66
void SDLVisualTest_FreeHarnessState(SDLVisualTest_HarnessState* state);
icculus@7924
    67
icculus@7924
    68
/* Ends C function definitions when using C++ */
icculus@7924
    69
#ifdef __cplusplus
icculus@7924
    70
}
icculus@7924
    71
#endif
icculus@7924
    72
icculus@7924
    73
#endif /* _SDL_visualtest_harness_argparser_h */