mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #68318 from compnerd/plugin-helper-helper-helper
test: introduce a helper for building mock plugins
This commit is contained in:
@@ -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'
|
||||
)
|
||||
)
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -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 \
|
||||
|
||||
Reference in New Issue
Block a user