Skip to content

Commit 2a8e4b2

Browse files
committed
Add IRGen test for Explicit Module Build with a framework dependency.
Ensures auto-linking commands are issued for the framework import module.
1 parent cf773c3 commit 2a8e4b2

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: mkdir -p %t/clang-module-cache
3+
// RUN: mkdir -p %t/inputs
4+
// RUN: echo "/// Some cool comments" > %t/foo.swift
5+
// RUN: echo "public func foo() {}" >> %t/foo.swift
6+
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/inputs/Foo.swiftmodule -emit-module-doc-path %t/inputs/Foo.swiftdoc -emit-module-source-info -emit-module-source-info-path %t/inputs/Foo.swiftsourceinfo -module-cache-path %t.module-cache %t/foo.swift -module-name Foo
7+
8+
// RUN: echo "[{" > %/t/inputs/map.json
9+
// RUN: echo "\"moduleName\": \"Foo\"," >> %/t/inputs/map.json
10+
// RUN: echo "\"modulePath\": \"%/t/inputs/Foo.swiftmodule\"," >> %/t/inputs/map.json
11+
// RUN: echo "\"docPath\": \"%/t/inputs/Foo.swiftdoc\"," >> %/t/inputs/map.json
12+
// RUN: echo "\"sourceInfoPath\": \"%/t/inputs/Foo.swiftsourceinfo\"," >> %/t/inputs/map.json
13+
// RUN: echo "\"isFramework\": true" >> %/t/inputs/map.json
14+
// RUN: echo "}," >> %/t/inputs/map.json
15+
// RUN: echo "{" >> %/t/inputs/map.json
16+
// RUN: echo "\"moduleName\": \"Swift\"," >> %/t/inputs/map.json
17+
// RUN: echo "\"modulePath\": \"%/stdlib_module\"," >> %/t/inputs/map.json
18+
// RUN: echo "\"isFramework\": false" >> %/t/inputs/map.json
19+
// RUN: echo "}," >> %/t/inputs/map.json
20+
// RUN: echo "{" >> %/t/inputs/map.json
21+
// RUN: echo "\"moduleName\": \"SwiftOnoneSupport\"," >> %/t/inputs/map.json
22+
// RUN: echo "\"modulePath\": \"%/ononesupport_module\"," >> %/t/inputs/map.json
23+
// RUN: echo "\"isFramework\": false" >> %/t/inputs/map.json
24+
// RUN: echo "}]" >> %/t/inputs/map.json
25+
26+
// RUN: %target-swift-frontend -emit-object -emit-module -disable-implicit-swift-modules -explicit-swift-module-map-file %t/inputs/map.json -o %t/explicit-framework-irgen.o %s
27+
import Foo
28+
29+
// This test is to verify autolinking behavior so it is macOS-specific.
30+
// REQUIRES OS=macosx
31+
32+
// RUN: otool -l %t/explicit-framework-irgen.o | %FileCheck %s
33+
// CHECK: cmd LC_LINKER_OPTION
34+
// CHECK-NEXT: cmdsize 32
35+
// CHECK-NEXT: count 2
36+
// CHECK-NEXT: string #1 -framework
37+
// CHECK-NEXT: string #2 Foo

0 commit comments

Comments
 (0)