diff options
author | Brad King <brad.king@kitware.com> | 2023-06-05 13:44:44 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-06-05 13:45:02 (GMT) |
commit | 3760ac9845e3c0d163eb1b4d83ab5b2f367507aa (patch) | |
tree | 8b0e37e17ea6bf8779f0db4f64de89691dacd3dc /Tests/RunCMake | |
parent | 33750f128b874f9420db1e9e44c2963e64b59448 (diff) | |
parent | 99b2ccf80dc87ccf6832508cc3f8889a70c2785f (diff) | |
download | CMake-3760ac9845e3c0d163eb1b4d83ab5b2f367507aa.zip CMake-3760ac9845e3c0d163eb1b4d83ab5b2f367507aa.tar.gz CMake-3760ac9845e3c0d163eb1b4d83ab5b2f367507aa.tar.bz2 |
Merge topic 'file-api-query-command'
99b2ccf80d cmake_file_api: New project command
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8530
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r-- | Tests/RunCMake/FileAPI/ProjectQueryBad-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/FileAPI/ProjectQueryBad-stderr.txt | 36 | ||||
-rw-r--r-- | Tests/RunCMake/FileAPI/ProjectQueryBad.cmake | 42 | ||||
-rw-r--r-- | Tests/RunCMake/FileAPI/ProjectQueryGood-check.cmake | 11 | ||||
-rw-r--r-- | Tests/RunCMake/FileAPI/ProjectQueryGood.cmake | 8 | ||||
-rw-r--r-- | Tests/RunCMake/FileAPI/RunCMakeTest.cmake | 2 |
6 files changed, 100 insertions, 0 deletions
diff --git a/Tests/RunCMake/FileAPI/ProjectQueryBad-result.txt b/Tests/RunCMake/FileAPI/ProjectQueryBad-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/FileAPI/ProjectQueryBad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/FileAPI/ProjectQueryBad-stderr.txt b/Tests/RunCMake/FileAPI/ProjectQueryBad-stderr.txt new file mode 100644 index 0000000..84eff98 --- /dev/null +++ b/Tests/RunCMake/FileAPI/ProjectQueryBad-stderr.txt @@ -0,0 +1,36 @@ +Non-query check +CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\): + cmake_file_api does not recognize sub-command NOT_A_QUERY +.* +Invalid API version checks +CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\): + cmake_file_api QUERY subcommand given an unsupported API_VERSION "2" \(the + only currently supported version is 1\)\. +.* +CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\): + cmake_file_api QUERY subcommand given a non-integer API_VERSION\. +.* +Invalid version numbers check +CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\): + cmake_file_api QUERY subcommand was given invalid arguments: + + Given a malformed version "nope" for CODEMODEL\. + Given a malformed version "-2" for CACHE\. + Given a malformed version "\.8" for CMAKEFILES\. + Given a malformed version "0\.1" for TOOLCHAINS\. +.* +Requested versions too high check +CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\): + cmake_file_api QUERY subcommand was given invalid arguments: + + None of the specified CODEMODEL versions is supported by this version of CMake\. + None of the specified CACHE versions is supported by this version of CMake\. + None of the specified CMAKEFILES versions is supported by this version of CMake\. + None of the specified TOOLCHAINS versions is supported by this version of CMake\. +.* +Requested versions too low check +CMake Error at ProjectQueryBad\.cmake:[0-9]+ \(cmake_file_api\): + cmake_file_api QUERY subcommand was given invalid arguments: + + None of the specified CODEMODEL versions is supported by this version of CMake\. + None of the specified CACHE versions is supported by this version of CMake\. diff --git a/Tests/RunCMake/FileAPI/ProjectQueryBad.cmake b/Tests/RunCMake/FileAPI/ProjectQueryBad.cmake new file mode 100644 index 0000000..3a06105 --- /dev/null +++ b/Tests/RunCMake/FileAPI/ProjectQueryBad.cmake @@ -0,0 +1,42 @@ +# All of these should fail. Execution does continue though, so we should see +# the error output from each one. There is no observable effect of the command +# during the configure phase, so it isn't critical to end processing on the +# first failure. Allowing execution to proceed may allow the project to see +# other potential errors before ultimately halting. That behavior is generally +# desirable, and the multiple failing calls here will confirm that we retain +# that behavior. + +message(NOTICE "Non-query check") +cmake_file_api(NOT_A_QUERY) + +message(NOTICE "Invalid API version checks") +cmake_file_api(QUERY API_VERSION 2) +cmake_file_api(QUERY API_VERSION nah) + +message(NOTICE "Invalid version numbers check") +cmake_file_api( + QUERY + API_VERSION 1 + CODEMODEL nope + CACHE -2 + CMAKEFILES .8 + TOOLCHAINS 2 0.1 +) + +message(NOTICE "Requested versions too high check") +cmake_file_api( + QUERY + API_VERSION 1 + CODEMODEL 3 + CACHE 3 + CMAKEFILES 2 + TOOLCHAINS 1.1 +) + +message(NOTICE "Requested versions too low check") +cmake_file_api( + QUERY + API_VERSION 1 + CODEMODEL 1 + CACHE 1 +) diff --git a/Tests/RunCMake/FileAPI/ProjectQueryGood-check.cmake b/Tests/RunCMake/FileAPI/ProjectQueryGood-check.cmake new file mode 100644 index 0000000..46d3f77 --- /dev/null +++ b/Tests/RunCMake/FileAPI/ProjectQueryGood-check.cmake @@ -0,0 +1,11 @@ +set(expect + reply + reply/cache-v2-[0-9a-f]+.json + reply/cmakeFiles-v1-[0-9a-f]+.json + reply/codemodel-v2-[0-9a-f]+.json + .*reply/index-[0-9.T-]+.json + .*reply/toolchains-v1-[0-9a-f]+.json +) + +# Only need to check for existence. Other tests check the reply contents. +check_api("^${expect}$") diff --git a/Tests/RunCMake/FileAPI/ProjectQueryGood.cmake b/Tests/RunCMake/FileAPI/ProjectQueryGood.cmake new file mode 100644 index 0000000..da0f3ce --- /dev/null +++ b/Tests/RunCMake/FileAPI/ProjectQueryGood.cmake @@ -0,0 +1,8 @@ +cmake_file_api( + QUERY + API_VERSION 1 + CODEMODEL 3 2.1 + CACHE 3.2 2 + CMAKEFILES 3 2 1.0 + TOOLCHAINS 3 2 1 +) diff --git a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake index c768d18..81926af 100644 --- a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake +++ b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake @@ -52,6 +52,8 @@ run_cmake(ClientStateless) run_cmake(MixedStateless) run_cmake(DuplicateStateless) run_cmake(ClientStateful) +run_cmake(ProjectQueryGood) +run_cmake(ProjectQueryBad) function(run_object object) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${object}-build) |