Skip to content

Commit 1f3e232

Browse files
committed
swiftpm: Test only running host platform architecture
When adding a Swift Testing test to Swift PM repository, the `test` portion of t he OSX package pipeline was building against x86_64 and arm64. Ensure Swift PM testing only runs against the host platform architecture.
1 parent c35d65e commit 1f3e232

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

utils/build-presets.ini

+1
Original file line numberDiff line numberDiff line change
@@ -1846,6 +1846,7 @@ swift-testing-macros
18461846
install-swift-testing
18471847
install-swift-testing-macros
18481848

1849+
infer-cross-compile-hosts-on-darwin
18491850
skip-test-swift
18501851

18511852
[preset: mixin_swiftpm_macos_platform]

utils/swift_build_support/swift_build_support/products/swiftpm.py

+17-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,14 @@ def is_before_build_script_impl_product(cls):
4242
def should_build(self, host_target):
4343
return True
4444

45-
def run_bootstrap_script(self, action, host_target, additional_params=[]):
45+
def run_bootstrap_script(
46+
self,
47+
action,
48+
host_target,
49+
additional_params=[],
50+
*,
51+
compile_only_for_running_host_architecture=False,
52+
):
4653
script_path = os.path.join(
4754
self.source_dir, 'Utilities', 'bootstrap')
4855

@@ -85,7 +92,10 @@ def run_bootstrap_script(self, action, host_target, additional_params=[]):
8592
]
8693

8794
# Pass Cross compile host info
88-
if self.has_cross_compile_hosts():
95+
if (
96+
not compile_only_for_running_host_architecture
97+
and self.has_cross_compile_hosts()
98+
):
8999
if self.is_darwin_host(host_target):
90100
helper_cmd += ['--cross-compile-hosts']
91101
for cross_compile_host in self.args.cross_compile_hosts:
@@ -114,7 +124,11 @@ def should_test(self, host_target):
114124
return self.args.test_swiftpm
115125

116126
def test(self, host_target):
117-
self.run_bootstrap_script('test', host_target)
127+
self.run_bootstrap_script(
128+
'test',
129+
host_target,
130+
compile_only_for_running_host_architecture=True,
131+
)
118132

119133
def should_clean(self, host_target):
120134
return self.args.clean_swiftpm

0 commit comments

Comments
 (0)