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