qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v10 09/21] jobs: use job locks also in the unit tests


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [PATCH v10 09/21] jobs: use job locks also in the unit tests
Date: Wed, 27 Jul 2022 17:29:11 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1

On 7/25/22 10:38, Emanuele Giuseppe Esposito wrote:
Add missing job synchronization in the unit tests, with
explicit locks.

We are deliberately using _locked functions wrapped by a guard
instead of a normal call because the normal call will be removed
in future, as the only usage is limited to the tests.

In other words, if a function like job_pause() is/will be only used
in tests to avoid:

WITH_JOB_LOCK_GUARD(){
     job_pause_locked();
}

then it is not worth keeping job_pause(), and just use the guard.

Note: at this stage, job_{lock/unlock} and job lock guard macros
are *nop*.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

actually, patch is modified enough to drop r-b.

---
  tests/unit/test-bdrv-drain.c     |  76 +++++++++++++-------
  tests/unit/test-block-iothread.c |   8 ++-
  tests/unit/test-blockjob-txn.c   |  24 ++++---
  tests/unit/test-blockjob.c       | 116 +++++++++++++++++++------------
  4 files changed, 141 insertions(+), 83 deletions(-)

[..]

@@ -459,36 +477,44 @@ static void test_complete_in_standby(void)
      bjob = mk_job(blk, "job", &test_yielding_driver, true,
                    JOB_MANUAL_FINALIZE | JOB_MANUAL_DISMISS);
      job = &bjob->job;
-    assert(job->status == JOB_STATUS_CREATED);
+    /* Job did not start, so status is safe to read*/

comment is not needed now, let's drop it.

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>


--
Best regards,
Vladimir



reply via email to

[Prev in Thread] Current Thread [Next in Thread]