aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2021-07-14 12:33:20 +0100
committerGitHub <noreply@github.com>2021-07-14 12:33:20 +0100
commit2a0a92912d598de871ab47c034432c5fa6546dc4 (patch)
tree7c33b0f6350fe6e2cce0434dd2bfe9b9631b4dca /test
parent561b3092c73b1b45756630fac73b182a3de0fdff (diff)
downloadlibvfio-user-2a0a92912d598de871ab47c034432c5fa6546dc4.zip
libvfio-user-2a0a92912d598de871ab47c034432c5fa6546dc4.tar.gz
libvfio-user-2a0a92912d598de871ab47c034432c5fa6546dc4.tar.bz2
check for valid vfu_setup_region() flags (#579)
Complain about a region that isn't readable *or* writable, or any unknown flags. 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.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/py/test_setup_region.py b/test/py/test_setup_region.py
index c42100f..0e1ff7f 100644
--- a/test/py/test_setup_region.py
+++ b/test/py/test_setup_region.py
@@ -40,6 +40,17 @@ def test_device_set_irqs_setup():
ctx = vfu_create_ctx(flags=LIBVFIO_USER_FLAG_ATTACH_NB)
assert ctx != None
+def test_setup_region_bad_flags():
+ ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_BAR2_REGION_IDX, size=0x10000,
+ flags=0x400)
+ assert ret == -1
+ assert c.get_errno() == errno.EINVAL
+
+ ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_BAR2_REGION_IDX, size=0x10000,
+ flags=0)
+ assert ret == -1
+ assert c.get_errno() == errno.EINVAL
+
def test_setup_region_bad_mmap_areas():
f = tempfile.TemporaryFile()