add DNS test for socket

This commit is contained in:
Lyon 2023-07-21 16:55:07 +08:00
parent 82f0f3dc42
commit 3a39ff5944
3 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,12 @@
import socket
# 创建一个 socket 对象
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# 使用域名和端口来进行连接
s.connect(("dns.google", 53))
# 关闭连接
s.close()
print("PASS")

View File

@ -291,7 +291,8 @@ TEST(socket, json_issue) {
}
#endif
TEST_RUN_SINGLE_FILE(socket, socket_GET, "test/python/socket/socket_GET.py")
TEST_RUN_SINGLE_FILE_PASS(socket, socket_GET, "test/python/socket/socket_GET.py")
TEST_RUN_SINGLE_FILE_PASS(socket, socket_DNS, "test/python/socket/socket_DNS.py")
#endif

View File

@ -0,0 +1,12 @@
import socket
# 创建一个 socket 对象
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# 使用域名和端口来进行连接
s.connect(("dns.google", 53))
# 关闭连接
s.close()
print("PASS")