mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-07 23:28:36 -06:00
Merge topic 'test-macos-arm64' into release-3.20
1c15eb39d2Tests: Suppress failures on macOS arm64 due to separate Xcode signing phase92418ac0efTests: Fix CTestTestCrash expected output on macOS arm648b22d9b3c3Tests: Remove explicit no-signing marks from BundleTest483db3de56Tests: Clarify internal project name in RunCMake.GoogleTest cases Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5846
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}
|
||||
|
||||
8
Tests/RunCMake/GoogleTest/xcode_sign_adhoc.cmake
Normal file
8
Tests/RunCMake/GoogleTest/xcode_sign_adhoc.cmake
Normal file
@@ -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()
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user