aboutsummaryrefslogtreecommitdiff
path: root/tests/test-blockjob.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-04-24 16:13:52 +0200
committerKevin Wolf <kwolf@redhat.com>2018-05-23 14:30:51 +0200
commit3d70ff53b6bf90d9eec6f97024ec9895f6799d9e (patch)
tree947adf7d4422c78235ff4b8f2a31fac0085efc9a /tests/test-blockjob.c
parent7eaa8fb57da96301f4a8ce176ad503f80efc7cc0 (diff)
job: Move completion and cancellation to Job
This moves the top-level job completion and cancellation functions from BlockJob to Job. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests/test-blockjob.c')
-rw-r--r--tests/test-blockjob.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/tests/test-blockjob.c b/tests/test-blockjob.c
index 1e052c2e9c..46a78739aa 100644
--- a/tests/test-blockjob.c
+++ b/tests/test-blockjob.c
@@ -165,10 +165,9 @@ typedef struct CancelJob {
static void cancel_job_completed(Job *job, void *opaque)
{
- BlockJob *bjob = container_of(job, BlockJob, job);
CancelJob *s = opaque;
s->completed = true;
- block_job_completed(bjob, 0);
+ job_completed(job, 0);
}
static void cancel_job_complete(Job *job, Error **errp)
@@ -232,7 +231,7 @@ static void cancel_common(CancelJob *s)
BlockBackend *blk = s->blk;
JobStatus sts = job->job.status;
- block_job_cancel_sync(job);
+ job_cancel_sync(&job->job);
if (sts != JOB_STATUS_CREATED && sts != JOB_STATUS_CONCLUDED) {
BlockJob *dummy = job;
block_job_dismiss(&dummy, &error_abort);
@@ -275,7 +274,7 @@ static void test_cancel_paused(void)
assert(job->job.status == JOB_STATUS_RUNNING);
job_user_pause(&job->job, &error_abort);
- block_job_enter(job);
+ job_enter(&job->job);
assert(job->job.status == JOB_STATUS_PAUSED);
cancel_common(s);
@@ -292,7 +291,7 @@ static void test_cancel_ready(void)
assert(job->job.status == JOB_STATUS_RUNNING);
s->should_converge = true;
- block_job_enter(job);
+ job_enter(&job->job);
assert(job->job.status == JOB_STATUS_READY);
cancel_common(s);
@@ -309,11 +308,11 @@ static void test_cancel_standby(void)
assert(job->job.status == JOB_STATUS_RUNNING);
s->should_converge = true;
- block_job_enter(job);
+ job_enter(&job->job);
assert(job->job.status == JOB_STATUS_READY);
job_user_pause(&job->job, &error_abort);
- block_job_enter(job);
+ job_enter(&job->job);
assert(job->job.status == JOB_STATUS_STANDBY);
cancel_common(s);
@@ -330,11 +329,11 @@ static void test_cancel_pending(void)
assert(job->job.status == JOB_STATUS_RUNNING);
s->should_converge = true;
- block_job_enter(job);
+ job_enter(&job->job);
assert(job->job.status == JOB_STATUS_READY);
job_complete(&job->job, &error_abort);
- block_job_enter(job);
+ job_enter(&job->job);
while (!s->completed) {
aio_poll(qemu_get_aio_context(), true);
}
@@ -354,11 +353,11 @@ static void test_cancel_concluded(void)
assert(job->job.status == JOB_STATUS_RUNNING);
s->should_converge = true;
- block_job_enter(job);
+ job_enter(&job->job);
assert(job->job.status == JOB_STATUS_READY);
job_complete(&job->job, &error_abort);
- block_job_enter(job);
+ job_enter(&job->job);
while (!s->completed) {
aio_poll(qemu_get_aio_context(), true);
}