diff options
Diffstat (limited to 'Tests')
15 files changed, 128 insertions, 14 deletions
diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake index b26c6c7..c745828 100644 --- a/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/ExpectedFiles.cmake @@ -13,6 +13,6 @@ set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/libtest_lib.so") set(EXPECTED_FILE_4_NAME "Debuginfo") set(EXPECTED_FILE_4_COMPONENT "applications-debuginfo") -set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*") +set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*\.debug.*") set(EXPECTED_FILE_5 "libs-DebugInfoPackage.rpm") -set(EXPECTED_FILE_CONTENT_5 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/test_lib.cpp.*") +set(EXPECTED_FILE_CONTENT_5 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/test_lib.cpp.*\.debug.*") diff --git a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake index f1b6738..71457d4 100644 --- a/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake +++ b/Tests/RunCMake/CPack/tests/DEBUGINFO/test.cmake @@ -8,6 +8,10 @@ endif() set(CMAKE_BUILD_TYPE Debug) +# for rpm packages execute flag must be set for shared libs if debuginfo +# packages are generated +set(CPACK_RPM_INSTALL_WITH_EXEC TRUE) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" "int test_lib();\n") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" diff --git a/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/ExpectedFiles.cmake index 974df22..3fb0534 100644 --- a/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/ExpectedFiles.cmake @@ -12,6 +12,6 @@ set(EXPECTED_FILE_3 "extra_slash_in_path*-libs.rpm") set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/libtest_lib.so") set(EXPECTED_FILE_4_COMPONENT "applications-debuginfo") -set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*") +set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*\.debug.*") set(EXPECTED_FILE_5_COMPONENT "libs-debuginfo") -set(EXPECTED_FILE_CONTENT_5 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/test_lib.cpp.*") +set(EXPECTED_FILE_CONTENT_5 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/test_lib.cpp.*\.debug.*") diff --git a/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/test.cmake b/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/test.cmake index 4fd1e81..7cee188 100644 --- a/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/test.cmake +++ b/Tests/RunCMake/CPack/tests/EXTRA_SLASH_IN_PATH/test.cmake @@ -8,6 +8,10 @@ endif() set(CMAKE_BUILD_TYPE Debug) +# for rpm packages execute flag must be set for shared libs if debuginfo +# packages are generated +set(CPACK_RPM_INSTALL_WITH_EXEC TRUE) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.hpp" "int test_lib();\n") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test_lib.cpp" diff --git a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake index 8170d39..936e4ed 100644 --- a/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake +++ b/Tests/RunCMake/CPack/tests/SINGLE_DEBUGINFO/ExpectedFiles.cmake @@ -12,19 +12,19 @@ if(RunCMake_SUBTEST_SUFFIX STREQUAL "valid" OR RunCMake_SUBTEST_SUFFIX STREQUAL set(EXPECTED_FILE_CONTENT_3_LIST "/bas;/bas/libtest_lib.so") set(EXPECTED_FILE_4_COMPONENT "debuginfo") - set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp${whitespaces_}/src/src_1/test_lib.cpp.*") + set(EXPECTED_FILE_CONTENT_4 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp${whitespaces_}/src/src_1/test_lib.cpp.*\.debug.*") elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component" OR RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_no_debuginfo") set(EXPECTED_FILES_COUNT "2") set(EXPECTED_FILE_1 "single_debuginfo-0*-applications.rpm") set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") set(EXPECTED_FILE_2 "single_debuginfo-applications-debuginfo*.rpm") - set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*") + set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*\.debug.*") elseif(RunCMake_SUBTEST_SUFFIX STREQUAL "one_component_main" OR RunCMake_SUBTEST_SUFFIX STREQUAL "no_components") set(EXPECTED_FILES_COUNT "2") set(EXPECTED_FILE_1 "single_debuginfo-0*.rpm") set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/test_prog") set(EXPECTED_FILE_2 "single_debuginfo-debuginfo*.rpm") - set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*") + set(EXPECTED_FILE_CONTENT_2 ".*/src${whitespaces_}/src/src_1${whitespaces_}/src/src_1/main.cpp.*\.debug.*") endif() diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake index 994e2aa..09607f6 100644 --- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake @@ -15,10 +15,31 @@ run_cmake(UsesTerminal) # Run both cmake and build steps. We always do a clean before the # build to ensure that the download step re-runs each time. -set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/MultiCommand-build) -set(RunCMake_TEST_NO_CLEAN 1) -file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") -file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") -run_cmake(MultiCommand) -run_cmake_command(MultiCommand-clean ${CMAKE_COMMAND} --build . --target clean) -run_cmake_command(MultiCommand-build ${CMAKE_COMMAND} --build .) +function(__ep_test_with_build testName) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${testName}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${testName}) + run_cmake_command(${testName}-clean ${CMAKE_COMMAND} --build . --target clean) + run_cmake_command(${testName}-build ${CMAKE_COMMAND} --build .) +endfunction() + +__ep_test_with_build(MultiCommand) + +# We can't test the substitution when using the old MSYS due to +# make/sh mangling the paths (substitution is performed correctly, +# but the mangling means we can't reliably test the output). +# There is no such issue when using the newer MSYS though. Therefore, +# we need to bypass the substitution test if using old MSYS. +# See merge request 1537 for discussion. +set(doSubstitutionTest YES) +if(RunCMake_GENERATOR STREQUAL "MSYS Makefiles") + execute_process(COMMAND uname OUTPUT_VARIABLE uname) + if(uname MATCHES "^MINGW32_NT") + set(doSubstitutionTest NO) + endif() +endif() +if(doSubstitutionTest) + __ep_test_with_build(Substitutions) +endif() diff --git a/Tests/RunCMake/ExternalProject/Substitutions-build-stdout.txt b/Tests/RunCMake/ExternalProject/Substitutions-build-stdout.txt new file mode 100644 index 0000000..d6a823a --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Substitutions-build-stdout.txt @@ -0,0 +1,7 @@ +.*Download dir = .*/xxxx_dwn +.*Download file = .*/zzzz_tmp.txt +.*Source dir = .*/xxxx_src +.*Source subdir = /yyyy_subdir +.*Binary dir = .*/xxxx_bin +.*Install dir = .*/xxxx_install +.*Tmp dir = .*/xxxx_tmp diff --git a/Tests/RunCMake/ExternalProject/Substitutions.cmake b/Tests/RunCMake/ExternalProject/Substitutions.cmake new file mode 100644 index 0000000..db79491 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/Substitutions.cmake @@ -0,0 +1,25 @@ +include(ExternalProject) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zzzz_tmp.txt "Dummy file") +file(MD5 ${CMAKE_CURRENT_BINARY_DIR}/zzzz_tmp.txt md5hash) +ExternalProject_Add(Subst + URL file://${CMAKE_CURRENT_BINARY_DIR}/zzzz_tmp.txt + URL_HASH MD5=${md5hash} + DOWNLOAD_NO_EXTRACT ON + DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/xxxx_dwn + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/xxxx_src + SOURCE_SUBDIR yyyy_subdir + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/xxxx_bin + INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/xxxx_install + TMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/xxxx_tmp + CONFIGURE_COMMAND ${CMAKE_COMMAND} -E echo "Download dir = <DOWNLOAD_DIR>" + COMMAND ${CMAKE_COMMAND} -E echo "Download file = <DOWNLOADED_FILE>" + COMMAND ${CMAKE_COMMAND} -E echo "Source dir = <SOURCE_DIR>" + COMMAND ${CMAKE_COMMAND} -E echo "Source subdir = <SOURCE_SUBDIR>" + COMMAND ${CMAKE_COMMAND} -E echo "Binary dir = <BINARY_DIR>" + COMMAND ${CMAKE_COMMAND} -E echo "Install dir = <INSTALL_DIR>" + COMMAND ${CMAKE_COMMAND} -E echo "Tmp dir = <TMP_DIR>" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" +) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-result.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-stderr.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-stderr.txt new file mode 100644 index 0000000..55a4a7a --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-stderr.txt @@ -0,0 +1,2 @@ +Unable to find executable: timeout_test_NOT_BUILT +Errors while running CTest diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt b/Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-timeout-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-timeout-stdout.txt new file mode 100644 index 0000000..8464c80 --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-timeout-stdout.txt @@ -0,0 +1,7 @@ +( *|[0-9]+>)CMake Error at .*GoogleTestAddTests.cmake:[0-9]+ \(message\): +( *|[0-9]+>) Error running test executable. +?( *|[0-9]+>) +( *|[0-9]+>) Path: '.*timeout_test(\.exe)?' +( *|[0-9]+>) Result: Process terminated due to timeout +( *|[0-9]+>) Output: +( *|[0-9]+>) + diff --git a/Tests/RunCMake/GoogleTest/GoogleTest.cmake b/Tests/RunCMake/GoogleTest/GoogleTest.cmake index 58f4196..5e4b8ef 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest.cmake +++ b/Tests/RunCMake/GoogleTest/GoogleTest.cmake @@ -21,3 +21,9 @@ gtest_discover_tests( EXTRA_ARGS how now "\"brown\" cow" PROPERTIES LABELS TEST2 ) + +add_executable(timeout_test timeout_test.cpp) + +gtest_discover_tests( + timeout_test +) diff --git a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake index b79af26..73014d1 100644 --- a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake @@ -9,24 +9,45 @@ function(run_GoogleTest) endif() file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(GoogleTest) + run_cmake_command(GoogleTest-build ${CMAKE_COMMAND} --build . --config Debug + --target fake_gtest + ) + + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(GoogleTest-timeout + ${CMAKE_COMMAND} + --build . + --config Debug + --target timeout_test ) + set(RunCMake_TEST_OUTPUT_MERGE 0) + run_cmake_command(GoogleTest-test1 ${CMAKE_CTEST_COMMAND} -C Debug -L TEST1 --no-label-summary ) + run_cmake_command(GoogleTest-test2 ${CMAKE_CTEST_COMMAND} -C Debug -L TEST2 --no-label-summary ) + + run_cmake_command(GoogleTest-test-missing + ${CMAKE_CTEST_COMMAND} + -C Debug + -R timeout + --no-label-summary + ) endfunction() run_GoogleTest() diff --git a/Tests/RunCMake/GoogleTest/timeout_test.cpp b/Tests/RunCMake/GoogleTest/timeout_test.cpp new file mode 100644 index 0000000..a8e5c1c --- /dev/null +++ b/Tests/RunCMake/GoogleTest/timeout_test.cpp @@ -0,0 +1,15 @@ +#if defined(_WIN32) +#include <windows.h> +#else +#include <unistd.h> +#endif + +int main() +{ +#if defined(_WIN32) + Sleep(10000); +#else + sleep(10); +#endif + return 0; +} |