Skip to content

[Macros/Tests] Build test plugins with the same compiler as the dylib #70213

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 2 commits into from
Dec 5, 2023
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
3 changes: 2 additions & 1 deletion test/Macros/lit.local.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ if get_target_os() in ['windows-msvc']:
else:
# FIXME(compnerd) do all the targets we currently support use SysV ABI?
config.substitutions.insert(0, ('%target-abi', 'SYSV'))
config.substitutions.insert(0, ('%cmake-c-compiler', config.cmake_c_compiler))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also insert cmake-cxx-compiler? Or not add it to the cfg, since it is otherwise unused?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My vote goes to remove config.cmake_cxx_compiler = r'''@CMAKE_CXX_COMPILER@''', if it is not needed. Not a big deal if it stays there, in any case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the tests are already running, let me leave it as-is. 👍

config.substitutions.insert(
0,
(
'%swift-build-c-plugin',
'%clang %c-flags %exe-linker-flags -isysroot %host_sdk -I %swift_src_root/include -L %swift-lib-dir -l_swiftMockPlugin -Xlinker -rpath -Xlinker %swift-lib-dir'
'%cmake-c-compiler %c-flags %exe-linker-flags -target %host_triple -isysroot %host_sdk -I %swift_src_root/include -L %swift-lib-dir -l_swiftMockPlugin -Xlinker -rpath -Xlinker %swift-lib-dir'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-target %host_triple this doesn't seem to be necessary, but still.

)
)
config.substitutions.append(('%c-flags', config.c_flags))
Expand Down
3 changes: 0 additions & 3 deletions test/Macros/macro_plugin_basic.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// FIXME: Failing in ASAN (rdar://119141141)
// UNSUPPORTED: asan_runtime

// REQUIRES: swift_swift_parser

// RUN: %empty-directory(%t)
Expand Down
3 changes: 0 additions & 3 deletions test/Macros/macro_plugin_disable_sandbox.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// FIXME: Failing in ASAN (rdar://119141141)
// UNSUPPORTED: asan_runtime

// REQUIRES: swift_swift_parser

// sandbox-exec is only avaiable in Darwin
Expand Down
3 changes: 0 additions & 3 deletions test/Macros/macro_plugin_error.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// FIXME: Failing in ASAN (rdar://119141141)
// UNSUPPORTED: asan_runtime

// REQUIRES: swift_swift_parser

// RUN: %empty-directory(%t)
Expand Down
2 changes: 0 additions & 2 deletions test/Macros/macro_plugin_searchorder.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// FIXME: Failing in ASAN (rdar://119141141)
// UNSUPPORTED: asan_runtime

// REQUIRES: swift_swift_parser, executable_test

Expand Down
3 changes: 0 additions & 3 deletions test/Macros/macro_swiftdeps.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// FIXME: Failing in ASAN (rdar://119141141)
// UNSUPPORTED: asan_runtime

// REQUIRES: swift_swift_parser

// RUN: %empty-directory(%t)
Expand Down
2 changes: 2 additions & 0 deletions test/lit.site.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ config.swift_driver_test_options = "@SWIFT_DRIVER_TEST_OPTIONS@"
config.swift_frontend_test_options = "@SWIFT_FRONTEND_TEST_OPTIONS@"
config.swift_ide_test_test_options = "@SWIFT_IDE_TEST_TEST_OPTIONS@"

config.cmake_c_compiler = r'''@CMAKE_C_COMPILER@'''
config.cmake_cxx_compiler = r'''@CMAKE_CXX_COMPILER@'''
config.c_flags = r'''@CMAKE_C_FLAGS@'''
config.exe_linker_flags = r'''@CMAKE_EXE_LINKER_FLAGS@'''

Expand Down
2 changes: 1 addition & 1 deletion tools/libMockPlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ add_llvm_symbol_exports(libMockPlugin ${LLVM_EXPORTED_SYMBOL_FILE})

add_dependencies(tools libMockPlugin)
# Adds -dead_strip option
add_link_opts(libStaticMirror)
add_link_opts(libMockPlugin)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by fix. libStaticMirror was just copy-pasted from somewhere.