SquishTestScript.cmake 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #.rst:
  2. # SquishTestScript
  3. # ----------------
  4. #
  5. #
  6. #
  7. #
  8. #
  9. # This script launches a GUI test using Squish. You should not call the
  10. # script directly; instead, you should access it via the SQUISH_ADD_TEST
  11. # macro that is defined in FindSquish.cmake.
  12. #
  13. # This script starts the Squish server, launches the test on the client,
  14. # and finally stops the squish server. If any of these steps fail
  15. # (including if the tests do not pass) then a fatal error is raised.
  16. #=============================================================================
  17. # Copyright 2008-2009 Kitware, Inc.
  18. #
  19. # Distributed under the OSI-approved BSD License (the "License");
  20. # see accompanying file Copyright.txt for details.
  21. #
  22. # This software is distributed WITHOUT ANY WARRANTY; without even the
  23. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  24. # See the License for more information.
  25. #=============================================================================
  26. # (To distribute this file outside of CMake, substitute the full
  27. # License text for the above reference.)
  28. # print out the variable that we are using
  29. message(STATUS "squish_aut='${squish_aut}'")
  30. message(STATUS "squish_aut_dir='${squish_aut_dir}'")
  31. message(STATUS "squish_version='${squish_version}'")
  32. message(STATUS "squish_server_executable='${squish_server_executable}'")
  33. message(STATUS "squish_client_executable='${squish_client_executable}'")
  34. message(STATUS "squish_libqtdir ='${squish_libqtdir}'")
  35. message(STATUS "squish_test_suite='${squish_test_suite}'")
  36. message(STATUS "squish_test_case='${squish_test_case}'")
  37. message(STATUS "squish_wrapper='${squish_wrapper}'")
  38. message(STATUS "squish_env_vars='${squish_env_vars}'")
  39. message(STATUS "squish_module_dir='${squish_module_dir}'")
  40. message(STATUS "squish_settingsgroup='${squish_settingsgroup}'")
  41. message(STATUS "squish_pre_command='${squish_pre_command}'")
  42. message(STATUS "squish_post_command='${squish_post_command}'")
  43. # parse enviornment variables
  44. foreach(i ${squish_env_vars})
  45. message(STATUS "parsing env var key/value pair ${i}")
  46. string(REGEX MATCH "([^=]*)=(.*)" squish_env_name ${i})
  47. message(STATUS "key=${CMAKE_MATCH_1}")
  48. message(STATUS "value=${CMAKE_MATCH_2}")
  49. set ( ENV{${CMAKE_MATCH_1}} ${CMAKE_MATCH_2} )
  50. endforeach()
  51. if (QT4_INSTALLED)
  52. # record Qt lib directory
  53. set ( ENV{${SQUISH_LIBQTDIR}} ${squish_libqtdir} )
  54. endif ()
  55. if(squish_pre_command)
  56. message(STATUS "Executing pre command: ${squish_pre_command}")
  57. execute_process(COMMAND "${squish_pre_command}")
  58. endif()
  59. # run the test
  60. if("${squish_version}" STREQUAL "4")
  61. if (WIN32)
  62. execute_process(COMMAND ${squish_module_dir}/Squish4RunTestCase.bat ${squish_server_executable} ${squish_client_executable} ${squish_test_suite} ${squish_test_case} ${squish_aut} ${squish_aut_dir} ${squish_settingsgroup}
  63. RESULT_VARIABLE test_rv )
  64. elseif(UNIX)
  65. execute_process(COMMAND ${squish_module_dir}/Squish4RunTestCase.sh ${squish_server_executable} ${squish_client_executable} ${squish_test_suite} ${squish_test_case} ${squish_aut} ${squish_aut_dir} ${squish_settingsgroup}
  66. RESULT_VARIABLE test_rv )
  67. endif ()
  68. else()
  69. if (WIN32)
  70. execute_process(COMMAND ${squish_module_dir}/SquishRunTestCase.bat ${squish_server_executable} ${squish_client_executable} ${squish_test_case} ${squish_wrapper} ${squish_aut}
  71. RESULT_VARIABLE test_rv )
  72. elseif(UNIX)
  73. execute_process(COMMAND ${squish_module_dir}/SquishRunTestCase.sh ${squish_server_executable} ${squish_client_executable} ${squish_test_case} ${squish_wrapper} ${squish_aut}
  74. RESULT_VARIABLE test_rv )
  75. endif ()
  76. endif()
  77. if(squish_post_command)
  78. message(STATUS "Executing post command: ${squish_post_command}")
  79. execute_process(COMMAND "${squish_post_command}")
  80. endif()
  81. # check for an error with running the test
  82. if(NOT "${test_rv}" STREQUAL "0")
  83. message(FATAL_ERROR "Error running Squish test")
  84. endif()