Skip to content

Commit 2a377bc

Browse files
authored
Merge pull request #32363 from 3405691582/Test_OpenBSD_ArchAliasing
[test] Handle architecture aliasing for OpenBSD.
2 parents 73d8419 + c8ba437 commit 2a377bc

9 files changed

+26
-20
lines changed

test/ModuleInterface/ModuleCache/prebuilt-module-cache-archs.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %empty-directory(%t/include/Lib.swiftmodule)
3-
// RUN: cp %S/Inputs/prebuilt-module-cache/Lib.swiftinterface %t/include/Lib.swiftmodule/%target-cpu.swiftinterface
3+
// RUN: cp %S/Inputs/prebuilt-module-cache/Lib.swiftinterface %t/include/Lib.swiftmodule/%target-swiftinterface-name
44

55
// Baseline check: if the prebuilt cache path does not exist, everything should
66
// still work.

test/ModuleInterface/ModuleCache/prebuilt-module-cache-unusable.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
// RUN: %empty-directory(%t/MCP)
33
// RUN: %empty-directory(%t/prebuilt-cache/Lib.swiftmodule)
44
// RUN: %empty-directory(%t/include/Lib.swiftmodule)
5-
// RUN: cp %S/Inputs/prebuilt-module-cache/Lib.swiftinterface %t/include/Lib.swiftmodule/%target-cpu.swiftinterface
5+
// RUN: cp %S/Inputs/prebuilt-module-cache/Lib.swiftinterface %t/include/Lib.swiftmodule/%target-swiftinterface-name
66

77
// Prebuild a module for the current target CPU, and put it in the prebuilt cache under some imaginary CPU.
8-
// RUN: sed -e 's/FromInterface/FromPrebuilt/g' %t/include/Lib.swiftmodule/%target-cpu.swiftinterface | %target-swift-frontend -parse-stdlib -module-cache-path %t/MCP -emit-module-path %t/prebuilt-cache/Lib.swiftmodule/leg128.swiftmodule - -module-name Lib
8+
// RUN: sed -e 's/FromInterface/FromPrebuilt/g' %t/include/Lib.swiftmodule/%target-swiftinterface-name | %target-swift-frontend -parse-stdlib -module-cache-path %t/MCP -emit-module-path %t/prebuilt-cache/Lib.swiftmodule/leg128.swiftmodule - -module-name Lib
99

1010
// Make sure that, if there's a module for a different architecture
1111
// present in the prebuilt cache, it's ignored and the module is

test/ModuleInterface/ModuleCache/prefer-local-module-to-sdk-framework.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
// RUN: echo 'public func showsUpInBothPlaces() {}' > %t/Lib.swift
66

77
// 1. Create a .swiftinterface file containing just one API, and put it inside a second build dir (without a .swiftmodule)
8-
// RUN: %target-swift-frontend -typecheck %t/Lib.swift -emit-module-interface-path %t/SecondBuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-cpu.swiftinterface -module-name Lib
8+
// RUN: %target-swift-frontend -typecheck %t/Lib.swift -emit-module-interface-path %t/SecondBuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-swiftinterface-name -module-name Lib
99

1010
// 2. Add a new API to the module, and compile just the serialized version in the build dir.
1111
// RUN: echo 'public func onlyInTheCompiledModule() {}' >> %t/Lib.swift
12-
// RUN: %target-swift-frontend -emit-module %t/Lib.swift -o %t/BuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-cpu.swiftmodule -emit-module-interface-path %t/BuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-cpu.swiftinterface -module-name Lib
12+
// RUN: %target-swift-frontend -emit-module %t/Lib.swift -o %t/BuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-swiftmodule-name -emit-module-interface-path %t/BuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-swiftinterface-name -module-name Lib
1313

1414
// 3. Make sure when we compile this test file, we can access both APIs since we'll
1515
// load the compiled .swiftmodule instead of the .swiftinterface in the SDK.
@@ -19,7 +19,7 @@
1919
// RUN: ls %t/ModuleCache | not grep 'swiftmodule'
2020

2121
// 5. This should also work if the swiftinterface isn't present in the first build dir.
22-
// RUN: rm %t/BuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-cpu.swiftinterface
22+
// RUN: rm %t/BuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-swiftinterface-name
2323
// RUN: %target-swift-frontend -typecheck %s -F %t/BuildDir -F %t/SecondBuildDir -module-cache-path %t/ModuleCache
2424

2525
// 6. Make sure we /still/ didn't compile any .swiftinterfaces into the module cache.

