Skip to content

test: introduce a helper for building mock plugins #68318

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
Sep 4, 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
24 changes: 24 additions & 0 deletions test/Macros/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# '-enable-experimental-feature Macros' requires an asserts build.
if 'asserts' not in config.available_features:
config.unsupported = True

config.subsitutions = list(config.substitutions)

def get_target_os():
import re
(run_cpu, run_vendor, run_os, run_version) = re.match('([^-]+)-([^-]+)-([^0-9]+)(.*)', config.variant_triple).groups()
return run_os

if get_target_os() in ['windows-msvc']:
config.substitutions.insert(
0,
(
'%swift-build-cxx-plugin',
'%clang -isysroot %host_sdk -I %swift_src_root/include -L %swift-lib-dir -l_swiftMockPlugin'
)
)
else:
config.substitutions.insert(
0,
(
'%swift-build-cxx-plugin',
'%clang -isysroot %host_sdk -I %swift_src_root/include -L %swift-lib-dir -l_swiftMockPlugin -Xlinker -rpath -Xlinker %swift-lib-dir'
)
)
8 changes: 1 addition & 7 deletions test/Macros/macro_plugin_basic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
// RUN: %empty-directory(%t)
// RUN: split-file %s %t

// RUN: %clang \
// RUN: -isysroot %host_sdk \
// RUN: -I %swift_src_root/include \
// RUN: -L %swift-lib-dir -l_swiftMockPlugin \
// RUN: -Wl,-rpath,%swift-lib-dir \
// RUN: -o %t/mock-plugin \
// RUN: %t/plugin.c
// RUN: %swift-build-cxx-plugin -o %t/mock-plugin %t/plugin.c

// RUN: env SWIFT_DUMP_PLUGIN_MESSAGING=1 %swift-target-frontend \
// RUN: -typecheck -verify \
Expand Down
8 changes: 1 addition & 7 deletions test/Macros/macro_plugin_error.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@
// RUN: %empty-directory(%t)
// RUN: split-file %s %t

// RUN: %clang \
// RUN: -isysroot %host_sdk \
// RUN: -I %swift_src_root/include \
// RUN: -L %swift-lib-dir -l_swiftMockPlugin \
// RUN: -Wl,-rpath,%swift-lib-dir \
// RUN: -o %t/mock-plugin \
// RUN: %t/plugin.c
// RUN: %swift-build-cxx-plugin -o %t/mock-plugin %t/plugin.c

// RUN: env SWIFT_DUMP_PLUGIN_MESSAGING=1 %swift-target-frontend \
// RUN: -typecheck -verify \
Expand Down
8 changes: 1 addition & 7 deletions test/Macros/macro_plugin_searchorder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,7 @@
// RUN: -g -no-toolchain-stdlib-rpath

//#-- For -load-plugin-executable
// RUN: %clang \
// RUN: -isysroot %host_sdk \
// RUN: -I %swift_src_root/include \
// RUN: -L %swift-lib-dir -l_swiftMockPlugin \
// RUN: -Wl,-rpath,%swift-lib-dir \
// RUN: -o %t/libexec/MacroDefinitionPlugin \
// RUN: %t/src/MacroDefinition.c
// RUN: %swift-build-cxx-plugin -o %t/libexec/MacroDefinitionPlugin %t/src/MacroDefinition.c

//#-- Expect -load-plugin-library
// RUN: %target-build-swift %t/src/test.swift \
Expand Down
8 changes: 1 addition & 7 deletions test/Macros/macro_swiftdeps.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@
// RUN: -g -no-toolchain-stdlib-rpath

//#-- Prepare the macro executable plugin.
// RUN: %clang \
// RUN: -isysroot %host_sdk \
// RUN: -I %swift_src_root/include \
// RUN: -L %swift-lib-dir -l_swiftMockPlugin \
// RUN: -Wl,-rpath,%swift-lib-dir \
// RUN: -o %t/mock-plugin \
// RUN: %t/src/plugin.c
// RUN: %swift-build-cxx-plugin -o %t/mock-plugin %t/src/plugin.c

//#-- Prepare the macro library.
// RUN: %target-swift-frontend \
Expand Down