Skip to content

Commit bc6ce67

Browse files
Add integration tests for static-linking of Foundation (#87)
Implementation: swiftlang/swift-corelibs-foundation#2996 and swiftlang/swift#35936
1 parent 7d6bf13 commit bc6ce67

4 files changed

+38
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
REQUIRES: platform=Linux
2+
RUN: rm -rf %t
3+
RUN: mkdir -p %t
4+
RUN: %{swiftc} -static-stdlib %S/test-foundation-networking.swift -o %t/test-foundation-networking
5+
RUN: %t/test-foundation-networking | %{FileCheck} %s
6+
RUN: ldd %t/test-foundation-networking | %{FileCheck} --check-prefix LDD %s
7+
8+
CHECK: http://example.com
9+
LDD-NOT: libFoundation.so
10+
LDD-NOT: libFoundationNetworking.so
11+
LDD-NOT: libCoreFoundation.so

test-foundation-package/test-foundation-networking.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,8 @@ import FoundationNetworking
44
let url = URL(string: "http://example.com")!
55
let urlRequest = URLRequest(url: url)
66
print(urlRequest)
7+
8+
let urlSession = URLSession.shared
9+
let task = urlSession.dataTask(with: urlRequest)
10+
print(task.state)
11+
task.cancel()
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
REQUIRES: platform=Linux
2+
RUN: rm -rf %t
3+
RUN: mkdir -p %t
4+
RUN: %{swiftc} -static-stdlib %S/main.swift -o %t/main
5+
RUN: %t/main | %{FileCheck} %s
6+
RUN: ldd %t/main | %{FileCheck} --check-prefix LDD %s
7+
8+
CHECK: Printing URL
9+
CHECK-NEXT: /tmp
10+
CHECK-NEXT: Done printing URL
11+
LDD-NOT: libFoundation.so
12+
LDD-NOT: libCoreFoundation.so
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
REQUIRES: platform=Linux
2+
RUN: rm -rf %t
3+
RUN: mkdir -p %t
4+
RUN: %{swiftc} -static-stdlib %S/test-foundation-xml.swift -o %t/test-foundation-xml
5+
RUN: %t/test-foundation-xml | %{FileCheck} %s
6+
RUN: ldd %t/test-foundation-xml | %{FileCheck} --check-prefix LDD %s
7+
CHECK: NSXMLDocument
8+
LDD-NOT: libFoundation.so
9+
LDD-NOT: libFoundationXML.so
10+
LDD-NOT: libCoreFoundation.so

0 commit comments

Comments
 (0)