Blame SOURCES/kvm-tests-test-blockjob-remove-exit-callback.patch

1bdc94
From b7db3ff5fc3664af536364f8274ed4826566b1dd Mon Sep 17 00:00:00 2001
1bdc94
From: John Snow <jsnow@redhat.com>
1bdc94
Date: Mon, 10 Sep 2018 18:17:56 +0200
1bdc94
Subject: [PATCH 18/25] tests/test-blockjob: remove exit callback
1bdc94
1bdc94
RH-Author: John Snow <jsnow@redhat.com>
1bdc94
Message-id: <20180910181803.11781-19-jsnow@redhat.com>
1bdc94
Patchwork-id: 82108
1bdc94
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 18/25] tests/test-blockjob: remove exit callback
1bdc94
Bugzilla: 1626061
1bdc94
RH-Acked-by: Max Reitz <mreitz@redhat.com>
1bdc94
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
1bdc94
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
1bdc94
1bdc94
We remove the exit callback and the completed boolean along with it.
1bdc94
We can simulate it just fine by waiting for the job to defer to the
1bdc94
main loop, and then giving it one final kick to get the main loop
1bdc94
portion to run.
1bdc94
1bdc94
Signed-off-by: John Snow <jsnow@redhat.com>
1bdc94
Reviewed-by: Max Reitz <mreitz@redhat.com>
1bdc94
Message-id: 20180906130225.5118-10-jsnow@redhat.com
1bdc94
Reviewed-by: Jeff Cody <jcody@redhat.com>
1bdc94
Signed-off-by: Max Reitz <mreitz@redhat.com>
1bdc94
(cherry picked from commit c0345e9d3bd2f3672d481be7514b9ad181878921)
1bdc94
Signed-off-by: John Snow <jsnow@redhat.com>
1bdc94
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
1bdc94
---
1bdc94
 tests/test-blockjob.c | 16 ++++++----------
1bdc94
 1 file changed, 6 insertions(+), 10 deletions(-)
1bdc94
1bdc94
diff --git a/tests/test-blockjob.c b/tests/test-blockjob.c
1bdc94
index 8e8b680..de4c1c2 100644
1bdc94
--- a/tests/test-blockjob.c
1bdc94
+++ b/tests/test-blockjob.c
1bdc94
@@ -160,15 +160,8 @@ typedef struct CancelJob {
1bdc94
     BlockBackend *blk;
1bdc94
     bool should_converge;
1bdc94
     bool should_complete;
1bdc94
-    bool completed;
1bdc94
 } CancelJob;
1bdc94
 
1bdc94
-static void cancel_job_exit(Job *job)
1bdc94
-{
1bdc94
-    CancelJob *s = container_of(job, CancelJob, common.job);
1bdc94
-    s->completed = true;
1bdc94
-}
1bdc94
-
1bdc94
 static void cancel_job_complete(Job *job, Error **errp)
1bdc94
 {
1bdc94
     CancelJob *s = container_of(job, CancelJob, common.job);
1bdc94
@@ -201,7 +194,6 @@ static const BlockJobDriver test_cancel_driver = {
1bdc94
         .user_resume   = block_job_user_resume,
1bdc94
         .drain         = block_job_drain,
1bdc94
         .run           = cancel_job_run,
1bdc94
-        .exit          = cancel_job_exit,
1bdc94
         .complete      = cancel_job_complete,
1bdc94
     },
1bdc94
 };
1bdc94
@@ -335,9 +327,11 @@ static void test_cancel_pending(void)
1bdc94
 
1bdc94
     job_complete(job, &error_abort);
1bdc94
     job_enter(job);
1bdc94
-    while (!s->completed) {
1bdc94
+    while (!job->deferred_to_main_loop) {
1bdc94
         aio_poll(qemu_get_aio_context(), true);
1bdc94
     }
1bdc94
+    assert(job->status == JOB_STATUS_READY);
1bdc94
+    aio_poll(qemu_get_aio_context(), true);
1bdc94
     assert(job->status == JOB_STATUS_PENDING);
1bdc94
 
1bdc94
     cancel_common(s);
1bdc94
@@ -359,9 +353,11 @@ static void test_cancel_concluded(void)
1bdc94
 
1bdc94
     job_complete(job, &error_abort);
1bdc94
     job_enter(job);
1bdc94
-    while (!s->completed) {
1bdc94
+    while (!job->deferred_to_main_loop) {
1bdc94
         aio_poll(qemu_get_aio_context(), true);
1bdc94
     }
1bdc94
+    assert(job->status == JOB_STATUS_READY);
1bdc94
+    aio_poll(qemu_get_aio_context(), true);
1bdc94
     assert(job->status == JOB_STATUS_PENDING);
1bdc94
 
1bdc94
     job_finalize(job, &error_abort);
1bdc94
-- 
1bdc94
1.8.3.1
1bdc94