Skip to content

Commit eafb405

Browse files
authored
Merge pull request #76240 from tshortli/maccatalyst-tests
Tests: Adjust several macCatalyst tests
2 parents 2b817f3 + 0ea7ee8 commit eafb405

6 files changed

+49
-19
lines changed

test/ClangImporter/availability_maccatalyst.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -target x86_64-apple-ios13.1-macabi -typecheck -verify -I %S/Inputs/custom-modules %s
1+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -target %target-cpu-apple-ios13.1-macabi -typecheck -verify -I %S/Inputs/custom-modules %s
22

33
// REQUIRES: maccatalyst_support
44

test/ClangImporter/availability_maccatalyst_app_extension.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -target x86_64-apple-ios13.1-macabi -application-extension -typecheck -verify -I %S/Inputs/custom-modules %s
1+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -target %target-cpu-apple-ios13.1-macabi -application-extension -typecheck -verify -I %S/Inputs/custom-modules %s
22

33
// REQUIRES: maccatalyst_support
44

test/Interpreter/availability_maccatalyst_zippered.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22
// RUN: %empty-directory(%t/macos_module)
33
// RUN: %empty-directory(%t/maccatalyst_module)
44

5-
// REQUIRES: rdar73984718
65

76
// Build a zippered library
87

98
// Emit a zippered library and a module for use from macOSProcesses
10-
// RUN: %target-build-swift %S/Inputs/availability_zippered.swift -target x86_64-apple-macosx10.15 -target-variant x86_64-apple-ios13.1-macabi -emit-library -emit-module -emit-module-path %t/macos_module/ -o %t/libavailability_zippered.dylib
9+
// RUN: %target-build-swift-dylib(%t/%target-library-name(availability_zippered)) %S/Inputs/availability_zippered.swift -target %target-cpu-apple-macosx10.15 -target-variant %target-cpu-apple-ios13.1-macabi -emit-module -emit-module-path %t/macos_module/
10+
// RUN: %target-codesign %t/%target-library-name(availability_zippered)
1111

1212
// Emit just an macCatalyst module for use from an macCatalyst process
13-
// RUN: %target-build-swift %S/Inputs/availability_zippered.swift -target x86_64-apple-ios13.1-macabi -emit-module -emit-module-path %t/maccatalyst_module/
13+
// RUN: %target-build-swift %S/Inputs/availability_zippered.swift -target %target-cpu-apple-ios13.1-macabi -emit-module -emit-module-path %t/maccatalyst_module/
1414

1515
// Build a macOS executable that calls into the library
16-
// RUN: %target-build-swift -emit-executable -target x86_64-apple-macosx10.15 %s -lavailability_zippered -I %t/macos_module -L %t -o %t/a-macos.out
16+
// RUN: %target-build-swift -emit-executable -target %target-cpu-apple-macosx10.15 %s -lavailability_zippered -I %t/macos_module -L %t -o %t/a-macos.out
1717
// RUN: %target-codesign %t/a-macos.out
1818

1919
// Built an macCatalyst executable that calls into the library.
20-
// RUN: %target-build-swift -target x86_64-apple-ios13.1-macabi %s -lavailability_zippered -I %t/maccatalyst_module -L %t -o %t/a-maccatalyst.out
20+
// RUN: %target-build-swift -target %target-cpu-apple-ios13.1-macabi %s -lavailability_zippered -I %t/maccatalyst_module -L %t -o %t/a-maccatalyst.out
2121
// RUN: %target-codesign %t/a-maccatalyst.out
2222

23-
// RUN: %target-run %t/a-macos.out
24-
// RUN: %target-run %t/a-maccatalyst.out
23+
// RUN: %target-run %t/a-macos.out %t/%target-library-name(availability_zippered)
24+
// RUN: %target-run %t/a-maccatalyst.out %t/%target-library-name(availability_zippered)
2525

2626
// REQUIRES: executable_test
2727
// REQUIRES: maccatalyst_support

test/Misc/maccatalyst_load_commands.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// REQUIRES: OS=maccatalyst || OS=macosx
22
// REQUIRES: maccatalyst_support
3+
// REQUIRES: CPU=x86_64
34

45

