aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/py/libvfio_user.py7
-rw-r--r--test/py/test_negotiate.py17
2 files changed, 19 insertions, 5 deletions
diff --git a/test/py/libvfio_user.py b/test/py/libvfio_user.py
index b1ebd4b..bdb812a 100644
--- a/test/py/libvfio_user.py
+++ b/test/py/libvfio_user.py
@@ -106,10 +106,13 @@ VFIO_USER_CLIENT_MAX_FDS_LIMIT = 1024
SERVER_MAX_FDS = 8
-SERVER_MAX_MSG_SIZE = 65536
+ONE_TB = (1024 * 1024 * 1024 * 1024)
+
+VFIO_USER_DEFAULT_MAX_DATA_XFER_SIZE = (1024 * 1024)
+SERVER_MAX_DATA_XFER_SIZE = VFIO_USER_DEFAULT_MAX_DATA_XFER_SIZE
+SERVER_MAX_MSG_SIZE = SERVER_MAX_DATA_XFER_SIZE + 16 + 16
MAX_DMA_REGIONS = 16
-ONE_TB = (1024 * 1024 * 1024 * 1024)
MAX_DMA_SIZE = (8 * ONE_TB)
# enum vfio_user_command
diff --git a/test/py/test_negotiate.py b/test/py/test_negotiate.py
index e05b450..a3f2a8a 100644
--- a/test/py/test_negotiate.py
+++ b/test/py/test_negotiate.py
@@ -66,6 +66,15 @@ def test_short_write():
vfu_attach_ctx(ctx, expect=errno.EINVAL)
get_reply(sock, expect=errno.EINVAL)
+def test_long_write():
+ sock = connect_sock()
+ hdr = vfio_user_header(VFIO_USER_VERSION, size=SERVER_MAX_MSG_SIZE + 1)
+ sock.send(hdr)
+
+ ret = vfu_attach_ctx(ctx, expect=errno.EINVAL)
+ assert ret == -1
+ assert c.get_errno() == errno.EINVAL
+
def test_bad_command():
sock = connect_sock()
@@ -152,7 +161,7 @@ def test_valid_negotiate_no_json():
assert minor == LIBVFIO_USER_MINOR
json = parse_json(json_str)
assert json.capabilities.max_msg_fds == SERVER_MAX_FDS
- assert json.capabilities.max_msg_size == SERVER_MAX_MSG_SIZE
+ assert json.capabilities.max_data_xfer_size == SERVER_MAX_DATA_XFER_SIZE
# FIXME: migration object checks
disconnect_client(ctx, sock)
@@ -164,8 +173,10 @@ def test_valid_negotiate_empty_json():
vfu_run_ctx(ctx)
def test_valid_negotiate_json():
- client_version_json(json=bytes('{ "capabilities": { "max_msg_fds": %s } }' %
- VFIO_USER_CLIENT_MAX_FDS_LIMIT, "utf-8"))
+ client_version_json(json=bytes(
+ '{ "capabilities": { "max_msg_fds": %s, "max_data_xfer_size": %u } }' %
+ (VFIO_USER_CLIENT_MAX_FDS_LIMIT, VFIO_USER_DEFAULT_MAX_DATA_XFER_SIZE),
+ "utf-8"))
# notice client closed connection
vfu_run_ctx(ctx)