summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-04-05 17:45:08 (GMT)
committerBrad King <brad.king@kitware.com>2021-04-05 17:45:08 (GMT)
commitf9f59fb0b201987c218579e1310cc62a05df5694 (patch)
tree95da5b35a4d16a2b25639fa9ceedd717f0f2d7ff /Tests/RunCMake
parent30959aec8f1347ac2098f85824fe6777dae627b5 (diff)
parent0913499f69463c94cc16ed437721e88148e131a8 (diff)
downloadCMake-f9f59fb0b201987c218579e1310cc62a05df5694.zip
CMake-f9f59fb0b201987c218579e1310cc62a05df5694.tar.gz
CMake-f9f59fb0b201987c218579e1310cc62a05df5694.tar.bz2
Merge branch 'release-3.19' into backport-3.19-rel-file-table
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CMakePresets/CMakePresets.json.in4
-rw-r--r--Tests/RunCMake/CMakePresets/Comment-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresets/Comment-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresets/Comment.json.in11
-rw-r--r--Tests/RunCMake/CMakePresets/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/CMakePresets/validate_schema.py3
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/RunCMake.cmake6
-rw-r--r--Tests/RunCMake/XcodeProject/RunCMakeTest.cmake29
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-cmakeinstall-check.cmake2
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-cmakeinstall-check.cmake2
-rw-r--r--Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake22
-rw-r--r--Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos.cmake15
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake4
14 files changed, 92 insertions, 12 deletions
diff --git a/Tests/RunCMake/CMakePresets/CMakePresets.json.in b/Tests/RunCMake/CMakePresets/CMakePresets.json.in
index 54e4140..e65c1a9 100644
--- a/Tests/RunCMake/CMakePresets/CMakePresets.json.in
+++ b/Tests/RunCMake/CMakePresets/CMakePresets.json.in
@@ -1,8 +1,4 @@
-/*
- * Block comment
- */
{
- // Inline comment
"version": 1,
"cmakeMinimumRequired": {
"major": 3,
diff --git a/Tests/RunCMake/CMakePresets/Comment-result.txt b/Tests/RunCMake/CMakePresets/Comment-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/Comment-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresets/Comment-stderr.txt b/Tests/RunCMake/CMakePresets/Comment-stderr.txt
new file mode 100644
index 0000000..2f404bc
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/Comment-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresets/Comment: JSON parse error$
diff --git a/Tests/RunCMake/CMakePresets/Comment.json.in b/Tests/RunCMake/CMakePresets/Comment.json.in
new file mode 100644
index 0000000..0f7120c
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/Comment.json.in
@@ -0,0 +1,11 @@
+// Comment
+{
+ "version": 1,
+ "configurePresets": [
+ {
+ "name": "Comment",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build"
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
index 1ffda3d..1f399fe 100644
--- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
@@ -77,6 +77,7 @@ endfunction()
# Test CMakePresets.json errors
set(CMakePresets_SCHEMA_EXPECTED_RESULT 1)
run_cmake_presets(NoCMakePresets)
+run_cmake_presets(Comment)
run_cmake_presets(JSONParseError)
run_cmake_presets(InvalidRoot)
run_cmake_presets(NoVersion)
diff --git a/Tests/RunCMake/CMakePresets/validate_schema.py b/Tests/RunCMake/CMakePresets/validate_schema.py
index c9f84ee..b2a67fc 100644
--- a/Tests/RunCMake/CMakePresets/validate_schema.py
+++ b/Tests/RunCMake/CMakePresets/validate_schema.py
@@ -1,4 +1,3 @@
-import jsmin
import json
import jsonschema
import os.path
@@ -6,7 +5,7 @@ import sys
with open(sys.argv[1], "rb") as f:
- contents = json.loads(jsmin.jsmin(f.read().decode("utf-8-sig")))
+ contents = json.loads(f.read().decode("utf-8-sig"))
schema_file = os.path.join(
os.path.dirname(__file__),
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index e6f86a1..35be2ec 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -34,6 +34,7 @@ function(run_NoWorkToDo)
run_cmake(NoWorkToDo)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/NoWorkToDo-build)
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
run_cmake_command(NoWorkToDo-build ${CMAKE_COMMAND} --build .)
run_cmake_command(NoWorkToDo-nowork ${CMAKE_COMMAND} --build . -- -d explain)
endfunction()
@@ -43,6 +44,7 @@ function(run_VerboseBuild)
run_cmake(VerboseBuild)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/VerboseBuild-build)
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
run_cmake_command(VerboseBuild-build ${CMAKE_COMMAND} --build . -v --clean-first)
run_cmake_command(VerboseBuild-nowork ${CMAKE_COMMAND} --build . --verbose)
endfunction()
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index edf42d7..1a69059 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -139,6 +139,12 @@ function(run_cmake test)
if(NOT "${actual_result}" MATCHES "${expect_result}")
string(APPEND msg "Result is [${actual_result}], not [${expect_result}].\n")
endif()
+
+ # Special case: remove ninja no-op line from stderr, but not stdout.
+ # Test cases that look for it should use RunCMake_TEST_OUTPUT_MERGE.
+ string(REGEX REPLACE "(^|\r?\n)ninja: no work to do\\.\r?\n" "\\1" actual_stderr "${actual_stderr}")
+
+ # Remove incidental content from both stdout and stderr.
string(CONCAT ignore_line_regex
"(^|\n)((==[0-9]+=="
"|BullseyeCoverage"
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index 62163ac..794274c 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -206,7 +206,7 @@ if(NOT XCODE_VERSION VERSION_LESS 7)
unset(RunCMake_TEST_OPTIONS)
endif()
-if(XCODE_VERSION VERSION_GREATER_EQUAL 6 AND XCODE_VERSION VERSION_LESS 12)
+if(XCODE_VERSION VERSION_GREATER_EQUAL 6)
# XcodeIOSInstallCombined
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombined-build)
set(RunCMake_TEST_NO_CLEAN 1)
@@ -220,7 +220,14 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 6 AND XCODE_VERSION VERSION_LESS 12)
run_cmake(XcodeIOSInstallCombined)
run_cmake_command(XcodeIOSInstallCombined-build ${CMAKE_COMMAND} --build .)
- run_cmake_command(XcodeIOSInstallCombined-install ${CMAKE_COMMAND} --build . --target install)
+ if(XCODE_VERSION VERSION_LESS 12)
+ run_cmake_command(XcodeIOSInstallCombined-install ${CMAKE_COMMAND} --build . --target install)
+ endif()
+ # --build defaults to Debug, --install defaults to Release, so we have to
+ # specify the configuration explicitly
+ run_cmake_command(XcodeIOSInstallCombined-cmakeinstall
+ ${CMAKE_COMMAND} --install . --config Debug
+ )
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
@@ -239,7 +246,14 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 6 AND XCODE_VERSION VERSION_LESS 12)
run_cmake(XcodeIOSInstallCombinedPrune)
run_cmake_command(XcodeIOSInstallCombinedPrune-build ${CMAKE_COMMAND} --build .)
- run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install)
+ if(XCODE_VERSION VERSION_LESS 12)
+ run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install)
+ endif()
+ # --build defaults to Debug, --install defaults to Release, so we have to
+ # specify the configuration explicitly
+ run_cmake_command(XcodeIOSInstallCombinedPrune-cmakeinstall
+ ${CMAKE_COMMAND} --install . --config Debug
+ )
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
@@ -258,7 +272,14 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 6 AND XCODE_VERSION VERSION_LESS 12)
run_cmake(XcodeIOSInstallCombinedSingleArch)
run_cmake_command(XcodeIOSInstallCombinedSingleArch-build ${CMAKE_COMMAND} --build .)
- run_cmake_command(XcodeIOSInstallCombinedSingleArch-install ${CMAKE_COMMAND} --build . --target install)
+ if(XCODE_VERSION VERSION_LESS 12)
+ run_cmake_command(XcodeIOSInstallCombinedSingleArch-install ${CMAKE_COMMAND} --build . --target install)
+ endif()
+ # --build defaults to Debug, --install defaults to Release, so we have to
+ # specify the configuration explicitly
+ run_cmake_command(XcodeIOSInstallCombinedSingleArch-cmakeinstall
+ ${CMAKE_COMMAND} --install . --config Debug
+ )
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-cmakeinstall-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-cmakeinstall-check.cmake
new file mode 100644
index 0000000..a1ceb13
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-cmakeinstall-check.cmake
@@ -0,0 +1,2 @@
+# Expect the same results whether installing directly or via cmake --install
+include(${CMAKE_CURRENT_LIST_DIR}/XcodeIOSInstallCombined-install-check.cmake)
diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-cmakeinstall-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-cmakeinstall-check.cmake
new file mode 100644
index 0000000..3f7c379
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-cmakeinstall-check.cmake
@@ -0,0 +1,2 @@
+# Expect the same results whether installing directly or via cmake --install
+include(${CMAKE_CURRENT_LIST_DIR}/XcodeIOSInstallCombinedSingleArch-install-check.cmake)
diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake
index e6f2623..e7cdbf6 100644
--- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake
+++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake
@@ -148,6 +148,27 @@ set(_check
)
check_contents(deps/udeps6.txt "^${_check}$")
+# Weak library reference should have exactly the same dependencies as a regular library reference (test 1)
+set_with_libsystem(_check
+ [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/bin/../lib/executable_path/libexecutable_path\.dylib]]
+ [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/bin/../lib/rpath_executable_path/librpath_executable_path\.dylib]]
+ [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/libtestlib\.dylib]]
+ [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/loader_path/libloader_path\.dylib]]
+ [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/normal/../rpath/librpath\.dylib]]
+ [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/normal/libnormal\.dylib]]
+ [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/rpath_loader_path/librpath_loader_path\.dylib]]
+ )
+check_contents(deps/deps7.txt "^${_check}$")
+
+set(_check
+ [[@executable_path/../lib/executable_path_bundle/libexecutable_path_bundle\.dylib]]
+ [[@loader_path/loader_path_unresolved/libloader_path_unresolved\.dylib]]
+ [[@rpath/librpath_executable_path_bundle\.dylib]]
+ [[@rpath/librpath_loader_path_unresolved\.dylib]]
+ [[@rpath/librpath_unresolved\.dylib]]
+ )
+check_contents(deps/udeps7.txt "^${_check}$")
+
set(_check
"^libconflict\\.dylib:[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/conflict/libconflict\\.dylib;[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/conflict2/libconflict\\.dylib\n$"
)
@@ -157,3 +178,4 @@ check_contents(deps/cdeps3.txt "${_check}")
check_contents(deps/cdeps4.txt "${_check}")
check_contents(deps/cdeps5.txt "${_check}")
check_contents(deps/cdeps6.txt "${_check}")
+check_contents(deps/cdeps7.txt "${_check}")
diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos.cmake
index c56a14b..aab19b7 100644
--- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos.cmake
+++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos.cmake
@@ -128,16 +128,19 @@ endforeach()
target_link_libraries(testlib PRIVATE ${testlib_names})
add_executable(topexe macos/topexe.c)
+add_executable(topexe_weak macos/topexe.c)
add_library(toplib SHARED macos/toplib.c)
add_library(topmod MODULE macos/toplib.c)
target_link_libraries(topexe PRIVATE testlib)
+target_link_libraries(topexe_weak PRIVATE "-weak_library" testlib)
target_link_libraries(toplib PRIVATE testlib)
target_link_libraries(topmod PRIVATE testlib)
set_property(TARGET topexe toplib topmod PROPERTY INSTALL_RPATH "${CMAKE_BINARY_DIR}/root-all/executable/lib")
+set_property(TARGET topexe_weak toplib topmod PROPERTY INSTALL_RPATH "${CMAKE_BINARY_DIR}/root-all/executable/lib")
-install(TARGETS topexe toplib topmod testlib testlib_conflict RUNTIME DESTINATION executable/bin LIBRARY DESTINATION executable/lib)
-install(TARGETS topexe toplib topmod testlib testlib_conflict RUNTIME DESTINATION bundle_executable/bin LIBRARY DESTINATION bundle_executable/lib)
+install(TARGETS topexe topexe_weak toplib topmod testlib testlib_conflict RUNTIME DESTINATION executable/bin LIBRARY DESTINATION executable/lib)
+install(TARGETS topexe topexe_weak toplib topmod testlib testlib_conflict RUNTIME DESTINATION bundle_executable/bin LIBRARY DESTINATION bundle_executable/lib)
install(CODE [[
function(exec_get_runtime_dependencies depsfile udepsfile cdepsfile)
@@ -213,4 +216,12 @@ install(CODE [[
"${CMAKE_INSTALL_PREFIX}/executable/lib/$<TARGET_FILE_NAME:testlib_conflict>"
BUNDLE_EXECUTABLE "${CMAKE_INSTALL_PREFIX}/bundle_executable/bin/$<TARGET_FILE_NAME:topexe>"
)
+
+ exec_get_runtime_dependencies(
+ deps7.txt udeps7.txt cdeps7.txt
+ EXECUTABLES
+ "${CMAKE_INSTALL_PREFIX}/executable/bin/$<TARGET_FILE_NAME:topexe_weak>"
+ LIBRARIES
+ "${CMAKE_INSTALL_PREFIX}/executable/lib/$<TARGET_FILE_NAME:testlib_conflict>"
+ )
]])
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index 5b849bf..fffb038 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -93,7 +93,9 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja")
message(STATUS "RerunCMake: first configuration...")
run_cmake(RerunCMake)
if(NOT CMake_TEST_FILESYSTEM_1S)
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .)
+ unset(RunCMake_TEST_OUTPUT_MERGE)
endif()
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) # handle 1s resolution
@@ -101,7 +103,9 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja")
file(WRITE "${in_tc}" "does-not-compile\n")
run_cmake_command(RerunCMake-rerun${ninja} ${CMAKE_COMMAND} --build .)
if(NOT CMake_TEST_FILESYSTEM_1S)
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .)
+ unset(RunCMake_TEST_OUTPUT_MERGE)
endif()
unset(RunCMake_TEST_BINARY_DIR)