aboutsummaryrefslogtreecommitdiff
path: root/test/py/libvfio_user.py
diff options
context:
space:
mode:
authorWilliam Henderson <william.henderson@nutanix.com>2023-08-17 10:36:21 +0000
committerJohn Levon <john.levon@nutanix.com>2023-09-15 13:06:15 +0100
commit206b96f7139d1f4e45f326a905f549f731ea1f31 (patch)
treed9224ecbb8ef38a5ff5c639d29db914ff6d0fbc0 /test/py/libvfio_user.py
parentf43ef9703cb6ad6e5d7b6f0ac0a537ca71aa0b1d (diff)
downloadlibvfio-user-206b96f7139d1f4e45f326a905f549f731ea1f31.zip
libvfio-user-206b96f7139d1f4e45f326a905f549f731ea1f31.tar.gz
libvfio-user-206b96f7139d1f4e45f326a905f549f731ea1f31.tar.bz2
test: add missing tests for different dirty page sizes
Signed-off-by: William Henderson <william.henderson@nutanix.com>
Diffstat (limited to 'test/py/libvfio_user.py')
-rw-r--r--test/py/libvfio_user.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/py/libvfio_user.py b/test/py/libvfio_user.py
index d586888..c83a75d 100644
--- a/test/py/libvfio_user.py
+++ b/test/py/libvfio_user.py
@@ -1248,4 +1248,9 @@ def fds_are_same(fd1: int, fd2: int) -> bool:
return s1.st_dev == s2.st_dev and s1.st_ino == s2.st_ino
+def get_bitmap_size(size: int, pgsize: int) -> int:
+ nr_pages = (size // pgsize) + (1 if size % pgsize != 0 else 0)
+ return ((nr_pages + 63) & ~63) // 8
+
+
# ex: set tabstop=4 shiftwidth=4 softtabstop=4 expandtab: #