aboutsummaryrefslogtreecommitdiff
path: root/tests/test-blockjob-txn.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-04-13 17:31:02 +0200
committerKevin Wolf <kwolf@redhat.com>2018-05-23 14:30:50 +0200
commitda01ff7f38f52791f93fc3ca59afcfbb220f15af (patch)
tree74010498c6229085ce3f2cc2184168aec5fb99f8 /tests/test-blockjob-txn.c
parent1908a5590c7d214b1b6886bc19b81076fb65cec9 (diff)
job: Move coroutine and related code to Job
This commit moves some core functions for dealing with the job coroutine from BlockJob to Job. This includes primarily entering the coroutine (both for the first and reentering) and yielding explicitly and at pause points. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'tests/test-blockjob-txn.c')
-rw-r--r--tests/test-blockjob-txn.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/test-blockjob-txn.c b/tests/test-blockjob-txn.c
index c03f9662d8..323e154a00 100644
--- a/tests/test-blockjob-txn.c
+++ b/tests/test-blockjob-txn.c
@@ -78,8 +78,8 @@ static const BlockJobDriver test_block_job_driver = {
.job_driver = {
.instance_size = sizeof(TestBlockJob),
.free = block_job_free,
+ .start = test_block_job_run,
},
- .start = test_block_job_run,
};
/* Create a block job that completes with a given return code after a given
@@ -125,7 +125,7 @@ static void test_single_job(int expected)
txn = block_job_txn_new();
job = test_block_job_start(1, true, expected, &result, txn);
- block_job_start(job);
+ job_start(&job->job);
if (expected == -ECANCELED) {
block_job_cancel(job, false);
@@ -165,8 +165,8 @@ static void test_pair_jobs(int expected1, int expected2)
txn = block_job_txn_new();
job1 = test_block_job_start(1, true, expected1, &result1, txn);
job2 = test_block_job_start(2, true, expected2, &result2, txn);
- block_job_start(job1);
- block_job_start(job2);
+ job_start(&job1->job);
+ job_start(&job2->job);
/* Release our reference now to trigger as many nice
* use-after-free bugs as possible.
@@ -227,8 +227,8 @@ static void test_pair_jobs_fail_cancel_race(void)
txn = block_job_txn_new();
job1 = test_block_job_start(1, true, -ECANCELED, &result1, txn);
job2 = test_block_job_start(2, false, 0, &result2, txn);
- block_job_start(job1);
- block_job_start(job2);
+ job_start(&job1->job);
+ job_start(&job2->job);
block_job_cancel(job1, false);