Blame SOURCES/kvm-tests-blockjob-replace-Blockjob-with-Job.patch

357786
From 4003c681cac2102b3c493e2f1a7f9af7e88e0d38 Mon Sep 17 00:00:00 2001
357786
From: John Snow <jsnow@redhat.com>
357786
Date: Mon, 10 Sep 2018 18:17:55 +0200
357786
Subject: [PATCH 17/25] tests/blockjob: replace Blockjob with Job
357786
357786
RH-Author: John Snow <jsnow@redhat.com>
357786
Message-id: <20180910181803.11781-18-jsnow@redhat.com>
357786
Patchwork-id: 82103
357786
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 17/25] tests/blockjob: replace Blockjob with Job
357786
Bugzilla: 1626061
357786
RH-Acked-by: Max Reitz <mreitz@redhat.com>
357786
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
357786
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
357786
357786
These tests don't actually test blockjobs anymore, they test
357786
generic Job lifetimes. Change the types accordingly.
357786
357786
Signed-off-by: John Snow <jsnow@redhat.com>
357786
Reviewed-by: Max Reitz <mreitz@redhat.com>
357786
Message-id: 20180906130225.5118-9-jsnow@redhat.com
357786
Reviewed-by: Jeff Cody <jcody@redhat.com>
357786
Signed-off-by: Max Reitz <mreitz@redhat.com>
357786
(cherry picked from commit 15fcc3513802c74838075048c6f2d9e58780ba06)
357786
Signed-off-by: John Snow <jsnow@redhat.com>
357786
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
---
357786
 tests/test-blockjob.c | 98 ++++++++++++++++++++++++++-------------------------
357786
 1 file changed, 50 insertions(+), 48 deletions(-)
357786
357786
diff --git a/tests/test-blockjob.c b/tests/test-blockjob.c
357786
index ad4a65b..8e8b680 100644
357786
--- a/tests/test-blockjob.c
357786
+++ b/tests/test-blockjob.c
357786
@@ -206,18 +206,20 @@ static const BlockJobDriver test_cancel_driver = {
357786
     },
357786
 };
357786
 
