aboutsummaryrefslogtreecommitdiff
path: root/tests/test-blockjob.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-04-13 17:19:31 +0200
committerKevin Wolf <kwolf@redhat.com>2018-05-23 14:30:49 +0200
commita50c2ab858fe613fb805e53b4f6b970ab936706d (patch)
tree06a64966236166b648e1c5bd1f08c240b34a0c00 /tests/test-blockjob.c
parente7c1d78bbd5867804debeb7159b137fd9a6c44d3 (diff)
job: Move state transitions to Job
This moves BlockJob.status and the closely related functions (block_)job_state_transition() and (block_)job_apply_verb to Job. The two QAPI enums are renamed to JobStatus and JobVerb. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/test-blockjob.c')
-rw-r--r--tests/test-blockjob.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/tests/test-blockjob.c b/tests/test-blockjob.c
index b82026180a..6ccd585dee 100644
--- a/tests/test-blockjob.c
+++ b/tests/test-blockjob.c
@@ -211,7 +211,7 @@ static CancelJob *create_common(BlockJob **pjob)
job = mk_job(blk, "Steve", &test_cancel_driver, true,
BLOCK_JOB_MANUAL_FINALIZE | BLOCK_JOB_MANUAL_DISMISS);
block_job_ref(job);
- assert(job->status == BLOCK_JOB_STATUS_CREATED);
+ assert(job->job.status == JOB_STATUS_CREATED);
s = container_of(job, CancelJob, common);
s->blk = blk;
@@ -223,15 +223,14 @@ static void cancel_common(CancelJob *s)
{
BlockJob *job = &s->common;
BlockBackend *blk = s->blk;
- BlockJobStatus sts = job->status;
+ JobStatus sts = job->job.status;
block_job_cancel_sync(job);
- if ((sts != BLOCK_JOB_STATUS_CREATED) &&
- (sts != BLOCK_JOB_STATUS_CONCLUDED)) {
+ if (sts != JOB_STATUS_CREATED && sts != JOB_STATUS_CONCLUDED) {
BlockJob *dummy = job;
block_job_dismiss(&dummy, &error_abort);
}
- assert(job->status == BLOCK_JOB_STATUS_NULL);
+ assert(job->job.status == JOB_STATUS_NULL);
block_job_unref(job);
destroy_blk(blk);
}
@@ -253,7 +252,7 @@ static void test_cancel_running(void)
s = create_common(&job);
block_job_start(job);
- assert(job->status == BLOCK_JOB_STATUS_RUNNING);
+ assert(job->job.status == JOB_STATUS_RUNNING);
cancel_common(s);
}
@@ -266,11 +265,11 @@ static void test_cancel_paused(void)
s = create_common(&job);
block_job_start(job);
- assert(job->status == BLOCK_JOB_STATUS_RUNNING);
+ assert(job->job.status == JOB_STATUS_RUNNING);
block_job_user_pause(job, &error_abort);
block_job_enter(job);
- assert(job->status == BLOCK_JOB_STATUS_PAUSED);
+ assert(job->job.status == JOB_STATUS_PAUSED);
cancel_common(s);
}
@@ -283,11 +282,11 @@ static void test_cancel_ready(void)
s = create_common(&job);
block_job_start(job);
- assert(job->status == BLOCK_JOB_STATUS_RUNNING);
+ assert(job->job.status == JOB_STATUS_RUNNING);
s->should_converge = true;
block_job_enter(job);
- assert(job->status == BLOCK_JOB_STATUS_READY);
+ assert(job->job.status == JOB_STATUS_READY);
cancel_common(s);
}
@@ -300,15 +299,15 @@ static void test_cancel_standby(void)
s = create_common(&job);
block_job_start(job);
- assert(job->status == BLOCK_JOB_STATUS_RUNNING);
+ assert(job->job.status == JOB_STATUS_RUNNING);
s->should_converge = true;
block_job_enter(job);
- assert(job->status == BLOCK_JOB_STATUS_READY);
+ assert(job->job.status == JOB_STATUS_READY);
block_job_user_pause(job, &error_abort);
block_job_enter(job);
- assert(job->status == BLOCK_JOB_STATUS_STANDBY);
+ assert(job->job.status == JOB_STATUS_STANDBY);
cancel_common(s);
}
@@ -321,18 +320,18 @@ static void test_cancel_pending(void)
s = create_common(&job);
block_job_start(job);
- assert(job->status == BLOCK_JOB_STATUS_RUNNING);
+ assert(job->job.status == JOB_STATUS_RUNNING);
s->should_converge = true;
block_job_enter(job);
- assert(job->status == BLOCK_JOB_STATUS_READY);
+ assert(job->job.status == JOB_STATUS_READY);
block_job_complete(job, &error_abort);
block_job_enter(job);
while (!s->completed) {
aio_poll(qemu_get_aio_context(), true);
}
- assert(job->status == BLOCK_JOB_STATUS_PENDING);
+ assert(job->job.status == JOB_STATUS_PENDING);
cancel_common(s);
}
@@ -345,21 +344,21 @@ static void test_cancel_concluded(void)
s = create_common(&job);
block_job_start(job);
- assert(job->status == BLOCK_JOB_STATUS_RUNNING);
+ assert(job->job.status == JOB_STATUS_RUNNING);
s->should_converge = true;
block_job_enter(job);
- assert(job->status == BLOCK_JOB_STATUS_READY);
+ assert(job->job.status == JOB_STATUS_READY);
block_job_complete(job, &error_abort);
block_job_enter(job);
while (!s->completed) {
aio_poll(qemu_get_aio_context(), true);
}
- assert(job->status == BLOCK_JOB_STATUS_PENDING);
+ assert(job->job.status == JOB_STATUS_PENDING);
block_job_finalize(job, &error_abort);
- assert(job->status == BLOCK_JOB_STATUS_CONCLUDED);
+ assert(job->job.status == JOB_STATUS_CONCLUDED);
cancel_common(s);
}