SquishTestScript.cmake 2.6 KB

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