357786
-static CancelJob *create_common(BlockJob **pjob)
357786
+static CancelJob *create_common(Job **pjob)
357786
 {
357786
     BlockBackend *blk;
357786
-    BlockJob *job;
357786
+    Job *job;
357786
+    BlockJob *bjob;
357786
     CancelJob *s;
357786
 
357786
     blk = create_blk(NULL);
357786
-    job = mk_job(blk, "Steve", &test_cancel_driver, true,
357786
-                 JOB_MANUAL_FINALIZE | JOB_MANUAL_DISMISS);
357786
-    job_ref(&job->job);
357786
-    assert(job->job.status == JOB_STATUS_CREATED);
357786
-    s = container_of(job, CancelJob, common);
357786
+    bjob = mk_job(blk, "Steve", &test_cancel_driver, true,
357786
+                  JOB_MANUAL_FINALIZE | JOB_MANUAL_DISMISS);
357786
+    job = &bjob->job;
357786
+    job_ref(job);
357786
+    assert(job->status == JOB_STATUS_CREATED);
357786
+    s = container_of(bjob, CancelJob, common);
357786
     s->blk = blk;
357786
 
357786
     *pjob = job;
357786
@@ -242,7 +244,7 @@ static void cancel_common(CancelJob *s)
357786
 
357786
 static void test_cancel_created(void)
357786
 {
357786
-    BlockJob *job;
357786
+    Job *job;
357786
     CancelJob *s;
357786
 
357786
     s = create_common(&job;;
357786
@@ -251,119 +253,119 @@ static void test_cancel_created(void)
357786
 
357786
 static void test_cancel_running(void)
357786
 {
357786
-    BlockJob *job;
357786
+    Job *job;
357786
     CancelJob *s;
357786
 
357786
     s = create_common(&job;;
357786
 
357786
-    job_start(&job->job);
357786
-    assert(job->job.status == JOB_STATUS_RUNNING);
357786
+    job_start(job);
357786
+    assert(job->status == JOB_STATUS_RUNNING);
357786
 
357786
     cancel_common(s);
357786
 }
357786
 
357786
 static void test_cancel_paused(void)
357786
 {
357786
-    BlockJob *job;
357786
+    Job *job;
357786
     CancelJob *s;
357786
 
357786
     s = create_common(&job;;
357786
 
357786
-    job_start(&job->job);
357786
-    assert(job->job.status == JOB_STATUS_RUNNING);
357786
+    job_start(job);
357786
+    assert(job->status == JOB_STATUS_RUNNING);
357786
 
357786
-    job_user_pause(&job->job, &error_abort);
357786
-    job_enter(&job->job);
357786
-    assert(job->job.status == JOB_STATUS_PAUSED);
357786
+    job_user_pause(job, &error_abort);
357786
+    job_enter(job);
357786
+    assert(job->status == JOB_STATUS_PAUSED);
357786
 
357786
     cancel_common(s);
357786
 }
357786
 
357786
 static void test_cancel_ready(void)
357786
 {
357786
-    BlockJob *job;
357786
+    Job *job;
357786
     CancelJob *s;
357786
 
357786
     s = create_common(&job;;
357786
 
357786
-    job_start(&job->job);
357786
-    assert(job->job.status == JOB_STATUS_RUNNING);
357786
+    job_start(job);
357786
+    assert(job->status == JOB_STATUS_RUNNING);
357786
 
357786
     s->should_converge = true;
357786
-    job_enter(&job->job);
357786
-    assert(job->job.status == JOB_STATUS_READY);
357786
+    job_enter(job);
357786
+    assert(job->status == JOB_STATUS_READY);
357786
 
357786
     cancel_common(s);
357786
 }
357786
 
357786
 static void test_cancel_standby(void)
357786
 {
357786
-    BlockJob *job;
357786
+    Job *job;
357786
     CancelJob *s;
357786
 
357786
     s = create_common(&job;;
357786
 
357786
-    job_start(&job->job);
357786
-    assert(job->job.status == JOB_STATUS_RUNNING);
357786
+    job_start(job);
357786
+    assert(job->status == JOB_STATUS_RUNNING);
357786
 
357786
     s->should_converge = true;
357786
-    job_enter(&job->job);
357786
-    assert(job->job.status == JOB_STATUS_READY);
357786
+    job_enter(job);
357786
+    assert(job->status == JOB_STATUS_READY);
357786
 
357786
-    job_user_pause(&job->job, &error_abort);
357786
-    job_enter(&job->job);
357786
-    assert(job->job.status == JOB_STATUS_STANDBY);
357786
+    job_user_pause(job, &error_abort);
357786
+    job_enter(job);
357786
+    assert(job->status == JOB_STATUS_STANDBY);
357786
 
357786
     cancel_common(s);
357786
 }
357786
 
357786
 static void test_cancel_pending(void)
357786
 {
357786
-    BlockJob *job;
357786
+    Job *job;
357786
     CancelJob *s;
357786
 
357786
     s = create_common(&job;;
357786
 
357786
-    job_start(&job->job);
357786
-    assert(job->job.status == JOB_STATUS_RUNNING);
357786
+    job_start(job);
357786
+    assert(job->status == JOB_STATUS_RUNNING);
357786
 
357786
     s->should_converge = true;
357786
-    job_enter(&job->job);
357786
-    assert(job->job.status == JOB_STATUS_READY);
357786
+    job_enter(job);
357786
+    assert(job->status == JOB_STATUS_READY);
357786
 
357786
-    job_complete(&job->job, &error_abort);
357786
-    job_enter(&job->job);
357786
+    job_complete(job, &error_abort);
357786
+    job_enter(job);
357786
     while (!s->completed) {
357786
         aio_poll(qemu_get_aio_context(), true);
357786
     }
357786
-    assert(job->job.status == JOB_STATUS_PENDING);
357786
+    assert(job->status == JOB_STATUS_PENDING);
357786
 
357786
     cancel_common(s);
357786
 }
357786
 
357786
 static void test_cancel_concluded(void)
357786
 {
357786
-    BlockJob *job;
357786
+    Job *job;
357786
     CancelJob *s;
357786
 
357786
     s = create_common(&job;;
357786
 
357786
-    job_start(&job->job);
357786
-    assert(job->job.status == JOB_STATUS_RUNNING);
357786
+    job_start(job);
357786
+    assert(job->status == JOB_STATUS_RUNNING);
357786
 
357786
     s->should_converge = true;
357786
-    job_enter(&job->job);
357786
-    assert(job->job.status == JOB_STATUS_READY);
357786
+    job_enter(job);
357786
+    assert(job->status == JOB_STATUS_READY);
357786
 
357786
-    job_complete(&job->job, &error_abort);
357786
-    job_enter(&job->job);
357786
+    job_complete(job, &error_abort);
357786
+    job_enter(job);
357786
     while (!s->completed) {
357786
         aio_poll(qemu_get_aio_context(), true);
357786
     }
357786
-    assert(job->job.status == JOB_STATUS_PENDING);
357786
+    assert(job->status == JOB_STATUS_PENDING);
357786
 
357786
-    job_finalize(&job->job, &error_abort);
357786
-    assert(job->job.status == JOB_STATUS_CONCLUDED);
357786
+    job_finalize(job, &error_abort);
357786
+    assert(job->status == JOB_STATUS_CONCLUDED);
357786
 
357786
     cancel_common(s);
357786
 }
357786
-- 
357786
1.8.3.1
357786