[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/42] tests/test-blockjob: remove exit callback
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PULL 09/42] tests/test-blockjob: remove exit callback |
Date: |
Tue, 25 Sep 2018 17:15:08 +0200 |
From: John Snow <address@hidden>
We remove the exit callback and the completed boolean along with it.
We can simulate it just fine by waiting for the job to defer to the
main loop, and then giving it one final kick to get the main loop
portion to run.
Signed-off-by: John Snow <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Message-id: address@hidden
Reviewed-by: Jeff Cody <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
tests/test-blockjob.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/tests/test-blockjob.c b/tests/test-blockjob.c
index 8e8b680416..de4c1c20aa 100644
--- a/tests/test-blockjob.c
+++ b/tests/test-blockjob.c
@@ -160,15 +160,8 @@ typedef struct CancelJob {
BlockBackend *blk;
bool should_converge;
bool should_complete;
- bool completed;
} CancelJob;
-static void cancel_job_exit(Job *job)
-{
- CancelJob *s = container_of(job, CancelJob, common.job);
- s->completed = true;
-}
-
static void cancel_job_complete(Job *job, Error **errp)
{
CancelJob *s = container_of(job, CancelJob, common.job);
@@ -201,7 +194,6 @@ static const BlockJobDriver test_cancel_driver = {
.user_resume = block_job_user_resume,
.drain = block_job_drain,
.run = cancel_job_run,
- .exit = cancel_job_exit,
.complete = cancel_job_complete,
},
};
@@ -335,9 +327,11 @@ static void test_cancel_pending(void)
job_complete(job, &error_abort);
job_enter(job);
- while (!s->completed) {
+ while (!job->deferred_to_main_loop) {
aio_poll(qemu_get_aio_context(), true);
}
+ assert(job->status == JOB_STATUS_READY);
+ aio_poll(qemu_get_aio_context(), true);
assert(job->status == JOB_STATUS_PENDING);
cancel_common(s);
@@ -359,9 +353,11 @@ static void test_cancel_concluded(void)
job_complete(job, &error_abort);
job_enter(job);
- while (!s->completed) {
+ while (!job->deferred_to_main_loop) {
aio_poll(qemu_get_aio_context(), true);
}
+ assert(job->status == JOB_STATUS_READY);
+ aio_poll(qemu_get_aio_context(), true);
assert(job->status == JOB_STATUS_PENDING);
job_finalize(job, &error_abort);
--
2.17.1
- [Qemu-devel] [PULL 00/42] Block patches, Max Reitz, 2018/09/25
- [Qemu-devel] [PULL 03/42] block/stream: add block job creation flags, Max Reitz, 2018/09/25
- [Qemu-devel] [PULL 05/42] block/mirror: don't install backing chain on abort, Max Reitz, 2018/09/25
- [Qemu-devel] [PULL 01/42] block/commit: add block job creation flags, Max Reitz, 2018/09/25
- [Qemu-devel] [PULL 02/42] block/mirror: add block job creation flags, Max Reitz, 2018/09/25
- [Qemu-devel] [PULL 06/42] block/mirror: conservative mirror_exit refactor, Max Reitz, 2018/09/25
- [Qemu-devel] [PULL 07/42] block/stream: refactor stream to use job callbacks, Max Reitz, 2018/09/25
- [Qemu-devel] [PULL 08/42] tests/blockjob: replace Blockjob with Job, Max Reitz, 2018/09/25
- [Qemu-devel] [PULL 09/42] tests/test-blockjob: remove exit callback,
Max Reitz <=
- [Qemu-devel] [PULL 10/42] tests/test-blockjob-txn: move .exit to .clean, Max Reitz, 2018/09/25
- [Qemu-devel] [PULL 12/42] qapi/block-commit: expose new job properties, Max Reitz, 2018/09/25
- [Qemu-devel] [PULL 11/42] jobs: remove .exit callback, Max Reitz, 2018/09/25
- [Qemu-devel] [PULL 16/42] blockdev: document transactional shortcomings, Max Reitz, 2018/09/25
- [Qemu-devel] [PULL 17/42] commit: Add top-node/base-node options, Max Reitz, 2018/09/25
- [Qemu-devel] [PULL 15/42] block/backup: qapi documentation fixup, Max Reitz, 2018/09/25
- [Qemu-devel] [PULL 14/42] qapi/block-stream: expose new job properties, Max Reitz, 2018/09/25
- [Qemu-devel] [PULL 13/42] qapi/block-mirror: expose new job properties, Max Reitz, 2018/09/25
- [Qemu-devel] [PULL 18/42] qemu-iotests: Test commit with top-node/base-node, Max Reitz, 2018/09/25
- [Qemu-devel] [PULL 19/42] block/linux-aio: acquire AioContext before qemu_laio_process_completions, Max Reitz, 2018/09/25