[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 05/41] tests: Use opened block node for block jo
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [RFC PATCH 05/41] tests: Use opened block node for block job tests |
Date: |
Mon, 13 Feb 2017 18:22:27 +0100 |
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 <address@hidden>
---
tests/test-blockjob-txn.c | 6 +++++-
tests/test-blockjob.c | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/tests/test-blockjob-txn.c b/tests/test-blockjob-txn.c
index b132e39..f6dfd08 100644
--- a/tests/test-blockjob-txn.c
+++ b/tests/test-blockjob-txn.c
@@ -96,7 +96,10 @@ static BlockJob *test_block_job_start(unsigned int
iterations,
char job_id[24];
data = g_new0(TestBlockJobCBData, 1);
- bs = bdrv_new();
+
+ bs = bdrv_open("null-co://", NULL, NULL, 0, &error_abort);
+ g_assert_nonnull(bs);
+
snprintf(job_id, sizeof(job_id), "job%u", counter++);
s = block_job_create(job_id, &test_block_job_driver, bs, 0,
BLOCK_JOB_DEFAULT, test_block_job_cb,
@@ -242,6 +245,7 @@ static void test_pair_jobs_fail_cancel_race(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("/single/success", test_single_job_success);
diff --git a/tests/test-blockjob.c b/tests/test-blockjob.c
index 60b78a3..068c9e4 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);
--
1.8.3.1
- [Qemu-devel] [RFC PATCH 00/41] New op blocker system, Kevin Wolf, 2017/02/13
- [Qemu-devel] [RFC PATCH 02/41] block: Add op blocker permission constants, Kevin Wolf, 2017/02/13
- [Qemu-devel] [RFC PATCH 03/41] block: Add Error argument to bdrv_attach_child(), Kevin Wolf, 2017/02/13
- [Qemu-devel] [RFC PATCH 01/41] block: Attach bs->file only during .bdrv_open(), Kevin Wolf, 2017/02/13
- [Qemu-devel] [RFC PATCH 04/41] block: Let callers request permissions when attaching a child node, Kevin Wolf, 2017/02/13
- [Qemu-devel] [RFC PATCH 05/41] tests: Use opened block node for block job tests,
Kevin Wolf <=
- [Qemu-devel] [RFC PATCH 07/41] block: Default .bdrv_child_perm() for filter drivers, Kevin Wolf, 2017/02/13
- [Qemu-devel] [RFC PATCH 09/41] block: Default .bdrv_child_perm() for format drivers, Kevin Wolf, 2017/02/13
- Re: [Qemu-devel] [RFC PATCH 09/41] block: Default .bdrv_child_perm() for format drivers, Max Reitz, 2017/02/15
[Qemu-devel] [RFC PATCH 06/41] block: Involve block drivers in permission granting, Kevin Wolf, 2017/02/13