summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-04-05 17:44:27 (GMT)
committerBrad King <brad.king@kitware.com>2021-04-05 17:44:27 (GMT)
commit383bfbe76fafcc5739d1cf7acc607eb4952f2aaa (patch)
tree6f2a84d05d1713153f33ca70db64b718ef344a09 /Tests
parent222bf361e4f0f75698eab0bcad55064cec539923 (diff)
parent0237eba318b52720f07b69c3d5df0fcb90c75c66 (diff)
downloadCMake-383bfbe76fafcc5739d1cf7acc607eb4952f2aaa.zip
CMake-383bfbe76fafcc5739d1cf7acc607eb4952f2aaa.tar.gz
CMake-383bfbe76fafcc5739d1cf7acc607eb4952f2aaa.tar.bz2
Merge branch 'backport-3.18-rel-file-table' into backport-3.19-rel-file-table
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/CMakeRelease/FileTable-stdout.txt36
-rw-r--r--Tests/RunCMake/CMakeRelease/FileTable.cmake20
-rw-r--r--Tests/RunCMake/CMakeRelease/RunCMakeTest.cmake10
-rw-r--r--Tests/RunCMake/RunCMake.cmake5
5 files changed, 72 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 7000b79..8fc5877 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -202,6 +202,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..441e9b0
--- /dev/null
+++ b/Tests/RunCMake/CMakeRelease/FileTable-stdout.txt
@@ -0,0 +1,36 @@
+^-- query: \.version \| \.major , \.minor , \.patch , \.suffix, \.string
+1
+2
+3
+"rc4"
+"@version@"
+-- query: \.files\[\]\.name
+"cmake-@version@-Linux-x86_64\.sh"
+"cmake-@version@-Linux-x86_64\.tar\.gz"
+"cmake-@version@-Darwin-x86_64\.dmg"
+"cmake-@version@-Darwin-x86_64\.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@-Darwin-x86_64\.dmg"
+-- 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@-Darwin-x86_64\.dmg"
+"cmake-@version@-Darwin-x86_64\.tar\.gz"
+"cmake-@version@-win64-x64\.msi"
+"cmake-@version@-win64-x64\.zip"
+-- query: \.files\[\] \| select\(\[\.macOSmin\] \| inside\(\["10\.7", "10\.8", "10\.9"\]\)\) \| \.name
+"cmake-@version@-Darwin-x86_64\.dmg"
+"cmake-@version@-Darwin-x86_64\.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..1bddeb8
--- /dev/null
+++ b/Tests/RunCMake/CMakeRelease/FileTable.cmake
@@ -0,0 +1,20 @@
+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[] | . == \"windows\") and (.architecture[] | . == \"i386\") and (.class == \"installer\")) | .name"
+ ".files[] | select(.architecture[] | . == \"x86_64\") | .name"
+ ".files[] | select([.macOSmin] | inside([\"10.7\", \"10.8\", \"10.9\"])) | .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 7d96e50..26a386b 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -207,6 +207,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})