visualtest/include/SDL_visualtest_harness_argparser.h
changeset 7924 fcb86d323770
child 11382 2c50e79b19e0
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/visualtest/include/SDL_visualtest_harness_argparser.h	Sun Nov 10 00:32:23 2013 -0500
     1.3 @@ -0,0 +1,73 @@
     1.4 +/**
     1.5 + *  \file SDL_visualtest_harness_argparser.h
     1.6 + *
     1.7 + *  Provides functionality to parse command line arguments to the test harness.
     1.8 + */
     1.9 +
    1.10 +#include <SDL.h>
    1.11 +#include "SDL_visualtest_sut_configparser.h"
    1.12 +#include "SDL_visualtest_variator_common.h"
    1.13 +#include "SDL_visualtest_action_configparser.h"
    1.14 +
    1.15 +#ifndef _SDL_visualtest_harness_argparser_h
    1.16 +#define _SDL_visualtest_harness_argparser_h
    1.17 +
    1.18 +/** Maximum length of a path string */
    1.19 +#define MAX_PATH_LEN 300
    1.20 +/** Maximum length of a string of SUT arguments */
    1.21 +#define MAX_SUT_ARGS_LEN 600
    1.22 +
    1.23 +/* Set up for C function definitions, even when using C++ */
    1.24 +#ifdef __cplusplus
    1.25 +extern "C" {
    1.26 +#endif
    1.27 +
    1.28 +/**
    1.29 + * Stores the state of the test harness.
    1.30 + */
    1.31 +typedef struct SDLVisualTest_HarnessState
    1.32 +{
    1.33 +    /*! Path to the System Under Test (SUT) executable */
    1.34 +    char sutapp[MAX_PATH_LEN];
    1.35 +    /*! Command line arguments to be passed to the SUT */
    1.36 +    char sutargs[MAX_SUT_ARGS_LEN];
    1.37 +    /*! Time in milliseconds after which to kill the SUT */
    1.38 +    int timeout;
    1.39 +    /*! Configuration object for the SUT */
    1.40 +    SDLVisualTest_SUTConfig sut_config;
    1.41 +    /*! What type of variator to use to generate argument strings */
    1.42 +    SDLVisualTest_VariatorType variator_type;
    1.43 +    /*! The number of variations to generate */
    1.44 +    int num_variations;
    1.45 +    /*! If true, the test harness will just print the different variations
    1.46 +        without launching the SUT for each one */
    1.47 +    SDL_bool no_launch;
    1.48 +    /*! A queue with actions to be performed while the SUT is running */
    1.49 +    SDLVisualTest_ActionQueue action_queue;
    1.50 +    /*! Output directory to save the screenshots */
    1.51 +    char output_dir[MAX_PATH_LEN];
    1.52 +    /*! Path to directory with the verification images */
    1.53 +    char verify_dir[MAX_PATH_LEN];
    1.54 +} SDLVisualTest_HarnessState;
    1.55 +
    1.56 +/**
    1.57 + * Parse command line paramters to the test harness and populate a state object.
    1.58 + *
    1.59 + * \param argv  The array of command line parameters.
    1.60 + * \param state Pointer to the state object to be populated.
    1.61 + *
    1.62 + * \return Non-zero on success, zero on failure.
    1.63 + */
    1.64 +int SDLVisualTest_ParseHarnessArgs(char** argv, SDLVisualTest_HarnessState* state);
    1.65 +
    1.66 +/**
    1.67 + * Frees any resources associated with the state object pointed to by \c state.
    1.68 + */
    1.69 +void SDLVisualTest_FreeHarnessState(SDLVisualTest_HarnessState* state);
    1.70 +
    1.71 +/* Ends C function definitions when using C++ */
    1.72 +#ifdef __cplusplus
    1.73 +}
    1.74 +#endif
    1.75 +
    1.76 +#endif /* _SDL_visualtest_harness_argparser_h */