Skip to content

test: create a stub BlocksRuntime for the tests #23322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,29 @@ foreach(SDK ${SWIFT_SDKS})

set(test_dependencies)
get_test_dependencies("${SDK}" test_dependencies)

# NOTE create a stub BlocksRuntime library that can be used for the
# reflection tests
file(WRITE ${test_bin_dir}/BlocksRuntime.c
"void
#if defined(_WIN32)
__declspec(dllexport)
#endif
_Block_release(void) { }\n")
add_library(BlocksRuntimeStub-${SDK}-${ARCH} SHARED
${test_bin_dir}/BlocksRuntime.c)
if(CMAKE_C_COMPILER_ID STREQUAL Clang AND
NOT CMAKE_C_COMPILER_SIMULATE_ID STREQUAL MSVC)
target_compile_options(BlocksRuntimeStub-${SDK}-${ARCH} PRIVATE
-target;${SWIFT_SDK_${SDK}_ARCH_${ARCH}_TRIPLE})
endif()
set_target_properties(BlocksRuntimeStub-${SDK}-${ARCH} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${test_bin_dir}
LIBRARY_OUTPUT_DIRECTORY ${test_bin_dir}
RUNTIME_OUTPUT_DIRECTORY ${test_bin_dir}
OUTPUT_NAME BlocksRuntime)
list(APPEND test_dependencies BlocksRuntimeStub-${SDK}-${ARCH})

list(APPEND test_dependencies
"swift-test-stdlib-${SWIFT_SDK_${SDK}_LIB_SUBDIR}")

Expand Down
2 changes: 1 addition & 1 deletion test/Reflection/capture_descriptors.sil
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

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

sil_stage canonical
Expand Down