SDL_visualtest_harness_argparser.h 2.3 KB

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