aboutsummaryrefslogtreecommitdiff
path: root/tests/test-blockjob.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2017-01-16 17:17:38 +0100
committerKevin Wolf <kwolf@redhat.com>2017-02-24 16:09:23 +0100
commitd185cf0ec64cd183218ca7e0810d9130c96ebebc (patch)
tree17448da52da010b26a545507f5eec77c758a5b3c /tests/test-blockjob.c
parenta8a4d15c1c34d3cec704fb64eba4a3745a140a97 (diff)
tests: Use opened block node for block job tests
blk_insert_bs() and block job related functions will soon require an opened block node (permission calculations will involve the block driver), so let our tests be consistent with the real users in this respect. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'tests/test-blockjob.c')
-rw-r--r--tests/test-blockjob.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/test-blockjob.c b/tests/test-blockjob.c
index 60b78a3342..068c9e419b 100644
--- a/tests/test-blockjob.c
+++ b/tests/test-blockjob.c
@@ -54,7 +54,10 @@ static BlockJob *do_test_id(BlockBackend *blk, const char *id,
static BlockBackend *create_blk(const char *name)
{
BlockBackend *blk = blk_new();
- BlockDriverState *bs = bdrv_new();
+ BlockDriverState *bs;
+
+ bs = bdrv_open("null-co://", NULL, NULL, 0, &error_abort);
+ g_assert_nonnull(bs);
blk_insert_bs(blk, bs);
bdrv_unref(bs);
@@ -140,6 +143,7 @@ static void test_job_ids(void)
int main(int argc, char **argv)
{
qemu_init_main_loop(&error_abort);
+ bdrv_init();
g_test_init(&argc, &argv, NULL);
g_test_add_func("/blockjob/ids", test_job_ids);