diff options
author | Mattias Nissler <122288598+mnissler-rivos@users.noreply.github.com> | 2023-08-31 11:38:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-31 10:38:55 +0100 |
commit | a7eedffe20bd6e480c9e2c65e68daef1beb2af05 (patch) | |
tree | 37f46c9cbf8de3fbb0622b7472157d60f1b8550f /test/py/test_device_get_info.py | |
parent | 2e8ec2e17a5252d29bae849eb4ccd7ca6bab216a (diff) | |
download | libvfio-user-a7eedffe20bd6e480c9e2c65e68daef1beb2af05.zip libvfio-user-a7eedffe20bd6e480c9e2c65e68daef1beb2af05.tar.gz libvfio-user-a7eedffe20bd6e480c9e2c65e68daef1beb2af05.tar.bz2 |
Introduce client object in python tests (#772)
Thus far, the client end of the socket is the only piece of client state
tracked in tests, for which a global `socket` variable has been used. In
preparation to add more state, replace the `socket` global with a
`client` global object that groups all client state.
Signed-off-by: Mattias Nissler <mnissler@rivosinc.com>
Reviewed-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'test/py/test_device_get_info.py')
-rw-r--r-- | test/py/test_device_get_info.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/py/test_device_get_info.py b/test/py/test_device_get_info.py index 0a26614..7337199 100644 --- a/test/py/test_device_get_info.py +++ b/test/py/test_device_get_info.py @@ -49,11 +49,11 @@ def test_device_get_info(): # test short write - sock = connect_client(ctx) + client = connect_client(ctx) payload = struct.pack("II", 0, 0) - msg(ctx, sock, VFIO_USER_DEVICE_GET_INFO, payload, + msg(ctx, client.sock, VFIO_USER_DEVICE_GET_INFO, payload, expect=errno.EINVAL) # bad argsz @@ -61,7 +61,7 @@ def test_device_get_info(): payload = vfio_user_device_info(argsz=8, flags=0, num_regions=0, num_irqs=0) - msg(ctx, sock, VFIO_USER_DEVICE_GET_INFO, payload, + msg(ctx, client.sock, VFIO_USER_DEVICE_GET_INFO, payload, expect=errno.EINVAL) # valid with larger argsz @@ -69,7 +69,7 @@ def test_device_get_info(): payload = vfio_user_device_info(argsz=32, flags=0, num_regions=0, num_irqs=0) - result = msg(ctx, sock, VFIO_USER_DEVICE_GET_INFO, payload) + result = msg(ctx, client.sock, VFIO_USER_DEVICE_GET_INFO, payload) (argsz, flags, num_regions, num_irqs) = struct.unpack("IIII", result) @@ -78,7 +78,7 @@ def test_device_get_info(): assert num_regions == VFU_PCI_DEV_NUM_REGIONS assert num_irqs == VFU_DEV_NUM_IRQS - disconnect_client(ctx, sock) + client.disconnect(ctx) vfu_destroy_ctx(ctx) |