FindSquish¶
-- 典型用法
该模块可以用来查找 Squish。
SQUISH_FOUND If false, don't try to use Squish
SQUISH_VERSION The full version of Squish found
SQUISH_VERSION_MAJOR The major version of Squish found
SQUISH_VERSION_MINOR The minor version of Squish found
SQUISH_VERSION_PATCH The patch version of Squish found
SQUISH_INSTALL_DIR The Squish installation directory
(containing bin, lib, etc)
SQUISH_SERVER_EXECUTABLE The squishserver executable
SQUISH_CLIENT_EXECUTABLE The squishrunner executable
SQUISH_INSTALL_DIR_FOUND Was the install directory found?
SQUISH_SERVER_EXECUTABLE_FOUND Was the server executable found?
SQUISH_CLIENT_EXECUTABLE_FOUND Was the client executable found?
它提供函数 squish_add_test(),用于向 cmake 中添加一个 squish 测试,使用 Squish >= 4.x
squish_add_test(cmakeTestName
AUT targetName SUITE suiteName TEST squishTestName
[SETTINGSGROUP group] [PRE_COMMAND command] [POST_COMMAND command] )
版本 3.18 中已更改: 在以前的 CMake 版本中,此函数名为 squish_v4_add_test
。
参数含义如下
cmakeTestName
这将用作 add_test() 的第一个参数
AUT targetName
cmake 目标的名称,将用作 AUT,即,将进行测试的可执行文件。
SUITE suiteName
这是指向 squish 套件的完整路径,或只是套件的最后一个目录,即套件名称。在这种情况下,调用 squish_add_test() 的 CMakeLists.txt 必须位于套件目录的父目录中。
TEST squishTestName
squish 测试的名称,即套件目录中测试的子目录的名称。
SETTINGSGROUP group
已弃用,此参数将被忽略。
PRE_COMMAND command
如果指定,则将在开始 squish 测试前执行给定的命令。
POST_COMMAND command
与 PRE_COMMAND 相同,但在 squish 测试执行后执行。
enable_testing()
find_package(Squish 6.5)
if (SQUISH_FOUND)
squish_add_test(myTestName
AUT myApp
SUITE ${CMAKE_SOURCE_DIR}/tests/mySuite
TEST someSquishTest
)
endif ()
对于 Squish 版本 3.x 的用户,提供了宏 squish_v3_add_test()
squish_v3_add_test(testName applicationUnderTest testCase envVars testWrapper)
Use this macro to add a test using Squish 3.x.
enable_testing()
find_package(Squish 3.0)
if (SQUISH_FOUND)
squish_v3_add_test(myTestName myApplication testCase envVars testWrapper)
endif ()