Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration tests for static-linking of Foundation #87

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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)
Comment on lines +8 to +10
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines are added to guarantee that CF and curl symbols are in use.

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