On 17.05.22 13:38, Alberto Faria wrote:
Also convert it into a generated_co_wrapper.
Signed-off-by: Alberto Faria <afa...@redhat.com>
---
block/block-backend.c | 14 --------------
block/coroutines.h | 5 -----
include/sysemu/block-backend-io.h | 4 ++++
tests/unit/test-block-iothread.c | 19 +++++++++++++++++++
4 files changed, 23 insertions(+), 19 deletions(-)
[...]
diff --git a/tests/unit/test-block-iothread.c b/tests/unit/test-block-iothread.c
index 2fa1248445..6061762c97 100644
--- a/tests/unit/test-block-iothread.c
+++ b/tests/unit/test-block-iothread.c
@@ -183,6 +183,21 @@ static void test_sync_op_blk_preadv_part(BlockBackend *blk)
g_assert_cmpint(ret, ==, -EIO);
}
+static void test_sync_op_blk_pwritev_part(BlockBackend *blk)
+{
+ uint8_t buf[512];
Given you’ve initialized this in test_sync_op_blk_pwritev(), I think it
should be initialized here, too.
With that done:
Reviewed-by: Hanna Reitz <hre...@redhat.com>
+ QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, sizeof(buf));
+ int ret;
+
+ /* Success */
+ ret = blk_pwritev_part(blk, 0, sizeof(buf), &qiov, 0, 0);
+ g_assert_cmpint(ret, ==, 0);
+
+ /* Early error: Negative offset */
+ ret = blk_pwritev_part(blk, -2, sizeof(buf), &qiov, 0, 0);
+ g_assert_cmpint(ret, ==, -EIO);
+}
+