Skip to content

Commit 6a2c8bd

Browse files
Merge pull request #18593 from aschwaighofer/codesign_reflection_tests
Codesign reflection tests
2 parents b9a53eb + b05f0b4 commit 6a2c8bd

33 files changed

+47
-1
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2209,6 +2209,21 @@ function(add_swift_target_executable name)
22092209
${SWIFTEXE_TARGET_EXCLUDE_FROM_ALL_FLAG_CURRENT}
22102210
${SWIFTEXE_TARGET_DONT_STRIP_NON_MAIN_SYMBOLS_FLAG}
22112211
${SWIFTEXE_DISABLE_ASLR_FLAG})
2212+
2213+
is_darwin_based_sdk("${sdk}" IS_DARWIN)
2214+
if(IS_DARWIN)
2215+
add_custom_command_target(unused_var2
2216+
COMMAND "codesign" "-f" "-s" "-" "${SWIFT_RUNTIME_OUTPUT_INTDIR}/${VARIANT_NAME}"
2217+
CUSTOM_TARGET_NAME "${VARIANT_NAME}_signed"
2218+
OUTPUT "${SWIFT_RUNTIME_OUTPUT_INTDIR}/${VARIANT_NAME}_signed"
2219+
DEPENDS ${VARIANT_NAME})
2220+
else()
2221+
# No code signing on other platforms.
2222+
add_custom_command_target(unused_var2
2223+
CUSTOM_TARGET_NAME "${VARIANT_NAME}_signed"
2224+
OUTPUT "${SWIFT_RUNTIME_OUTPUT_INTDIR}/${VARIANT_NAME}_signed"
2225+
DEPENDS ${VARIANT_NAME})
2226+
endif()
22122227
endforeach()
22132228
endforeach()
22142229
endfunction()

test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ foreach(SDK ${SWIFT_SDKS})
196196

197197
if(SWIFT_BUILD_STDLIB AND SWIFT_INCLUDE_TESTS)
198198
list(APPEND test_dependencies
199-
"swift-reflection-test${VARIANT_SUFFIX}")
199+
"swift-reflection-test${VARIANT_SUFFIX}_signed")
200200
endif()
201201

202202
if(NOT "${COVERAGE_DB}" STREQUAL "")

validation-test/Reflection/existentials.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/existentials
3+
// RUN: %target-codesign %t/existentials
34
// RUN: %target-run %target-swift-reflection-test %t/existentials | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/functions.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/functions
3+
// RUN: %target-codesign %t/functions
34
// RUN: %target-run %target-swift-reflection-test %t/functions | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
45

56
// FIXME: Should not require objc_interop -- please put Objective-C-specific

validation-test/Reflection/functions_objc.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/functions
3+
// RUN: %target-codesign %t/functions
34
// RUN: %target-run %target-swift-reflection-test %t/functions | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/inherits_NSObject.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/inherits_NSObject
3+
// RUN: %target-codesign %t/inherits_NSObject
34
// RUN: %target-run %target-swift-reflection-test %t/inherits_NSObject | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
45

56
// REQUIRES: objc_interop

validation-test/Reflection/inherits_ObjCClasses.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
// RUN: %clang %target-cc-options -isysroot %sdk -fobjc-arc %S/Inputs/ObjCClasses/ObjCClasses.m -c -o %t/ObjCClasses.o
44
// RUN: %target-build-swift -I %S/Inputs/ObjCClasses/ -lswiftSwiftReflectionTest %t/ObjCClasses.o %s -o %t/inherits_ObjCClasses
5+
// RUN: %target-codesign %t/inherits_ObjCClasses
56
// RUN: %target-run %target-swift-reflection-test %t/inherits_ObjCClasses | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
67

78
// REQUIRES: objc_interop

validation-test/Reflection/inherits_Swift.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/inherits_Swift
3+
// RUN: %target-codesign %t/inherits_Swift
34
// RUN: %target-run %target-swift-reflection-test %t/inherits_Swift | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
45

56
// REQUIRES: objc_interop

validation-test/Reflection/reflect_Array.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Array
3+
// RUN: %target-codesign %t/reflect_Array
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_Array 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_Bool.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Bool
3+
// RUN: %target-codesign %t/reflect_Bool
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_Bool 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_Character.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Character
3+
// RUN: %target-codesign %t/reflect_Character
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_Character 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_Dictionary.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Dictionary
3+
// RUN: %target-codesign %t/reflect_Dictionary
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_Dictionary 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_Double.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Double
3+
// RUN: %target-codesign %t/reflect_Double
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_Double 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_Float.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Float
3+
// RUN: %target-codesign %t/reflect_Float
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_Float 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_Int.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Int
3+
// RUN: %target-codesign %t/reflect_Int
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_Int 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_Int16.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Int16
3+
// RUN: %target-codesign %t/reflect_Int16
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_Int16 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_Int32.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Int32
3+
// RUN: %target-codesign %t/reflect_Int32
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_Int32 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_Int64.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Int64
3+
// RUN: %target-codesign %t/reflect_Int64
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_Int64 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_Int8.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Int8
3+
// RUN: %target-codesign %t/reflect_Int8
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_Int8 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_NSArray.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_NSArray
3+
// RUN: %target-codesign %t/reflect_NSArray
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_NSArray 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_NSNumber.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_NSNumber
3+
// RUN: %target-codesign %t/reflect_NSNumber
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_NSNumber 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_NSSet.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_NSSet
3+
// RUN: %target-codesign %t/reflect_NSSet
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_NSSet 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_NSString.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_NSString
3+
// RUN: %target-codesign %t/reflect_NSString
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_NSString 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_Set.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Set
3+
// RUN: %target-codesign %t/reflect_Set
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_Set 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_String.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_String
3+
// RUN: %target-codesign %t/reflect_String
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_String 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_UInt.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_UInt
3+
// RUN: %target-codesign %t/reflect_UInt
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_UInt 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_UInt16.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_UInt16
3+
// RUN: %target-codesign %t/reflect_UInt16
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_UInt16 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_UInt32.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_UInt32
3+
// RUN: %target-codesign %t/reflect_UInt32
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_UInt32 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_UInt64.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_UInt64
3+
// RUN: %target-codesign %t/reflect_UInt64
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_UInt64 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_UInt8.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_UInt8
3+
// RUN: %target-codesign %t/reflect_UInt8
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_UInt8 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_empty_class.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_empty_class
3+
// RUN: %target-codesign %t/reflect_empty_class
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_empty_class 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_existential.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_existential
3+
// RUN: %target-codesign %t/reflect_existential
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_existential 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

validation-test/Reflection/reflect_multiple_types.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_multiple_types
3+
// RUN: %target-codesign %t/reflect_multiple_types
34
// RUN: %target-run %target-swift-reflection-test %t/reflect_multiple_types 2>&1 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
45
// REQUIRES: objc_interop
56
// REQUIRES: executable_test

0 commit comments

Comments
 (0)