aboutsummaryrefslogtreecommitdiff
path: root/test/py/test_dma_unmap.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/py/test_dma_unmap.py')
-rw-r--r--test/py/test_dma_unmap.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/test/py/test_dma_unmap.py b/test/py/test_dma_unmap.py
index 0200c43..f070ede 100644
--- a/test/py/test_dma_unmap.py
+++ b/test/py/test_dma_unmap.py
@@ -65,7 +65,7 @@ def test_dma_unmap_bad_argsz():
def test_dma_unmap_invalid_flags():
payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()),
- flags=0x2323, addr=0x1000, size=4096)
+ flags=0x4, addr=0x1000, size=4096)
msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, expect=errno.ENOTSUP)
def test_dma_unmap():
@@ -74,6 +74,38 @@ def test_dma_unmap():
flags=0, addr=0x1000, size=4096)
msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload)
+def test_dma_unmap_all():
+
+ for i in range(0, MAX_DMA_REGIONS):
+ payload = vfio_user_dma_map(argsz=len(vfio_user_dma_map()),
+ flags=(VFIO_USER_F_DMA_REGION_READ |
+ VFIO_USER_F_DMA_REGION_WRITE),
+ offset=0, addr=0x1000 * i, size=4096)
+
+ msg(ctx, sock, VFIO_USER_DMA_MAP, payload)
+
+ payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()),
+ flags=VFIO_DMA_UNMAP_FLAG_ALL, addr=0, size=0)
+
+ msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload)
+
+def test_dma_unmap_all_invalid_addr():
+
+ payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()),
+ flags=VFIO_DMA_UNMAP_FLAG_ALL, addr=0x10000, size=4096)
+
+ msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, expect=errno.EINVAL)
+
+def test_dma_unmap_all_invalid_flags():
+
+ payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()),
+ flags=(VFIO_DMA_UNMAP_FLAG_ALL | VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP),
+ addr=0, size=0)
+
+ msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, expect=errno.EINVAL)
+
def test_dma_unmap_cleanup():
disconnect_client(ctx, sock)
vfu_destroy_ctx(ctx)
+
+# ex: set tabstop=4 shiftwidth=4 softtabstop=4 expandtab