diff options
author | Brad King <brad.king@kitware.com> | 2015-04-20 14:24:50 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-04-20 14:27:19 (GMT) |
commit | 28429270194c42973bbec6bd0e5aeae061a8925c (patch) | |
tree | b4386d10adc862b3594dde0d467e19d266b212a2 /Tests/RunCMake | |
parent | 1f1b62b0e2598554349dce14542a4c383f620ada (diff) | |
download | CMake-28429270194c42973bbec6bd0e5aeae061a8925c.zip CMake-28429270194c42973bbec6bd0e5aeae061a8925c.tar.gz CMake-28429270194c42973bbec6bd0e5aeae061a8925c.tar.bz2 |
Tests: Delay RunCMake.ExternalProject case checks
Use RunCMake "-check.cmake" scripts to check the generated initial cache
file content so that the full generation process is completed.
Diffstat (limited to 'Tests/RunCMake')
6 files changed, 63 insertions, 58 deletions
diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS-check.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS-check.cmake new file mode 100644 index 0000000..c1e4204 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS-check.cmake @@ -0,0 +1,17 @@ +set(_cache_file "${RunCMake_TEST_BINARY_DIR}/tmp/FOO-cache.cmake") + +if(NOT EXISTS "${_cache_file}") + set(RunCMake_TEST_FAILED "Initial cache not created") + return() +endif() + +file(READ "${_cache_file}" _cache) + +if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\) + set(RunCMake_TEST_FAILED "Cannot find FOO argument in cache") + return() +endif() +if(NOT "${CMAKE_MATCH_0}" MATCHES FORCE) + set(RunCMake_TEST_FAILED "Expected forced FOO argument") + return() +endif() diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake index bf9b12d..5e37eec 100644 --- a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake @@ -1,21 +1,5 @@ include(ExternalProject) -set(_tmp_dir "${CMAKE_CURRENT_BINARY_DIR}/tmp") -set(_cache_file "${_tmp_dir}/FOO-cache.cmake") - -ExternalProject_Add(FOO TMP_DIR "${_tmp_dir}" +ExternalProject_Add(FOO TMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/tmp" DOWNLOAD_COMMAND "" CMAKE_CACHE_ARGS "-DFOO:STRING=BAR") - -if(NOT EXISTS "${_cache_file}") - message(FATAL_ERROR "Initial cache not created") -endif() - -file(READ "${_cache_file}" _cache) - -if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\) - message(FATAL_ERROR "Cannot find FOO argument in cache") -endif() -if(NOT "${CMAKE_MATCH_0}" MATCHES FORCE) - message(FATAL_ERROR "Expected forced FOO argument") -endif() diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS-check.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS-check.cmake new file mode 100644 index 0000000..ec1cafb --- /dev/null +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS-check.cmake @@ -0,0 +1,17 @@ +set(_cache_file "${RunCMake_TEST_BINARY_DIR}/tmp/FOO-cache.cmake") + +if(NOT EXISTS "${_cache_file}") + set(RunCMake_TEST_FAILED "Initial cache not created") + return() +endif() + +file(READ "${_cache_file}" _cache) + +if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\) + set(RunCMake_TEST_FAILED "Cannot find FOO argument in cache") + return() +endif() +if("${CMAKE_MATCH_0}" MATCHES FORCE) + set(RunCMake_TEST_FAILED "Expected not forced FOO argument") + return() +endif() diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake index c216664..8e98470 100644 --- a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake @@ -1,21 +1,5 @@ include(ExternalProject) -set(_tmp_dir "${CMAKE_CURRENT_BINARY_DIR}/tmp") -set(_cache_file "${_tmp_dir}/FOO-cache.cmake") - -ExternalProject_Add(FOO TMP_DIR "${_tmp_dir}" +ExternalProject_Add(FOO TMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/tmp" DOWNLOAD_COMMAND "" CMAKE_CACHE_DEFAULT_ARGS "-DFOO:STRING=BAR") - -if(NOT EXISTS "${_cache_file}") - message(FATAL_ERROR "Initial cache not created") -endif() - -file(READ "${_cache_file}" _cache) - -if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\) - message(FATAL_ERROR "Cannot find FOO argument in cache") -endif() -if("${CMAKE_MATCH_0}" MATCHES FORCE) - message(FATAL_ERROR "Expected not forced FOO argument") -endif() diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix-check.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix-check.cmake new file mode 100644 index 0000000..2a07f27 --- /dev/null +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix-check.cmake @@ -0,0 +1,26 @@ +set(_cache_file "${RunCMake_TEST_BINARY_DIR}/tmp/FOO-cache.cmake") + +if(NOT EXISTS "${_cache_file}") + set(RunCMake_TEST_FAILED "Initial cache not created") + return() +endif() + +file(READ "${_cache_file}" _cache) + +if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\) + set(RunCMake_TEST_FAILED "Cannot find FOO argument in cache") + return() +endif() +if(NOT "${CMAKE_MATCH_0}" MATCHES FORCE) + set(RunCMake_TEST_FAILED "Expected forced FOO argument") + return() +endif() + +if(NOT "${_cache}" MATCHES "set\\(BAR \"BAZ\".+\\)") # \(\) + set(RunCMake_TEST_FAILED "Cannot find BAR argument in cache") + return() +endif() +if("${CMAKE_MATCH_0}" MATCHES FORCE) + set(RunCMake_TEST_FAILED "Expected not forced BAR argument") + return() +endif() diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake index 894e183..e7f26ae 100644 --- a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake +++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_mix.cmake @@ -1,29 +1,6 @@ include(ExternalProject) -set(_tmp_dir "${CMAKE_CURRENT_BINARY_DIR}/tmp") -set(_cache_file "${_tmp_dir}/FOO-cache.cmake") - -ExternalProject_Add(FOO TMP_DIR "${_tmp_dir}" +ExternalProject_Add(FOO TMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/tmp" DOWNLOAD_COMMAND "" CMAKE_CACHE_ARGS "-DFOO:STRING=BAR" CMAKE_CACHE_DEFAULT_ARGS "-DBAR:STRING=BAZ") - -if(NOT EXISTS "${_cache_file}") - message(FATAL_ERROR "Initial cache not created") -endif() - -file(READ "${_cache_file}" _cache) - -if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\) - message(FATAL_ERROR "Cannot find FOO argument in cache") -endif() -if(NOT "${CMAKE_MATCH_0}" MATCHES FORCE) - message(FATAL_ERROR "Expected forced FOO argument") -endif() - -if(NOT "${_cache}" MATCHES "set\\(BAR \"BAZ\".+\\)") # \(\) - message(FATAL_ERROR "Cannot find BAR argument in cache") -endif() -if("${CMAKE_MATCH_0}" MATCHES FORCE) - message(FATAL_ERROR "Expected not forced BAR argument") -endif() |