Lines Matching refs:job

37     BlockJob *job;  in mk_job()  local
40 job = block_job_create(id, drv, NULL, blk_bs(blk), in mk_job()
45 g_assert_nonnull(job); in mk_job()
47 g_assert_cmpstr(job->job.id, ==, id); in mk_job()
49 g_assert_cmpstr(job->job.id, ==, blk_name(blk)); in mk_job()
53 g_assert_null(job); in mk_job()
56 return job; in mk_job()
105 BlockJob *job[3]; in test_job_ids() local
112 job[0] = do_test_id(blk[0], NULL, false); in test_job_ids()
115 job[0] = do_test_id(blk[0], "0id", false); in test_job_ids()
116 job[0] = do_test_id(blk[0], "", false); in test_job_ids()
117 job[0] = do_test_id(blk[0], " ", false); in test_job_ids()
118 job[0] = do_test_id(blk[0], "123", false); in test_job_ids()
119 job[0] = do_test_id(blk[0], "_id", false); in test_job_ids()
120 job[0] = do_test_id(blk[0], "-id", false); in test_job_ids()
121 job[0] = do_test_id(blk[0], ".id", false); in test_job_ids()
122 job[0] = do_test_id(blk[0], "#id", false); in test_job_ids()
125 job[0] = do_test_id(blk[0], "id0", true); in test_job_ids()
128 job[1] = do_test_id(blk[0], "id1", true); in test_job_ids()
129 job_early_fail(&job[1]->job); in test_job_ids()
132 job[1] = do_test_id(blk[1], "id0", false); in test_job_ids()
135 job_early_fail(&job[0]->job); in test_job_ids()
136 job[1] = do_test_id(blk[1], "id0", true); in test_job_ids()
139 job_early_fail(&job[1]->job); in test_job_ids()
140 job[1] = do_test_id(blk[1], NULL, true); in test_job_ids()
143 job[2] = do_test_id(blk[2], "drive1", false); in test_job_ids()
146 job[0] = do_test_id(blk[0], "drive2", true); in test_job_ids()
147 job[2] = do_test_id(blk[2], NULL, false); in test_job_ids()
150 job[2] = do_test_id(blk[2], "id_2", true); in test_job_ids()
152 job_early_fail(&job[0]->job); in test_job_ids()
153 job_early_fail(&job[1]->job); in test_job_ids()
154 job_early_fail(&job[2]->job); in test_job_ids()
168 static void cancel_job_complete(Job *job, Error **errp) in cancel_job_complete() argument
170 CancelJob *s = container_of(job, CancelJob, common.job); in cancel_job_complete()
174 static int coroutine_fn cancel_job_run(Job *job, Error **errp) in cancel_job_run() argument
176 CancelJob *s = container_of(job, CancelJob, common.job); in cancel_job_run()
179 if (job_is_cancelled(&s->common.job)) { in cancel_job_run()
183 if (!job_is_ready(&s->common.job) && s->should_converge) { in cancel_job_run()
184 job_transition_to_ready(&s->common.job); in cancel_job_run()
187 job_sleep_ns(&s->common.job, 100000); in cancel_job_run()
206 Job *job; in create_common() local
213 job = &bjob->job; in create_common()
215 job_ref_locked(job); in create_common()
216 assert(job->status == JOB_STATUS_CREATED); in create_common()
222 *pjob = job; in create_common()
228 BlockJob *job = &s->common; in cancel_common() local
230 JobStatus sts = job->job.status; in cancel_common()
232 job_cancel_sync(&job->job, true); in cancel_common()
235 Job *dummy = &job->job; in cancel_common()
238 assert(job->job.status == JOB_STATUS_NULL); in cancel_common()
239 job_unref_locked(&job->job); in cancel_common()
248 Job *job; in test_cancel_created() local
251 s = create_common(&job); in test_cancel_created()
255 static void assert_job_status_is(Job *job, int status) in assert_job_status_is() argument
258 assert(job->status == status); in assert_job_status_is()
264 Job *job; in test_cancel_running() local
267 s = create_common(&job); in test_cancel_running()
269 job_start(job); in test_cancel_running()
270 assert_job_status_is(job, JOB_STATUS_RUNNING); in test_cancel_running()
277 Job *job; in test_cancel_paused() local
280 s = create_common(&job); in test_cancel_paused()
282 job_start(job); in test_cancel_paused()
284 assert(job->status == JOB_STATUS_RUNNING); in test_cancel_paused()
285 job_user_pause_locked(job, &error_abort); in test_cancel_paused()
287 job_enter(job); in test_cancel_paused()
288 assert_job_status_is(job, JOB_STATUS_PAUSED); in test_cancel_paused()
295 Job *job; in test_cancel_ready() local
298 s = create_common(&job); in test_cancel_ready()
300 job_start(job); in test_cancel_ready()
301 assert_job_status_is(job, JOB_STATUS_RUNNING); in test_cancel_ready()
304 job_enter(job); in test_cancel_ready()
305 assert_job_status_is(job, JOB_STATUS_READY); in test_cancel_ready()
312 Job *job; in test_cancel_standby() local
315 s = create_common(&job); in test_cancel_standby()
317 job_start(job); in test_cancel_standby()
318 assert_job_status_is(job, JOB_STATUS_RUNNING); in test_cancel_standby()
321 job_enter(job); in test_cancel_standby()
323 assert(job->status == JOB_STATUS_READY); in test_cancel_standby()
324 job_user_pause_locked(job, &error_abort); in test_cancel_standby()
326 job_enter(job); in test_cancel_standby()
327 assert_job_status_is(job, JOB_STATUS_STANDBY); in test_cancel_standby()
334 Job *job; in test_cancel_pending() local
337 s = create_common(&job); in test_cancel_pending()
339 job_start(job); in test_cancel_pending()
340 assert_job_status_is(job, JOB_STATUS_RUNNING); in test_cancel_pending()
343 job_enter(job); in test_cancel_pending()
345 assert(job->status == JOB_STATUS_READY); in test_cancel_pending()
346 job_complete_locked(job, &error_abort); in test_cancel_pending()
348 job_enter(job); in test_cancel_pending()
349 while (!job->deferred_to_main_loop) { in test_cancel_pending()
352 assert_job_status_is(job, JOB_STATUS_READY); in test_cancel_pending()
354 assert_job_status_is(job, JOB_STATUS_PENDING); in test_cancel_pending()
361 Job *job; in test_cancel_concluded() local
364 s = create_common(&job); in test_cancel_concluded()
366 job_start(job); in test_cancel_concluded()
367 assert_job_status_is(job, JOB_STATUS_RUNNING); in test_cancel_concluded()
370 job_enter(job); in test_cancel_concluded()
372 assert(job->status == JOB_STATUS_READY); in test_cancel_concluded()
373 job_complete_locked(job, &error_abort); in test_cancel_concluded()
375 job_enter(job); in test_cancel_concluded()
376 while (!job->deferred_to_main_loop) { in test_cancel_concluded()
379 assert_job_status_is(job, JOB_STATUS_READY); in test_cancel_concluded()
381 assert_job_status_is(job, JOB_STATUS_PENDING); in test_cancel_concluded()
384 job_finalize_locked(job, &error_abort); in test_cancel_concluded()
385 assert(job->status == JOB_STATUS_CONCLUDED); in test_cancel_concluded()