summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-02-23 13:09:04 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-02-23 13:09:10 (GMT)
commit65b70406d905fe6ef02f28c32d5f6dfd8d6b6c54 (patch)
tree22f68d2c66a191be1c4dbd0c00e41290b88ed705
parent8362915b9dc33bc31289aa4c9b4816753ea548b2 (diff)
parent1c15eb39d22db769386301bb192ca6423060c08c (diff)
downloadCMake-65b70406d905fe6ef02f28c32d5f6dfd8d6b6c54.zip
CMake-65b70406d905fe6ef02f28c32d5f6dfd8d6b6c54.tar.gz
CMake-65b70406d905fe6ef02f28c32d5f6dfd8d6b6c54.tar.bz2
Merge topic 'test-macos-arm64' into release-3.20
1c15eb39d2 Tests: Suppress failures on macOS arm64 due to separate Xcode signing phase 92418ac0ef Tests: Fix CTestTestCrash expected output on macOS arm64 8b22d9b3c3 Tests: Remove explicit no-signing marks from BundleTest 483db3de56 Tests: Clarify internal project name in RunCMake.GoogleTest cases Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5846
-rw-r--r--Tests/BundleTest/BundleLib.cxx4
-rw-r--r--Tests/BundleTest/BundleSubDir/CMakeLists.txt8
-rw-r--r--Tests/BundleTest/CMakeLists.txt17
-rw-r--r--Tests/BundleUtilities/CMakeLists.txt9
-rw-r--r--Tests/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTest.cmake8
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTestDiscoveryMultiConfig.cmake5
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTestDiscoveryTimeout.cmake5
-rw-r--r--Tests/RunCMake/GoogleTest/GoogleTestXML.cmake5
-rw-r--r--Tests/RunCMake/GoogleTest/xcode_sign_adhoc.cmake8
-rw-r--r--Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake6
11 files changed, 58 insertions, 19 deletions
diff --git a/Tests/BundleTest/BundleLib.cxx b/Tests/BundleTest/BundleLib.cxx
index b7fd70d..d25ad27 100644
--- a/Tests/BundleTest/BundleLib.cxx
+++ b/Tests/BundleTest/BundleLib.cxx
@@ -52,8 +52,8 @@ int foo(char* exec)
(void)br;
int res1 = findBundleFile(exec, "Resources/randomResourceFile.plist");
- int res2 = findBundleFile(exec, "MacOS/SomeRandomFile.txt");
- int res3 = findBundleFile(exec, "MacOS/README.rst");
+ int res2 = findBundleFile(exec, "Other/SomeRandomFile.txt");
+ int res3 = findBundleFile(exec, "Other/README.rst");
if (!res1 || !res2 || !res3) {
return 1;
}
diff --git a/Tests/BundleTest/BundleSubDir/CMakeLists.txt b/Tests/BundleTest/BundleSubDir/CMakeLists.txt
index 5f91f20..ceb5216 100644
--- a/Tests/BundleTest/BundleSubDir/CMakeLists.txt
+++ b/Tests/BundleTest/BundleSubDir/CMakeLists.txt
@@ -16,7 +16,7 @@ set_source_files_properties(
"${BundleTest_SOURCE_DIR}/SomeRandomFile.txt"
"${BundleTest_SOURCE_DIR}/../../README.rst"
PROPERTIES
- MACOSX_PACKAGE_LOCATION MacOS
+ MACOSX_PACKAGE_LOCATION Other
)
add_executable(SecondBundle
@@ -35,11 +35,7 @@ install(TARGETS SecondBundle DESTINATION Applications)
# installed into a location that uses this output name this will fail if the
# bundle does not respect the name. Also the executable will not be found by
# the test driver if this does not work.
-set_target_properties(SecondBundle PROPERTIES
- OUTPUT_NAME SecondBundleExe
- XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
- XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO"
- )
+set_target_properties(SecondBundle PROPERTIES OUTPUT_NAME SecondBundleExe)
# Express one app bundle in terms of another's SOURCES to verify that
# the generators do not expose the Info.plist of one to the other.
diff --git a/Tests/BundleTest/CMakeLists.txt b/Tests/BundleTest/CMakeLists.txt
index 1bedc70..c63461a 100644
--- a/Tests/BundleTest/CMakeLists.txt
+++ b/Tests/BundleTest/CMakeLists.txt
@@ -3,6 +3,15 @@ project(BundleTest)
set(MACOSX_BUNDLE_INFO_STRING "bundle_info_string")
set(CMAKE_MacOSX_Content_COMPILE_OBJECT "\"${CMAKE_COMMAND}\" -E copy_if_different <SOURCE> <OBJECT>")
+if(CMAKE_GENERATOR STREQUAL "Xcode" AND
+ "${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
+ # Tell Xcode to pretend the linker signed binaries so that
+ # editing with install_name_tool preserves ad-hoc signatures.
+ # See CMake Issue 21854.
+ # This option is supported by codesign on macOS 11 or higher.
+ set(CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS "-o linker-signed")
+endif()
+
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/randomResourceFile.plist"
COMMAND /bin/cp
@@ -19,7 +28,7 @@ set_source_files_properties(
SomeRandomFile.txt
"${BundleTest_SOURCE_DIR}/../../README.rst"
PROPERTIES
- MACOSX_PACKAGE_LOCATION MacOS
+ MACOSX_PACKAGE_LOCATION Other
)
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/foobar")
@@ -56,11 +65,7 @@ install(TARGETS BundleTest DESTINATION Applications)
# installed into a location that uses this output name this will fail if the
# bundle does not respect the name. Also the executable will not be found by
# the test driver if this does not work.
-set_target_properties(BundleTest PROPERTIES
- OUTPUT_NAME BundleTestExe
- XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
- XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO"
- )
+set_target_properties(BundleTest PROPERTIES OUTPUT_NAME BundleTestExe)
# Test executable versioning if it is supported.
if(NOT XCODE)
diff --git a/Tests/BundleUtilities/CMakeLists.txt b/Tests/BundleUtilities/CMakeLists.txt
index 6020644..4a95e2f 100644
--- a/Tests/BundleUtilities/CMakeLists.txt
+++ b/Tests/BundleUtilities/CMakeLists.txt
@@ -1,6 +1,15 @@
cmake_minimum_required(VERSION 2.8.12)
project(BundleUtilities)
+if(CMAKE_GENERATOR STREQUAL "Xcode" AND
+ "${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
+ # Tell Xcode to pretend the linker signed binaries so that
+ # editing with install_name_tool preserves ad-hoc signatures.
+ # See CMake Issue 21854.
+ # This option is supported by codesign on macOS 11 or higher.
+ set(CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS "-o linker-signed")
+endif()
+
###### the various types of dependencies we can have
# a shared library
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 4ed902c..8e7c04f 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -2955,7 +2955,7 @@ if(BUILD_TESTING)
PASS_REGULAR_EXPRESSION "Failed")
else()
set_tests_properties(CTestTestCrash PROPERTIES
- PASS_REGULAR_EXPRESSION "(Illegal|SegFault|Subprocess aborted)")
+ PASS_REGULAR_EXPRESSION "(Illegal|SegFault|Subprocess aborted|SIGTRAP)")
endif()
configure_file(
diff --git a/Tests/RunCMake/GoogleTest/GoogleTest.cmake b/Tests/RunCMake/GoogleTest/GoogleTest.cmake
index 6aa2658..8efd117 100644
--- a/Tests/RunCMake/GoogleTest/GoogleTest.cmake
+++ b/Tests/RunCMake/GoogleTest/GoogleTest.cmake
@@ -1,9 +1,12 @@
-project(test_include_dirs LANGUAGES CXX)
+enable_language(CXX)
include(GoogleTest)
enable_testing()
+include(xcode_sign_adhoc.cmake)
+
add_executable(fake_gtest fake_gtest.cpp)
+xcode_sign_adhoc(fake_gtest)
gtest_discover_tests(
fake_gtest
@@ -22,6 +25,7 @@ gtest_discover_tests(
)
add_executable(no_tests_defined no_tests_defined.cpp)
+xcode_sign_adhoc(no_tests_defined)
gtest_discover_tests(
no_tests_defined
@@ -33,6 +37,7 @@ gtest_discover_tests(
# 3.10.3 and later behavior, old behavior added in 3.10.1
# is not supported.
add_executable(property_timeout_test timeout_test.cpp)
+xcode_sign_adhoc(property_timeout_test)
target_compile_definitions(property_timeout_test PRIVATE sleepSec=10)
gtest_discover_tests(
@@ -50,6 +55,7 @@ gtest_discover_tests(
)
add_executable(skip_test skip_test.cpp)
+xcode_sign_adhoc(skip_test)
gtest_discover_tests(
skip_test
diff --git a/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryMultiConfig.cmake b/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryMultiConfig.cmake
index df784fe..2fae1e2 100644
--- a/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryMultiConfig.cmake
+++ b/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryMultiConfig.cmake
@@ -1,9 +1,12 @@
-project(test_include_dirs LANGUAGES CXX)
+enable_language(CXX)
include(GoogleTest)
enable_testing()
+include(xcode_sign_adhoc.cmake)
+
add_executable(configuration_gtest configuration_gtest.cpp)
+xcode_sign_adhoc(configuration_gtest)
target_compile_definitions(configuration_gtest PRIVATE $<$<CONFIG:Debug>:DEBUG=1>)
gtest_discover_tests(
diff --git a/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryTimeout.cmake b/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryTimeout.cmake
index 20e9d65..5c24d41 100644
--- a/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryTimeout.cmake
+++ b/Tests/RunCMake/GoogleTest/GoogleTestDiscoveryTimeout.cmake
@@ -1,9 +1,12 @@
-project(test_include_dirs LANGUAGES CXX)
+enable_language(CXX)
include(GoogleTest)
enable_testing()
+include(xcode_sign_adhoc.cmake)
+
add_executable(discovery_timeout_test timeout_test.cpp)
+xcode_sign_adhoc(discovery_timeout_test)
target_compile_definitions(discovery_timeout_test PRIVATE discoverySleepSec=10)
gtest_discover_tests(
discovery_timeout_test
diff --git a/Tests/RunCMake/GoogleTest/GoogleTestXML.cmake b/Tests/RunCMake/GoogleTest/GoogleTestXML.cmake
index fb91c0e..53eedc0 100644
--- a/Tests/RunCMake/GoogleTest/GoogleTestXML.cmake
+++ b/Tests/RunCMake/GoogleTest/GoogleTestXML.cmake
@@ -1,8 +1,10 @@
-project(test_include_dirs LANGUAGES CXX)
+enable_language(CXX)
include(GoogleTest)
enable_testing()
+include(xcode_sign_adhoc.cmake)
+
# This creates the folder structure for the paramterized tests
# to avoid handling missing folders in C++
#
@@ -15,6 +17,7 @@ enable_testing()
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/GoogleTestXMLSpecial/cases.case")
add_executable(xml_output xml_output.cpp)
+xcode_sign_adhoc(xml_output)
gtest_discover_tests(
xml_output
XML_OUTPUT_DIR ${CMAKE_BINARY_DIR}
diff --git a/Tests/RunCMake/GoogleTest/xcode_sign_adhoc.cmake b/Tests/RunCMake/GoogleTest/xcode_sign_adhoc.cmake
new file mode 100644
index 0000000..d2dc530
--- /dev/null
+++ b/Tests/RunCMake/GoogleTest/xcode_sign_adhoc.cmake
@@ -0,0 +1,8 @@
+function(xcode_sign_adhoc target)
+ if(CMAKE_GENERATOR STREQUAL "Xcode" AND
+ "${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
+ # Xcode runs POST_BUILD before signing, so let the linker use ad-hoc signing.
+ # See CMake Issue 21845.
+ target_link_options(${target} PRIVATE LINKER:-adhoc_codesign)
+ endif()
+endfunction()
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake
index 0a76932..3d60556 100644
--- a/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake
@@ -12,4 +12,10 @@ add_executable(LinkObjLHSShared LinkObjLHSShared.c)
target_link_libraries(LinkObjLHSShared AnObjLib)
# Verify that our dependency on OtherLib generated its versioning symlinks.
+if(CMAKE_GENERATOR STREQUAL "Xcode" AND
+ "${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64")
+ # Xcode runs POST_BUILD before signing, so let the linker use ad-hoc signing.
+ # See CMake Issue 21845.
+ target_link_options(LinkObjLHSShared PRIVATE LINKER:-adhoc_codesign)
+endif()
add_custom_command(TARGET LinkObjLHSShared POST_BUILD COMMAND LinkObjLHSShared)