]> git.proxmox.com Git - mirror_qemu.git/commit - tests/unit/test-bdrv-drain.c
jobs: use job locks also in the unit tests
authorEmanuele Giuseppe Esposito <eesposit@redhat.com>
Mon, 26 Sep 2022 09:32:02 +0000 (05:32 -0400)
committerKevin Wolf <kwolf@redhat.com>
Fri, 7 Oct 2022 10:11:41 +0000 (12:11 +0200)
commit191e7af3949b51a0a675a3e13539c17140dc2fba
treeb3d61c30b8abcd2fcfeba0c0945d1473b95cb219
parent962411244192a21717dcce216ec7bbc44272184c
jobs: use job locks also in the unit tests

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: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20220926093214.506243-10-eesposit@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
tests/unit/test-bdrv-drain.c
tests/unit/test-block-iothread.c
tests/unit/test-blockjob-txn.c
tests/unit/test-blockjob.c