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