[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/33] tests: remove aio_context_acquire() tests
From: |
Kevin Wolf |
Subject: |
[PULL 17/33] tests: remove aio_context_acquire() tests |
Date: |
Thu, 21 Dec 2023 22:23:22 +0100 |
From: Stefan Hajnoczi <stefanha@redhat.com>
The aio_context_acquire() API is being removed. Drop the test case that
calls the API.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20231205182011.1976568-4-stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
tests/unit/test-aio.c | 67 +------------------------------------------
1 file changed, 1 insertion(+), 66 deletions(-)
diff --git a/tests/unit/test-aio.c b/tests/unit/test-aio.c
index 337b6e4ea7..e77d86be87 100644
--- a/tests/unit/test-aio.c
+++ b/tests/unit/test-aio.c
@@ -100,76 +100,12 @@ static void event_ready_cb(EventNotifier *e)
/* Tests using aio_*. */
-typedef struct {
- QemuMutex start_lock;
- EventNotifier notifier;
- bool thread_acquired;
-} AcquireTestData;
-
-static void *test_acquire_thread(void *opaque)
-{
- AcquireTestData *data = opaque;
-
- /* Wait for other thread to let us start */
- qemu_mutex_lock(&data->start_lock);
- qemu_mutex_unlock(&data->start_lock);
-
- /* event_notifier_set might be called either before or after
- * the main thread's call to poll(). The test case's outcome
- * should be the same in either case.
- */
- event_notifier_set(&data->notifier);
- aio_context_acquire(ctx);
- aio_context_release(ctx);
-
- data->thread_acquired = true; /* success, we got here */
-
- return NULL;
-}
-
static void set_event_notifier(AioContext *nctx, EventNotifier *notifier,
EventNotifierHandler *handler)
{
aio_set_event_notifier(nctx, notifier, handler, NULL, NULL);
}
-static void dummy_notifier_read(EventNotifier *n)
-{
- event_notifier_test_and_clear(n);
-}
-
-static void test_acquire(void)
-{
- QemuThread thread;
- AcquireTestData data;
-
- /* Dummy event notifier ensures aio_poll() will block */
- event_notifier_init(&data.notifier, false);
- set_event_notifier(ctx, &data.notifier, dummy_notifier_read);
- g_assert(!aio_poll(ctx, false)); /* consume aio_notify() */
-
- qemu_mutex_init(&data.start_lock);
- qemu_mutex_lock(&data.start_lock);
- data.thread_acquired = false;
-
- qemu_thread_create(&thread, "test_acquire_thread",
- test_acquire_thread,
- &data, QEMU_THREAD_JOINABLE);
-
- /* Block in aio_poll(), let other thread kick us and acquire context */
- aio_context_acquire(ctx);
- qemu_mutex_unlock(&data.start_lock); /* let the thread run */
- g_assert(aio_poll(ctx, true));
- g_assert(!data.thread_acquired);
- aio_context_release(ctx);
-
- qemu_thread_join(&thread);
- set_event_notifier(ctx, &data.notifier, NULL);
- event_notifier_cleanup(&data.notifier);
-
- g_assert(data.thread_acquired);
-}
-
static void test_bh_schedule(void)
{
BHTestData data = { .n = 0 };
@@ -879,7 +815,7 @@ static void test_worker_thread_co_enter(void)
qemu_thread_get_self(&this_thread);
co = qemu_coroutine_create(co_check_current_thread, &this_thread);
- qemu_thread_create(&worker_thread, "test_acquire_thread",
+ qemu_thread_create(&worker_thread, "test_aio_co_enter",
test_aio_co_enter,
co, QEMU_THREAD_JOINABLE);
@@ -899,7 +835,6 @@ int main(int argc, char **argv)
while (g_main_context_iteration(NULL, false));
g_test_init(&argc, &argv, NULL);
- g_test_add_func("/aio/acquire", test_acquire);
g_test_add_func("/aio/bh/schedule", test_bh_schedule);
g_test_add_func("/aio/bh/schedule10", test_bh_schedule10);
g_test_add_func("/aio/bh/cancel", test_bh_cancel);
--
2.43.0
- [PULL 06/33] virtio-blk: don't lock AioContext in the completion code path, (continued)
- [PULL 06/33] virtio-blk: don't lock AioContext in the completion code path, Kevin Wolf, 2023/12/21
- [PULL 07/33] virtio-blk: don't lock AioContext in the submission code path, Kevin Wolf, 2023/12/21
- [PULL 09/33] vl: Improve error message for conflicting -incoming and -loadvm, Kevin Wolf, 2023/12/21
- [PULL 10/33] iotests: Basic tests for internal snapshots, Kevin Wolf, 2023/12/21
- [PULL 12/33] virtio-scsi: don't lock AioContext around virtio_queue_aio_attach_host_notifier(), Kevin Wolf, 2023/12/21
- [PULL 11/33] scsi: only access SCSIDevice->requests from one thread, Kevin Wolf, 2023/12/21
- [PULL 14/33] dma-helpers: don't lock AioContext in dma_blk_cb(), Kevin Wolf, 2023/12/21
- [PULL 13/33] scsi: don't lock AioContext in I/O code path, Kevin Wolf, 2023/12/21
- [PULL 15/33] virtio-scsi: replace AioContext lock with tmf_bh_lock, Kevin Wolf, 2023/12/21
- [PULL 16/33] scsi: assert that callbacks run in the correct AioContext, Kevin Wolf, 2023/12/21
- [PULL 17/33] tests: remove aio_context_acquire() tests,
Kevin Wolf <=
- [PULL 18/33] aio: make aio_context_acquire()/aio_context_release() a no-op, Kevin Wolf, 2023/12/21
- [PULL 19/33] graph-lock: remove AioContext locking, Kevin Wolf, 2023/12/21
- [PULL 20/33] block: remove AioContext locking, Kevin Wolf, 2023/12/21
- [PULL 22/33] scsi: remove AioContext locking, Kevin Wolf, 2023/12/21
- [PULL 21/33] block: remove bdrv_co_lock(), Kevin Wolf, 2023/12/21
- [PULL 24/33] aio: remove aio_context_acquire()/aio_context_release() API, Kevin Wolf, 2023/12/21
- [PULL 26/33] scsi: remove outdated AioContext lock comment, Kevin Wolf, 2023/12/21
- [PULL 25/33] docs: remove AioContext lock from IOThread docs, Kevin Wolf, 2023/12/21
- [PULL 27/33] job: remove outdated AioContext locking comments, Kevin Wolf, 2023/12/21
- [PULL 23/33] aio-wait: draw equivalence between AIO_WAIT_WHILE() and AIO_WAIT_WHILE_UNLOCKED(), Kevin Wolf, 2023/12/21