Skip to content

Commit 82287c9

Browse files
authored
Merge pull request #23322 from compnerd/stub-out-everything
test: create a stub BlocksRuntime for the tests
2 parents dd8b405 + 3ea8dae commit 82287c9

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

test/CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,29 @@ foreach(SDK ${SWIFT_SDKS})
195195

196196
set(test_dependencies)
197197
get_test_dependencies("${SDK}" test_dependencies)
198+
199+
# NOTE create a stub BlocksRuntime library that can be used for the
200+
# reflection tests
201+
file(WRITE ${test_bin_dir}/BlocksRuntime.c
202+
"void
203+
#if defined(_WIN32)
204+
__declspec(dllexport)
205+
#endif
206+
_Block_release(void) { }\n")
207+
add_library(BlocksRuntimeStub-${SDK}-${ARCH} SHARED
208+
${test_bin_dir}/BlocksRuntime.c)
209+
if(CMAKE_C_COMPILER_ID STREQUAL Clang AND
210+
NOT CMAKE_C_COMPILER_SIMULATE_ID STREQUAL MSVC)
211+
target_compile_options(BlocksRuntimeStub-${SDK}-${ARCH} PRIVATE
212+
-target;${SWIFT_SDK_${SDK}_ARCH_${ARCH}_TRIPLE})
213+
endif()
214+
set_target_properties(BlocksRuntimeStub-${SDK}-${ARCH} PROPERTIES
215+
ARCHIVE_OUTPUT_DIRECTORY ${test_bin_dir}
216+
LIBRARY_OUTPUT_DIRECTORY ${test_bin_dir}
217+
RUNTIME_OUTPUT_DIRECTORY ${test_bin_dir}
218+
OUTPUT_NAME BlocksRuntime)
219+
list(APPEND test_dependencies BlocksRuntimeStub-${SDK}-${ARCH})
220+
198221
list(APPEND test_dependencies
199222
"swift-test-stdlib-${SWIFT_SDK_${SDK}_LIB_SUBDIR}")
200223

test/Reflection/capture_descriptors.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
// REQUIRES: no_asan
33
// RUN: %empty-directory(%t)
4-
// RUN: %target-build-swift %s -emit-module -emit-library -module-name capture_descriptors -o %t/capture_descriptors%{target-shared-library-suffix}
4+
// RUN: %target-build-swift %s -emit-module -emit-library -module-name capture_descriptors -o %t/capture_descriptors%{target-shared-library-suffix} -L%t/../../.. -lBlocksRuntime
55
// RUN: %target-swift-reflection-dump -binary-filename %t/capture_descriptors%{target-shared-library-suffix} | %FileCheck %s
66

77
sil_stage canonical

0 commit comments

Comments
 (0)