diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f6400158ef4..2aef56b833d 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -480,6 +480,9 @@ jobs:
test/rs/bin/* \
test/go/bin/*
+ - name: Create tmp domain socket folder
+ run: mkdir /tmp/v0.16
+
- name: Run cross test
env:
THRIFT_CROSSTEST_CONCURRENCY: 4
diff --git a/LANGUAGES.md b/LANGUAGES.md
index 2f1f4f1784f..f2ef878dacf 100644
--- a/LANGUAGES.md
+++ b/LANGUAGES.md
@@ -344,8 +344,8 @@ Thrift's core protocol is TBinary, supported by all languages except for JavaScr
0.12.0 |
| |
5.7 |
- |
- | | | | | |
+ |
+ | | | | | |
| | | |
| | | |
| | | | |
diff --git a/lib/swift/Sources/LinuxHelper.swift b/lib/swift/Sources/LinuxHelper.swift
index 83603f87996..7ab0b3e7964 100644
--- a/lib/swift/Sources/LinuxHelper.swift
+++ b/lib/swift/Sources/LinuxHelper.swift
@@ -27,7 +27,7 @@ import CoreFoundation
extension UInt {
public static func &(lhs: UInt, rhs: Int) -> UInt {
- let cast = unsafeBitCast(rhs, to: UInt.self)
+ let cast = UInt(bitPattern: rhs)
return lhs & cast
}
}
diff --git a/lib/swift/Sources/TSocketServer.swift b/lib/swift/Sources/TSocketServer.swift
index 6cd9adfe41c..27b4b5521f1 100644
--- a/lib/swift/Sources/TSocketServer.swift
+++ b/lib/swift/Sources/TSocketServer.swift
@@ -102,6 +102,49 @@ open class TSocketServer Int32 {
+ let socketAddressCasted = withUnsafePointer(to: &socketAddress) {
+ $0.withMemoryRebound(to: sockaddr.self, capacity: 1) {
+ return $0
+ }
+ }
+ return Sys.connect(fd, socketAddressCasted, socklen_t(MemoryLayout.size(ofValue: socketAddress)))
+ }
+ public func bind() -> Int32 {
+ let socketAddressCasted = withUnsafePointer(to: &socketAddress) {
+ $0.withMemoryRebound(to: sockaddr.self, capacity: 1) {
+ return $0
+ }
+ }
+ return Sys.bind(fd, socketAddressCasted, socklen_t(MemoryLayout.size(ofValue: socketAddress)))
+ }
+}
diff --git a/test/swift/CrossTests/Sources/TestClient/main.swift b/test/swift/CrossTests/Sources/TestClient/main.swift
index 6817981266c..d6274086942 100644
--- a/test/swift/CrossTests/Sources/TestClient/main.swift
+++ b/test/swift/CrossTests/Sources/TestClient/main.swift
@@ -40,7 +40,12 @@ class TestClient {
}
static func getTransport(parameters: TestClientParameters) throws -> TTransport {
- let socketTransport = try TSocketTransport(hostname: parameters.host!, port: parameters.port!)
+ let socketTransport: TTransport = try { () throws -> TTransport in
+ if let domainSocket = parameters.domainSocket {
+ return try TSocketTransport(path: domainSocket)
+ }
+ return try TSocketTransport(hostname: parameters.host!, port: parameters.port!)
+ }()
if parameters.transport == .framed {
return TFramedTransport(transport: socketTransport)
}
diff --git a/test/swift/CrossTests/Sources/TestServer/main.swift b/test/swift/CrossTests/Sources/TestServer/main.swift
index 15564d3e6ff..433bde7021e 100644
--- a/test/swift/CrossTests/Sources/TestServer/main.swift
+++ b/test/swift/CrossTests/Sources/TestServer/main.swift
@@ -34,19 +34,31 @@ class TestServer {
let processor = ThriftTestProcessor(service: service)
- switch (parameters.proto, parameters.transport) {
- case (.binary, .buffered):
+ switch (parameters.proto, parameters.transport, parameters.domainSocket) {
+ case (.binary, .buffered, .none):
let proto = TBinaryProtocol.self
server = try TSocketServer(port: parameters.port!, inProtocol: proto, outProtocol: proto, processor: processor)
- case (.binary, .framed):
+ case (.binary, .framed, .none):
let proto = TBinaryProtocol.self
server = try TFramedSocketServer(port: parameters.port!, inProtocol: proto, outProtocol: proto, processor: processor)
- case (.compact, .buffered):
+ case (.compact, .buffered, .none):
let proto = TCompactProtocol.self
server = try TSocketServer(port: parameters.port!, inProtocol: proto, outProtocol: proto, processor: processor)
- case (.compact, .framed):
+ case (.compact, .framed, .none):
let proto = TCompactProtocol.self
server = try TFramedSocketServer(port: parameters.port!, inProtocol: proto, outProtocol: proto, processor: processor)
+ case (.binary, .buffered, .some(let domainSocket)):
+ let proto = TBinaryProtocol.self
+ server = try TSocketServer(path: domainSocket, inProtocol: proto, outProtocol: proto, processor: processor)
+ case (.binary, .framed, .some(let domainSocket)):
+ let proto = TBinaryProtocol.self
+ server = try TFramedSocketServer(path: domainSocket, inProtocol: proto, outProtocol: proto, processor: processor)
+ case (.compact, .buffered, .some(let domainSocket)):
+ let proto = TCompactProtocol.self
+ server = try TSocketServer(path: domainSocket, inProtocol: proto, outProtocol: proto, processor: processor)
+ case (.compact, .framed, .some(let domainSocket)):
+ let proto = TCompactProtocol.self
+ server = try TFramedSocketServer(path: domainSocket, inProtocol: proto, outProtocol: proto, processor: processor)
default:
throw ParserError.unsupportedOption
}
diff --git a/test/tests.json b/test/tests.json
index 7eb9f65b9dd..d4e93fe2aa9 100644
--- a/test/tests.json
+++ b/test/tests.json
@@ -765,14 +765,14 @@
"workdir": "swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug",
"protocols": ["binary", "compact"],
"transports": ["buffered", "framed"],
- "sockets": ["ip"]
+ "sockets": ["ip", "domain"]
},
"client": {
"command": ["TestClient"],
"workdir": "swift/CrossTests/.build/x86_64-unknown-linux-gnu/debug",
"protocols": ["binary", "compact"],
"transports": ["buffered", "framed"],
- "sockets": ["ip"]
+ "sockets": ["ip", "domain"]
}
}
]