diff options
author | William Henderson <william.henderson@nutanix.com> | 2023-08-17 10:36:21 +0000 |
---|---|---|
committer | John Levon <john.levon@nutanix.com> | 2023-09-15 13:06:15 +0100 |
commit | 206b96f7139d1f4e45f326a905f549f731ea1f31 (patch) | |
tree | d9224ecbb8ef38a5ff5c639d29db914ff6d0fbc0 /test/py/libvfio_user.py | |
parent | f43ef9703cb6ad6e5d7b6f0ac0a537ca71aa0b1d (diff) | |
download | libvfio-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.py | 5 |
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: # |