2016-09-27 22:01:08 +03:00
|
|
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
|
|
|
2013-10-15 19:17:36 +04:00
|
|
|
#.rst:
|
|
|
|
# SquishTestScript
|
|
|
|
# ----------------
|
2008-12-09 01:39:30 +03:00
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
2013-10-15 19:17:36 +04:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# This script launches a GUI test using Squish. You should not call the
|
|
|
|
# script directly; instead, you should access it via the SQUISH_ADD_TEST
|
|
|
|
# macro that is defined in FindSquish.cmake.
|
|
|
|
#
|
|
|
|
# This script starts the Squish server, launches the test on the client,
|
|
|
|
# and finally stops the squish server. If any of these steps fail
|
|
|
|
# (including if the tests do not pass) then a fatal error is raised.
|
2008-12-09 01:39:30 +03:00
|
|
|
|
|
|
|
# print out the variable that we are using
|
|
|
|
message(STATUS "squish_aut='${squish_aut}'")
|
2012-11-05 00:06:20 +04:00
|
|
|
message(STATUS "squish_aut_dir='${squish_aut_dir}'")
|
2008-12-09 01:39:30 +03:00
|
|
|
|
2012-11-05 00:06:20 +04:00
|
|
|
message(STATUS "squish_version='${squish_version}'")
|
2008-12-09 01:39:30 +03:00
|
|
|
message(STATUS "squish_server_executable='${squish_server_executable}'")
|
|
|
|
message(STATUS "squish_client_executable='${squish_client_executable}'")
|
|
|
|
message(STATUS "squish_libqtdir ='${squish_libqtdir}'")
|
2012-11-05 00:06:20 +04:00
|
|
|
message(STATUS "squish_test_suite='${squish_test_suite}'")
|
2008-12-09 01:39:30 +03:00
|
|
|
message(STATUS "squish_test_case='${squish_test_case}'")
|
|
|
|
message(STATUS "squish_wrapper='${squish_wrapper}'")
|
|
|
|
message(STATUS "squish_env_vars='${squish_env_vars}'")
|
2012-11-05 00:06:20 +04:00
|
|
|
message(STATUS "squish_module_dir='${squish_module_dir}'")
|
|
|
|
message(STATUS "squish_settingsgroup='${squish_settingsgroup}'")
|
|
|
|
message(STATUS "squish_pre_command='${squish_pre_command}'")
|
|
|
|
message(STATUS "squish_post_command='${squish_post_command}'")
|
2008-12-09 01:39:30 +03:00
|
|
|
|
|
|
|
# parse enviornment variables
|
|
|
|
foreach(i ${squish_env_vars})
|
|
|
|
message(STATUS "parsing env var key/value pair ${i}")
|
|
|
|
string(REGEX MATCH "([^=]*)=(.*)" squish_env_name ${i})
|
|
|
|
message(STATUS "key=${CMAKE_MATCH_1}")
|
|
|
|
message(STATUS "value=${CMAKE_MATCH_2}")
|
|
|
|
set ( ENV{${CMAKE_MATCH_1}} ${CMAKE_MATCH_2} )
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
if (QT4_INSTALLED)
|
2012-08-28 13:22:17 +04:00
|
|
|
# record Qt lib directory
|
2008-12-09 01:39:30 +03:00
|
|
|
set ( ENV{${SQUISH_LIBQTDIR}} ${squish_libqtdir} )
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
2008-12-09 01:39:30 +03:00
|
|
|
|
2012-11-05 00:06:20 +04:00
|
|
|
if(squish_pre_command)
|
|
|
|
message(STATUS "Executing pre command: ${squish_pre_command}")
|
|
|
|
execute_process(COMMAND "${squish_pre_command}")
|
|
|
|
endif()
|
|
|
|
|
2008-12-09 01:39:30 +03:00
|
|
|
# run the test
|
2012-11-05 00:06:20 +04:00
|
|
|
if("${squish_version}" STREQUAL "4")
|
|
|
|
if (WIN32)
|
|
|
|
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}
|
|
|
|
RESULT_VARIABLE test_rv )
|
|
|
|
elseif(UNIX)
|
|
|
|
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}
|
|
|
|
RESULT_VARIABLE test_rv )
|
|
|
|
endif ()
|
2008-12-09 01:39:30 +03:00
|
|
|
|
2012-11-05 00:06:20 +04:00
|
|
|
else()
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
execute_process(COMMAND ${squish_module_dir}/SquishRunTestCase.bat ${squish_server_executable} ${squish_client_executable} ${squish_test_case} ${squish_wrapper} ${squish_aut}
|
|
|
|
RESULT_VARIABLE test_rv )
|
|
|
|
elseif(UNIX)
|
|
|
|
execute_process(COMMAND ${squish_module_dir}/SquishRunTestCase.sh ${squish_server_executable} ${squish_client_executable} ${squish_test_case} ${squish_wrapper} ${squish_aut}
|
|
|
|
RESULT_VARIABLE test_rv )
|
|
|
|
endif ()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(squish_post_command)
|
|
|
|
message(STATUS "Executing post command: ${squish_post_command}")
|
|
|
|
execute_process(COMMAND "${squish_post_command}")
|
|
|
|
endif()
|
2008-12-09 01:39:30 +03:00
|
|
|
|
|
|
|
# check for an error with running the test
|
|
|
|
if(NOT "${test_rv}" STREQUAL "0")
|
|
|
|
message(FATAL_ERROR "Error running Squish test")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|