Merge pull request #68318 from compnerd/plugin-helper-helper-helper

test: introduce a helper for building mock plugins
This commit is contained in:
Saleem Abdulrasool
2023-09-04 13:16:39 -07:00
committed by GitHub
5 changed files with 28 additions and 28 deletions

View File

@@ -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'
)
)

View File

@@ -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 \

View File

@@ -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 \

View File

@@ -37,13 +37,7 @@
// RUN: %t/src/MacroDefinition.swift
//#-- 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 \

View File

@@ -15,13 +15,7 @@
// RUN: %S/Inputs/syntax_macro_definitions.swift
//#-- 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 \