diff --git a/README.md b/README.md index 0ad6131..bd821f8 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/test-static-executable/dispatch-static-executable.swift b/test-static-executable/dispatch-static-executable.swift new file mode 100644 index 0000000..8eb485c --- /dev/null +++ b/test-static-executable/dispatch-static-executable.swift @@ -0,0 +1,6 @@ +import Dispatch + +let queue = DispatchQueue(label: "queuename", attributes: .concurrent) +queue.sync { + print("Dispatch") +} diff --git a/test-static-executable/dispatch-static-executable.test b/test-static-executable/dispatch-static-executable.test new file mode 100644 index 0000000..910eece --- /dev/null +++ b/test-static-executable/dispatch-static-executable.test @@ -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 + diff --git a/test-static-executable/foundation-static-executable.swift b/test-static-executable/foundation-static-executable.swift new file mode 100644 index 0000000..7c0a42e --- /dev/null +++ b/test-static-executable/foundation-static-executable.swift @@ -0,0 +1,3 @@ +import Foundation + +print(URL(string: "http://apple.com")!.absoluteString) diff --git a/test-static-executable/foundation-static-executable.test b/test-static-executable/foundation-static-executable.test new file mode 100644 index 0000000..59e9eea --- /dev/null +++ b/test-static-executable/foundation-static-executable.test @@ -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 diff --git a/test-static-executable/static-executable.swift b/test-static-executable/static-executable.swift new file mode 100644 index 0000000..01d9c80 --- /dev/null +++ b/test-static-executable/static-executable.swift @@ -0,0 +1 @@ +print("OK") diff --git a/test-static-executable/static-executable.test b/test-static-executable/static-executable.test new file mode 100644 index 0000000..b2d5dfe --- /dev/null +++ b/test-static-executable/static-executable.test @@ -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