diff options
author | Brad King <brad.king@kitware.com> | 2021-04-05 17:46:35 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-04-05 17:46:35 (GMT) |
commit | c5777e5421b4bfbe0fe4d78bac32ea013372d8d7 (patch) | |
tree | 9df6e4a7ff5aef90ac76d674b21e854a7cab1cde /Tests | |
parent | c0092247fe380ec9df065c4fbdafcd610ef09ddc (diff) | |
parent | f9f59fb0b201987c218579e1310cc62a05df5694 (diff) | |
download | CMake-c5777e5421b4bfbe0fe4d78bac32ea013372d8d7.zip CMake-c5777e5421b4bfbe0fe4d78bac32ea013372d8d7.tar.gz CMake-c5777e5421b4bfbe0fe4d78bac32ea013372d8d7.tar.bz2 |
Merge branch 'backport-3.19-rel-file-table' into rel-file-table
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeRelease/FileTable-stdout.txt | 44 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeRelease/FileTable.cmake | 21 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeRelease/RunCMakeTest.cmake | 10 | ||||
-rw-r--r-- | Tests/RunCMake/RunCMake.cmake | 5 |
5 files changed, 81 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 5ee0612..f33e4af 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -224,6 +224,7 @@ if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(Byproducts) endif() add_RunCMake_test(CMakeRoleGlobalProperty) +add_RunCMake_test(CMakeRelease -DCMake_TEST_JQ=${CMake_TEST_JQ}) if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Unix Makefiles|Ninja") add_RunCMake_test(CompilerChange) endif() diff --git a/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt b/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt new file mode 100644 index 0000000..011673f --- /dev/null +++ b/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt @@ -0,0 +1,44 @@ +^-- query: \.version \| \.major , \.minor , \.patch , \.suffix, \.string +1 +2 +3 +"rc4" +"@version@" +-- query: \.files\[\]\.name +"cmake-@version@-Linux-aarch64\.sh" +"cmake-@version@-Linux-aarch64\.tar\.gz" +"cmake-@version@-Linux-x86_64\.sh" +"cmake-@version@-Linux-x86_64\.tar\.gz" +"cmake-@version@-macos-universal\.dmg" +"cmake-@version@-macos-universal\.tar\.gz" +"cmake-@version@-macos10\.10-universal\.dmg" +"cmake-@version@-macos10\.10-universal\.tar\.gz" +"cmake-@version@-win32-x86\.msi" +"cmake-@version@-win32-x86\.zip" +"cmake-@version@-win64-x64\.msi" +"cmake-@version@-win64-x64\.zip" +"cmake-@version@\.tar\.gz" +"cmake-@version@\.zip" +-- query: \.files\[\] \| select\(\.os\[\] \| \. == "source"\) \| \.name +"cmake-@version@\.tar\.gz" +"cmake-@version@\.zip" +-- query: \.files\[\] \| select\(\(\.os\[\] \| \. == "macOS"\) and \(\.class == "volume"\)\) \| \.name +"cmake-@version@-macos-universal\.dmg" +-- query: \.files\[\] \| select\(\(\.os\[\] \| \. == "macos10\.10"\) and \(\.class == "archive"\)\) \| \.name +"cmake-@version@-macos10\.10-universal\.tar\.gz" +-- query: \.files\[\] \| select\(\(\.os\[\] \| \. == "windows"\) and \(\.architecture\[\] \| \. == "i386"\) and \(\.class == "installer"\)\) \| \.name +"cmake-@version@-win32-x86\.msi" +-- query: \.files\[\] \| select\(\.architecture\[\] \| \. == "x86_64"\) \| \.name +"cmake-@version@-Linux-x86_64\.sh" +"cmake-@version@-Linux-x86_64\.tar\.gz" +"cmake-@version@-macos-universal\.dmg" +"cmake-@version@-macos-universal\.tar\.gz" +"cmake-@version@-macos10\.10-universal\.dmg" +"cmake-@version@-macos10\.10-universal\.tar\.gz" +"cmake-@version@-win64-x64\.msi" +"cmake-@version@-win64-x64\.zip" +-- query: \.files\[\] \| select\(\[\.macOSmin\] \| inside\(\["10\.10", "10\.11", "10\.12"\]\)\) \| \.name +"cmake-@version@-macos10\.10-universal\.dmg" +"cmake-@version@-macos10\.10-universal\.tar\.gz" +-- query: \.hashFiles\[\] \| select\(\.algorithm\[\] \| \. == "SHA-256"\) \| \.name +"cmake-@version@-SHA-256\.txt"$ diff --git a/Tests/RunCMake/CMakeRelease/FileTable.cmake b/Tests/RunCMake/CMakeRelease/FileTable.cmake new file mode 100644 index 0000000..f46535c --- /dev/null +++ b/Tests/RunCMake/CMakeRelease/FileTable.cmake @@ -0,0 +1,21 @@ +set(version "@version@") +set(version_major "1") +set(version_minor "2") +set(version_patch "3") +set(maybe_version_suffix "\"suffix\": \"rc4\",") +configure_file("${CMAKE_CURRENT_LIST_DIR}/../../../Utilities/Release/files-v1.json.in" "files-v1.json" @ONLY) + +foreach(query + ".version | .major , .minor , .patch , .suffix, .string" + ".files[].name" + ".files[] | select(.os[] | . == \"source\") | .name" + ".files[] | select((.os[] | . == \"macOS\") and (.class == \"volume\")) | .name" + ".files[] | select((.os[] | . == \"macos10.10\") and (.class == \"archive\")) | .name" + ".files[] | select((.os[] | . == \"windows\") and (.architecture[] | . == \"i386\") and (.class == \"installer\")) | .name" + ".files[] | select(.architecture[] | . == \"x86_64\") | .name" + ".files[] | select([.macOSmin] | inside([\"10.10\", \"10.11\", \"10.12\"])) | .name" + ".hashFiles[] | select(.algorithm[] | . == \"SHA-256\") | .name" + ) + message(STATUS "query: ${query}") + execute_process(COMMAND ${JQ} "${query}" files-v1.json) +endforeach() diff --git a/Tests/RunCMake/CMakeRelease/RunCMakeTest.cmake b/Tests/RunCMake/CMakeRelease/RunCMakeTest.cmake new file mode 100644 index 0000000..9a08ff3 --- /dev/null +++ b/Tests/RunCMake/CMakeRelease/RunCMakeTest.cmake @@ -0,0 +1,10 @@ +include(RunCMake) + +if(CMake_TEST_JQ) + set(JQ "${CMake_TEST_JQ}") +else() + find_program(JQ NAMES jq) +endif() +if(JQ) + run_cmake_script(FileTable -DJQ=${JQ}) +endif() diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 494f87f..ea94a5b 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -215,6 +215,11 @@ function(run_cmake_command test) run_cmake(${test}) endfunction() +function(run_cmake_script test) + set(RunCMake_TEST_COMMAND ${CMAKE_COMMAND} ${ARGN} -P ${RunCMake_SOURCE_DIR}/${test}.cmake) + run_cmake(${test}) +endfunction() + function(run_cmake_with_options test) set(RunCMake_TEST_OPTIONS "${ARGN}") run_cmake(${test}) |