Skip to content

Commit

Permalink
Add integration tests for static-linking of Foundation (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
kateinoigakukun committed Oct 2, 2023
1 parent 7d6bf13 commit bc6ce67
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
REQUIRES: platform=Linux
RUN: rm -rf %t
RUN: mkdir -p %t
RUN: %{swiftc} -static-stdlib %S/test-foundation-networking.swift -o %t/test-foundation-networking
RUN: %t/test-foundation-networking | %{FileCheck} %s
RUN: ldd %t/test-foundation-networking | %{FileCheck} --check-prefix LDD %s

CHECK: http://example.com
LDD-NOT: libFoundation.so
LDD-NOT: libFoundationNetworking.so
LDD-NOT: libCoreFoundation.so
5 changes: 5 additions & 0 deletions test-foundation-package/test-foundation-networking.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ import FoundationNetworking
let url = URL(string: "http://example.com")!
let urlRequest = URLRequest(url: url)
print(urlRequest)

let urlSession = URLSession.shared
let task = urlSession.dataTask(with: urlRequest)
print(task.state)
task.cancel()
12 changes: 12 additions & 0 deletions test-foundation-package/test-foundation-static-stdlib.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
REQUIRES: platform=Linux
RUN: rm -rf %t
RUN: mkdir -p %t
RUN: %{swiftc} -static-stdlib %S/main.swift -o %t/main
RUN: %t/main | %{FileCheck} %s
RUN: ldd %t/main | %{FileCheck} --check-prefix LDD %s

CHECK: Printing URL
CHECK-NEXT: /tmp
CHECK-NEXT: Done printing URL
LDD-NOT: libFoundation.so
LDD-NOT: libCoreFoundation.so
10 changes: 10 additions & 0 deletions test-foundation-package/test-foundation-xml-static-stdlib.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
REQUIRES: platform=Linux
RUN: rm -rf %t
RUN: mkdir -p %t
RUN: %{swiftc} -static-stdlib %S/test-foundation-xml.swift -o %t/test-foundation-xml
RUN: %t/test-foundation-xml | %{FileCheck} %s
RUN: ldd %t/test-foundation-xml | %{FileCheck} --check-prefix LDD %s
CHECK: NSXMLDocument
LDD-NOT: libFoundation.so
LDD-NOT: libFoundationXML.so
LDD-NOT: libCoreFoundation.so

0 comments on commit bc6ce67

Please sign in to comment.