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

SR-7309: Add tests for -static-executable on Linux #74

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Here is a partial list of tests in the repository:
| test-import-glibc | Compile a source file importing and using Glibc |
| test-multi-compile | Compile multiple source files into an executable |
| test-multi-compile-glibc | Compile multiple source files importing Glibc into an executable |
| test-static-executable | Test -static-executable on Linux with Dispatch and Foundation |
| test-static-lib | Compile multiple source files into a static library |
| test-xctest-package | Build a package that imports XCTest |

6 changes: 6 additions & 0 deletions test-static-executable/dispatch-static-executable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Dispatch

let queue = DispatchQueue(label: "queuename", attributes: .concurrent)
queue.sync {
print("Dispatch")
}
9 changes: 9 additions & 0 deletions test-static-executable/dispatch-static-executable.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
REQUIRES: platform=Linux
RUN: rm -rf %t
RUN: mkdir -p %t
RUN: %{swiftc} -static-executable -o %t/dispatch_test %S/dispatch-static-executable.swift
RUN: %t/dispatch_test | %{FileCheck} %s
RUN: %{readelf} -program-headers %t/dispatch_test | %{FileCheck} %s --check-prefix=ELF
CHECK: Dispatch
ELF-NOT: INTERP

3 changes: 3 additions & 0 deletions test-static-executable/foundation-static-executable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Foundation

print(URL(string: "http://apple.com")!.absoluteString)
8 changes: 8 additions & 0 deletions test-static-executable/foundation-static-executable.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
REQUIRES: platform=Linux
RUN: rm -rf %t
RUN: mkdir -p %t
RUN: %{swiftc} -static-executable -o %t/foundation-static_executable %S/foundation-static-executable.swift
RUN: %t/foundation-static_executable | %{FileCheck} %s
RUN: %{readelf} -program-headers %t/foundation-static_executable | %{FileCheck} %s --check-prefix=ELF
CHECK: http://apple.com
ELF-NOT: INTERP
1 change: 1 addition & 0 deletions test-static-executable/static-executable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("OK")
8 changes: 8 additions & 0 deletions test-static-executable/static-executable.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
REQUIRES: platform=Linux
RUN: rm -rf %t
RUN: mkdir -p %t
RUN: %{swiftc} -static-executable -o %t/static_executable %S/static-executable.swift
RUN: %t/static_executable | %{FileCheck} %s
RUN: %{readelf} -program-headers %t/static_executable | %{FileCheck} %s --check-prefix=ELF
CHECK: OK
ELF-NOT: INTERP