SquishTestScript.cmake 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
  12. # print out the variable that we are using
  13. message(STATUS "squish_aut='${squish_aut}'")
  14. message(STATUS "squish_server_executable='${squish_server_executable}'")
  15. message(STATUS "squish_client_executable='${squish_client_executable}'")
  16. message(STATUS "squish_libqtdir ='${squish_libqtdir}'")
  17. message(STATUS "squish_test_case='${squish_test_case}'")
  18. message(STATUS "squish_wrapper='${squish_wrapper}'")
  19. message(STATUS "squish_env_vars='${squish_env_vars}'")
  20. # parse enviornment variables
  21. foreach(i ${squish_env_vars})
  22. message(STATUS "parsing env var key/value pair ${i}")
  23. string(REGEX MATCH "([^=]*)=(.*)" squish_env_name ${i})
  24. message(STATUS "key=${CMAKE_MATCH_1}")
  25. message(STATUS "value=${CMAKE_MATCH_2}")
  26. set ( ENV{${CMAKE_MATCH_1}} ${CMAKE_MATCH_2} )
  27. endforeach()
  28. if (QT4_INSTALLED)
  29. # record qt lib directory
  30. set ( ENV{${SQUISH_LIBQTDIR}} ${squish_libqtdir} )
  31. endif (QT4_INSTALLED)
  32. # run the test
  33. if (WIN32)
  34. execute_process(
  35. COMMAND ${CMAKE_ROOT}/Modules/SquishRunTestCase.bat ${squish_server_executable} ${squish_client_executable} ${squish_test_case} ${squish_wrapper} ${squish_aut}
  36. RESULT_VARIABLE test_rv
  37. )
  38. endif (WIN32)
  39. if (UNIX)
  40. execute_process(
  41. COMMAND ${CMAKE_ROOT}/Modules/SquishRunTestCase.sh ${squish_server_executable} ${squish_client_executable} ${squish_test_case} ${squish_wrapper} ${squish_aut}
  42. RESULT_VARIABLE test_rv
  43. )
  44. endif (UNIX)
  45. # check for an error with running the test
  46. if(NOT "${test_rv}" STREQUAL "0")
  47. message(FATAL_ERROR "Error running Squish test")
  48. endif(NOT "${test_rv}" STREQUAL "0")