test/ModuleInterface/default-prebuilt-module-location.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// 3. Compile this into a module and put it into the default prebuilt cache
1111
// location relative to the fake resource dir. Also drop an interface into
1212
// the build dir.
13-
// RUN: %target-swift-frontend -emit-module %t/PrebuiltModule.swift -o %t/ResourceDir/%target-sdk-name/prebuilt-modules/PrebuiltModule.swiftmodule/%target-cpu.swiftmodule -module-name PrebuiltModule -parse-stdlib -emit-module-interface-path %t/PrebuiltModule.swiftmodule/%target-cpu.swiftinterface
13+
// RUN: %target-swift-frontend -emit-module %t/PrebuiltModule.swift -o %t/ResourceDir/%target-sdk-name/prebuilt-modules/PrebuiltModule.swiftmodule/%target-swiftmodule-name -module-name PrebuiltModule -parse-stdlib -emit-module-interface-path %t/PrebuiltModule.swiftmodule/%target-swiftinterface-name
1414

1515
// 4. Import this prebuilt module, but DON'T pass in -prebuilt-module-cache-path, it should use the implicit one.
1616
// RUN: %target-swift-frontend -typecheck -resource-dir %t/ResourceDir -I %t %s -parse-stdlib -module-cache-path %t/ModuleCache -sdk %t

test/ModuleInterface/swift_build_sdk_interfaces/check-only-mode.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// RUN: mkdir -p %t/sdk/usr/lib/swift/Normal.swiftmodule
33
// RUN: mkdir -p %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule
44

5-
// RUN: echo 'public func normal() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name Normal
5+
// RUN: echo 'public func normal() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name Normal
66
// RUN: echo 'public func flat() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Flat.swiftinterface -emit-module -o /dev/null -module-name Flat
7-
// RUN: echo 'public func fmwk() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name FMWK
7+
// RUN: echo 'public func fmwk() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name FMWK
88

99
// RUN: %swift_build_sdk_interfaces -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -v -o %t/prebuilt -check-only
1010
// RUN: ls %t/prebuilt | %FileCheck %s
@@ -18,7 +18,7 @@
1818
// Touch a file in the SDK (to make it look like it changed) and try again.
1919
// In -check-only mode, this should force a rebuild.
2020
// RUN: rm -rf %t/MCP
21-
// RUN: %{python} %S/../ModuleCache/Inputs/make-old.py %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-cpu.swiftinterface
21+
// RUN: %{python} %S/../ModuleCache/Inputs/make-old.py %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name
2222
// RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP -prebuilt-module-cache-path %t/prebuilt
2323
// RUN: not %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/Normal-*.swiftmodule
2424

test/ModuleInterface/swift_build_sdk_interfaces/compiler-uses-prebuilt.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// RUN: mkdir -p %t/sdk/usr/lib/swift/Normal.swiftmodule
33
// RUN: mkdir -p %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule
44

5-
// RUN: echo 'public func normal() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name Normal
5+
// RUN: echo 'public func normal() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name Normal
66
// RUN: echo 'public func flat() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Flat.swiftinterface -emit-module -o /dev/null -module-name Flat
7-
// RUN: echo 'public func fmwk() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name FMWK
7+
// RUN: echo 'public func fmwk() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name FMWK
88

99
// RUN: %swift_build_sdk_interfaces -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -v -o %t/prebuilt
1010
// RUN: ls %t/prebuilt | %FileCheck %s
@@ -19,7 +19,7 @@
1919
// This should still be able to use the prebuilt modules because they track
2020
// content hashes, not just size+mtime.
2121
// RUN: rm -rf %t/MCP
22-
// RUN: %{python} %S/../ModuleCache/Inputs/make-old.py %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-cpu.swiftinterface
22+
// RUN: %{python} %S/../ModuleCache/Inputs/make-old.py %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name
2323
// RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP -prebuilt-module-cache-path %t/prebuilt
2424
// RUN: ls %t/MCP/*.swiftmodule | %FileCheck -check-prefix CHECK-CACHE %s
2525
// RUN: %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/*.swiftmodule
@@ -31,7 +31,7 @@
3131
// Actually change a file in the SDK, to check that we're tracking dependencies
3232
// at all.
3333
// RUN: rm -rf %t/MCP
34-
// RUN: echo "public func another()" >> %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-cpu.swiftinterface
34+
// RUN: echo "public func another()" >> %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-swiftinterface-name
3535
// RUN: %target-typecheck-verify-swift -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -I %t/sdk/usr/lib/swift/ -module-cache-path %t/MCP -prebuilt-module-cache-path %t/prebuilt
3636
// RUN: ls %t/MCP/*.swiftmodule | %FileCheck -check-prefix CHECK-CACHE %s
3737
// RUN: not %{python} %S/../ModuleCache/Inputs/check-is-forwarding-module.py %t/MCP/Normal-*.swiftmodule