56
// Zippered libraries
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Like default-prebuilt-module-location.swift, but for macCatalyst specifically.
2+
3+
// REQUIRES: OS=macosx
4+
5+
// 1. Create folders for a) our Swift module, b) the module cache, and c) a
6+
// fake resource dir with a default prebuilt module cache inside.
7+
// RUN: %empty-directory(%t/PrebuiltModule.swiftmodule)
8+
// RUN: %empty-directory(%t/ModuleCache)
9+
// RUN: %empty-directory(%t/ResourceDir/macosx/prebuilt-modules/PrebuiltModule.swiftmodule)
10+
11+
// 2. Define some public API
12+
// RUN: echo 'public struct InPrebuiltModule {}' > %t/PrebuiltModule.swift
13+
14+
// 3. Compile this into a module and put it into the default prebuilt cache
15+
// location relative to the fake resource dir. Also drop an interface into
16+
// the build dir.
17+
// RUN: %target-swift-frontend -target %target-cpu-apple-ios13.1-macabi -emit-module %t/PrebuiltModule.swift -o %t/ResourceDir/macosx/prebuilt-modules/PrebuiltModule.swiftmodule/%target-cpu.swiftmodule -module-name PrebuiltModule -parse-stdlib -emit-module-interface-path %t/PrebuiltModule.swiftmodule/%target-cpu.swiftinterface
18+
19+
// 4. Import this prebuilt module, but DON'T pass in -prebuilt-module-cache-path, it should use the implicit one.
20+
// RUN: %target-swift-frontend -target %target-cpu-apple-ios13.1-macabi -typecheck -resource-dir %t/ResourceDir -I %t %s -parse-stdlib -module-cache-path %t/ModuleCache -sdk %t
21+
22+
// 5. Make sure we installed a forwarding module in the module cache.
23+
// RUN: %{python} %S/ModuleCache/Inputs/check-is-forwarding-module.py %t/ModuleCache/PrebuiltModule-*.swiftmodule
24+
25+
import PrebuiltModule
26+
27+
func x<T>(_ x: T) {}
28+
29+
x(InPrebuiltModule.self)

test/Serialization/runtime-import-from-sdk-maccatalyst.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,36 +77,36 @@ Swift.success()
7777
// over sdk/iOSSupport. (default resource dir + bad-bad-sdk)
7878
//
7979
// RUN: %empty-directory(%t.mcp)
80-
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/bad-bad-sdk) -target x86_64-apple-ios13.1-macabi -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=RESDIR-MACCATALYST
80+
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/bad-bad-sdk) -target %target-cpu-apple-ios13.1-macabi -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=RESDIR-MACCATALYST
8181
// RESDIR-MACCATALYST: success
8282

8383
// IOSSUP: If resource-dir has no standard library but sdk/iOSSupport does, it
8484
// will be preferred over sdk. (empty-resdir + good-bad-sdk)
8585
//
8686
// RUN: %empty-directory(%t.mcp)
87-
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/good-bad-sdk) -target x86_64-apple-ios13.1-macabi -resource-dir %t/empty-resdir/usr/lib/swift -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=IOSSUP-MACCATALYST
87+
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/good-bad-sdk) -target %target-cpu-apple-ios13.1-macabi -resource-dir %t/empty-resdir/usr/lib/swift -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=IOSSUP-MACCATALYST
8888
// IOSSUP-MACCATALYST: success
8989

9090
// IOSBAD: Confirms that we don't use sdk/iOSSupport on non-macCatalyst, even if
9191
// present. (empty-resdir + bad-good-sdk)
9292
//
9393
// RUN: %empty-directory(%t.mcp)
94-
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/bad-good-sdk) -target x86_64-apple-ios13.1-macabi -resource-dir %t/empty-resdir/usr/lib/swift -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=IOSBAD-MACCATALYST
94+
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/bad-good-sdk) -target %target-cpu-apple-ios13.1-macabi -resource-dir %t/empty-resdir/usr/lib/swift -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=IOSBAD-MACCATALYST
9595
// IOSBAD-MACCATALYST: failure
9696

9797
// SDKTOP: If resource-dir and sdk/iOSSupport don't have standard libraries but
9898
// sdk does, it will be used as a last resort. (empty-resdir + empty-good-sdk)
9999
//
100100
// RUN: %empty-directory(%t.mcp)
101-
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/empty-good-sdk) -target x86_64-apple-ios13.1-macabi -resource-dir %t/empty-resdir/usr/lib/swift -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=SDKTOP-MACCATALYST
101+
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/empty-good-sdk) -target %target-cpu-apple-ios13.1-macabi -resource-dir %t/empty-resdir/usr/lib/swift -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=SDKTOP-MACCATALYST
102102
// SDKTOP-MACCATALYST: success
103103

