[Libguestfs] [nbdkit PATCH 3/3] python: Test implementation of zero callback

Eric Blake eblake at redhat.com
Thu Apr 5 18:54:36 UTC 2018


The previous commit enabled testing of the fallback when a
zero callback is not present; but even better is testing
that the zero callback is called correctly.

Signed-off-by: Eric Blake <eblake at redhat.com>
---
 tests/test.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/test.py b/tests/test.py
index 015b20f..630ac2f 100644
--- a/tests/test.py
+++ b/tests/test.py
@@ -41,6 +41,11 @@ def pwrite(h, buf, offset):
     disk[offset:end] = buf


+def zero(h, count, offset, may_trim=False):
+    global disk
+    disk[offset:offset+count] = bytearray(count)
+
+
 def flush(h):
     pass

-- 
2.14.3




More information about the Libguestfs mailing list