test/ModuleInterface/swift_build_sdk_interfaces/track-system-dependencies.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: cp -r %S/Inputs/system-dependencies-sdk %t/sdk
3-
// RUN: echo 'import Platform; public func usesCStruct(_: SomeCStruct?) {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Swifty.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name Swifty -sdk %t/sdk
3+
// RUN: echo 'import Platform; public func usesCStruct(_: SomeCStruct?) {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Swifty.swiftmodule/%target-swiftinterface-name -emit-module -o /dev/null -module-name Swifty -sdk %t/sdk
44

55
// RUN: %swift_build_sdk_interfaces -sdk %t/sdk -v -o %t/prebuilt
66
// RUN: ls %t/prebuilt | %FileCheck %s

test/Serialization/load-target-fallback.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55

66
// RUN: mkdir %t/TargetLibrary.swiftmodule
77
// RUN: %target-swift-frontend -emit-module -o %t/TargetLibrary.swiftmodule/%module-target-triple.swiftmodule %S/Inputs/def_func.swift -module-name TargetLibrary
8-
// RUN: touch %t/TargetLibrary.swiftmodule/%target-cpu.swiftmodule
8+
// RUN: touch %t/TargetLibrary.swiftmodule/%target-swiftmodule-name
99

1010
import TargetLibrary
1111

1212
// RUN: mkdir %t/ArchLibrary.swiftmodule
13-
// RUN: %target-swift-frontend -emit-module -o %t/ArchLibrary.swiftmodule/%target-cpu.swiftmodule %S/Inputs/def_func.swift -module-name ArchLibrary
13+
// RUN: %target-swift-frontend -emit-module -o %t/ArchLibrary.swiftmodule/%target-swiftmodule-name %S/Inputs/def_func.swift -module-name ArchLibrary
1414

1515
import ArchLibrary
1616

1717
// RUN: mkdir -p %t/TargetModule.framework/Modules/TargetModule.swiftmodule
1818
// RUN: %target-swift-frontend -emit-module -o %t/TargetModule.framework/Modules/TargetModule.swiftmodule/%module-target-triple.swiftmodule %S/Inputs/def_func.swift -module-name TargetModule
19-
// RUN: touch %t/TargetModule.framework/Modules/TargetModule.swiftmodule/%target-cpu.swiftmodule
19+
// RUN: touch %t/TargetModule.framework/Modules/TargetModule.swiftmodule/%target-swiftmodule-name
2020

2121
import TargetModule
2222

2323
// RUN: mkdir -p %t/ArchModule.framework/Modules/ArchModule.swiftmodule
24-
// RUN: %target-swift-frontend -emit-module -o %t/ArchModule.framework/Modules/ArchModule.swiftmodule/%target-cpu.swiftmodule %S/Inputs/def_func.swift -module-name ArchModule
24+
// RUN: %target-swift-frontend -emit-module -o %t/ArchModule.framework/Modules/ArchModule.swiftmodule/%target-swiftmodule-name %S/Inputs/def_func.swift -module-name ArchModule
2525

2626
import ArchModule
2727

test/lit.cfg

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,11 @@ if run_vers.endswith('-simulator'):
311311
else:
312312
run_environment=''
313313

314+
target_arch = run_cpu
315+
if run_os == 'openbsd' and run_cpu == 'amd64':
316+
target_arch = run_cpu
317+
run_cpu = 'x86_64'
318+
314319
run_ptrsize = '64' if ('64' in run_cpu or run_cpu == "s390x") else '32'
315320
run_ptrauth = 'ptrauth' if run_cpu == 'arm64e' else 'noptrauth'
316321
run_endian = 'little' if run_cpu != 's390x' else 'big'
@@ -1625,7 +1630,7 @@ if swift_execution_tests_extra_flags:
16251630

16261631
platform_module_dir = make_path(test_resource_dir, config.target_sdk_name)
16271632
if run_vendor != 'apple':
1628-
platform_module_dir = make_path(platform_module_dir, run_cpu)
1633+
platform_module_dir = make_path(platform_module_dir, target_arch)
16291634

16301635
platform_dylib_dir = platform_module_dir
16311636
if run_os == 'maccatalyst' and config.darwin_maccatalyst_build_flavor == "ios-like":
@@ -1873,6 +1878,7 @@ config.substitutions.append(('%xcode-extra-frameworks-dir', extra_frameworks_dir
18731878
config.substitutions.append(('%target-swiftmodule-name', target_specific_module_triple + '.swiftmodule'))
18741879
config.substitutions.append(('%target-swiftdoc-name', target_specific_module_triple + '.swiftdoc'))
18751880
config.substitutions.append(('%target-swiftsourceinfo-name', target_specific_module_triple + '.swiftsourceinfo'))
1881+
config.substitutions.append(('%target-swiftinterface-name', target_specific_module_triple + '.swiftinterface'))
18761882

18771883
config.substitutions.append(('%target-object-format', config.target_object_format))
18781884
config.substitutions.append(('%{target-shared-library-prefix}', config.target_shared_library_prefix))

0 commit comments

Comments
 (0)