104104
// NILLIB: If no standard libraries are available, stdlib loading fails.
105105
// (empty-resdir + empty-empty-sdk) This one has a different error message from
106106
// the others because there are no failure-failure-failure triples to find.
107107
//
108108
// RUN: %empty-directory(%t.mcp)
109-
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/empty-empty-sdk) -target x86_64-apple-ios13.1-macabi -resource-dir %t/empty-resdir/usr/lib/swift -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=NILLIB-MACCATALYST
109+
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/empty-empty-sdk) -target %target-cpu-apple-ios13.1-macabi -resource-dir %t/empty-resdir/usr/lib/swift -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=NILLIB-MACCATALYST
110110
// NILLIB-MACCATALYST: unable to load standard library
111111

112112

@@ -121,34 +121,34 @@ Swift.success()
121121
// over sdk/iOSSupport. (default resource dir + bad-bad-sdk)
122122
//
123123
// RUN: %empty-directory(%t.mcp)
124-
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/bad-bad-sdk) -target x86_64-apple-macosx10.15 -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=RESDIR-MACOSX
124+
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/bad-bad-sdk) -target %target-cpu-apple-macosx10.15 -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=RESDIR-MACOSX
125125
// RESDIR-MACOSX: {{success|module 'Swift' was created for incompatible target}}
126126

127127
// IOSSUP: If resource-dir has no standard library but sdk/iOSSupport does, it
128128
// will be preferred over sdk. (empty-resdir + good-bad-sdk)
129129
//
130130
// RUN: %empty-directory(%t.mcp)
131-
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/good-bad-sdk) -target x86_64-apple-macosx10.15 -resource-dir %t/empty-resdir/usr/lib/swift -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=IOSSUP-MACOSX
131+
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/good-bad-sdk) -target %target-cpu-apple-macosx10.15 -resource-dir %t/empty-resdir/usr/lib/swift -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=IOSSUP-MACOSX
132132
// IOSSUP-MACOSX: failure
133133

134134
// IOSBAD: Confirms that we don't use sdk/iOSSupport on non-macCatalyst, even if
135135
// present. (empty-resdir + bad-good-sdk)
136136
//
137137
// RUN: %empty-directory(%t.mcp)
138-
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/bad-good-sdk) -target x86_64-apple-macosx10.15 -resource-dir %t/empty-resdir/usr/lib/swift -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=IOSBAD-MACOSX
138+
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/bad-good-sdk) -target %target-cpu-apple-macosx10.15 -resource-dir %t/empty-resdir/usr/lib/swift -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=IOSBAD-MACOSX
139139
// IOSBAD-MACOSX: {{success|module 'Swift' was created for incompatible target}}
140140

141141
// SDKTOP: If resource-dir and sdk/iOSSupport don't have standard libraries but
142142
// sdk does, it will be used as a last resort. (empty-resdir + empty-good-sdk)
143143
//
144144
// RUN: %empty-directory(%t.mcp)
145-
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/empty-good-sdk) -target x86_64-apple-macosx10.15 -resource-dir %t/empty-resdir/usr/lib/swift -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=SDKTOP-MACOSX
145+
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/empty-good-sdk) -target %target-cpu-apple-macosx10.15 -resource-dir %t/empty-resdir/usr/lib/swift -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=SDKTOP-MACOSX
146146
// SDKTOP-MACOSX: {{success|module 'Swift' was created for incompatible target}}
147147

148148
// NILLIB: If no standard libraries are available, stdlib loading fails.
149149
// (empty-resdir + empty-empty-sdk) This one has a different error message from
150150
// the others because there are no failure-failure-failure triples to find.
151151
//
152152
// RUN: %empty-directory(%t.mcp)
153-
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/empty-empty-sdk) -target x86_64-apple-macosx10.15 -resource-dir %t/empty-resdir/usr/lib/swift -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=NILLIB-MACOSX
153+
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/empty-empty-sdk) -target %target-cpu-apple-macosx10.15 -resource-dir %t/empty-resdir/usr/lib/swift -module-cache-path %t.mcp -typecheck %s 2>&1 | %FileCheck %s --check-prefix=NILLIB-MACOSX
154154
// NILLIB-MACOSX: unable to load standard library

0 commit comments

Comments
 (0)