Skip to content

Commit

Permalink
SR-7309: Add tests for -static-executable on Linux
Browse files Browse the repository at this point in the history
- Add extra tests using Dispatch and Foundation with -static-executable.
  • Loading branch information
spevans committed Oct 13, 2020
1 parent 3ceb61d commit 5a80060
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 0 deletions.
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

0 comments on commit 5a80060

Please sign in to comment.