diff options
author | John Levon <john.levon@nutanix.com> | 2021-12-02 10:34:49 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-02 10:34:49 +0000 |
commit | 7056525da5399d00831e90bed4aedb4b8442c9b2 (patch) | |
tree | cad15c0fd38f269e7c091ea43420690cce7b4745 /test | |
parent | df6fcef301661e680a5cf33668ffa3e88bcbbae0 (diff) | |
download | libvfio-user-7056525da5399d00831e90bed4aedb4b8442c9b2.zip libvfio-user-7056525da5399d00831e90bed4aedb4b8442c9b2.tar.gz libvfio-user-7056525da5399d00831e90bed4aedb4b8442c9b2.tar.bz2 |
test more region access validation code (#634)
Add a little more coverage of our validation, and correct a small typo.
Signed-off-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/py/test_setup_region.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/test/py/test_setup_region.py b/test/py/test_setup_region.py index f06d31c..b55f56f 100644 --- a/test/py/test_setup_region.py +++ b/test/py/test_setup_region.py @@ -35,7 +35,7 @@ import tempfile ctx = None -def test_device_set_irqs_setup(): +def test_setup_region_setup(): global ctx ctx = vfu_create_ctx(flags=LIBVFIO_USER_FLAG_ATTACH_NB) @@ -215,6 +215,30 @@ def test_access_region_zero_count(): disconnect_client(ctx, sock) +def test_access_region_large_count(): + global ctx + + sock = connect_client(ctx) + + read_region(ctx, sock, VFU_PCI_DEV_CFG_REGION_IDX, offset=0, + count=SERVER_MAX_DATA_XFER_SIZE + 8, expect=errno.EINVAL) + + disconnect_client(ctx, sock) + + +def test_region_offset_too_short(): + global ctx + + sock = connect_client(ctx) + + payload = struct.pack("Q", 0) + + msg(ctx, sock, VFIO_USER_REGION_WRITE, payload, + expect_reply_errno=errno.EINVAL) + + disconnect_client(ctx, sock) + + def test_setup_region_cleanup(): vfu_destroy_ctx(ctx) |