[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 18/35] /basic/order
From: |
Paolo Bonzini |
Subject: |
[PATCH 18/35] /basic/order |
Date: |
Thu, 10 Mar 2022 13:43:56 +0100 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tests/unit/test-coroutine.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c
index 6ad653adda..3d898d50c6 100644
--- a/tests/unit/test-coroutine.c
+++ b/tests/unit/test-coroutine.c
@@ -490,8 +490,6 @@ static void test_lifecycle(void)
g_assert(done); /* expect done to be true (second time) */
}
-#if 0
-
#define RECORD_SIZE 10 /* Leave some room for expansion */
struct coroutine_position {
int func;
@@ -508,13 +506,27 @@ static void record_push(int func, int state)
cp->state = state;
}
-static void coroutine_fn co_order_test(void *opaque)
+CO_DECLARE_FRAME(co_order_test);
+static CoroutineAction co__co_order_test(void *_frame)
{
+ struct FRAME__co_order_test *_f = _frame;
+switch(_f->_step) {
+case 0:
record_push(2, 1);
g_assert(qemu_in_coroutine());
- qemu_coroutine_yield();
+_f->_step = 1;
+ return qemu_coroutine_yield();
+case 1:
record_push(2, 2);
g_assert(qemu_in_coroutine());
+ break;
+}
+return stack_free(&_f->common);
+}
+
+static CoroutineAction co_order_test(void *opaque)
+{
+ return CO_INIT_FRAME(co_order_test);
}
static void do_order_test(void)
@@ -544,6 +556,7 @@ static void test_order(void)
g_assert_cmpint(records[i].state, ==, expected_pos[i].state);
}
}
+#if 0
/*
* Lifecycle benchmark
*/
@@ -700,8 +713,8 @@ int main(int argc, char **argv)
g_test_add_func("/basic/self", test_self);
g_test_add_func("/basic/entered", test_entered);
g_test_add_func("/basic/in_coroutine", test_in_coroutine);
-#if 0
g_test_add_func("/basic/order", test_order);
+#if 0
g_test_add_func("/locking/co-mutex", test_co_mutex);
g_test_add_func("/locking/co-mutex/lockable", test_co_mutex_lockable);
g_test_add_func("/locking/co-rwlock/upgrade", test_co_rwlock_upgrade);
--
2.35.1
- [PATCH experiment 00/35] stackless coroutine backend, Paolo Bonzini, 2022/03/10
- [PATCH 01/35] coroutine: add missing coroutine_fn annotations for CoRwlock functions, Paolo Bonzini, 2022/03/10
- [PATCH 05/35] coroutine: small code cleanup in qemu_co_rwlock_wrlock, Paolo Bonzini, 2022/03/10
- [PATCH 07/35] coroutine: introduce the "stackless coroutine" backend, Paolo Bonzini, 2022/03/10
- [PATCH 09/35] convert qemu-coroutine-sleep.c to stackless coroutines, Paolo Bonzini, 2022/03/10
- [PATCH 02/35] coroutine: qemu_coroutine_get_aio_context is not a coroutine_fn, Paolo Bonzini, 2022/03/10
- [PATCH 04/35] coroutine: introduce coroutine_only_fn, Paolo Bonzini, 2022/03/10
- [PATCH 06/35] disable some code, Paolo Bonzini, 2022/03/10
- [PATCH 15/35] /basic/self, Paolo Bonzini, 2022/03/10
- [PATCH 03/35] coroutine: introduce QemuCoLockable, Paolo Bonzini, 2022/03/10
- [PATCH 18/35] /basic/order,
Paolo Bonzini <=
- [PATCH 21/35] /perf/yield, Paolo Bonzini, 2022/03/10
- [PATCH 08/35] /basic/lifecycle, Paolo Bonzini, 2022/03/10
- [PATCH 10/35] enable tail call optimization of qemu_co_mutex_lock, Paolo Bonzini, 2022/03/10
- [PATCH 12/35] define magic macros for stackless coroutines, Paolo Bonzini, 2022/03/10
- [PATCH 27/35] /locking/co-mutex/lockable, Paolo Bonzini, 2022/03/10
- [PATCH 16/35] /basic/entered, Paolo Bonzini, 2022/03/10
- [PATCH 30/35] qemu_co_rwlock_unlock, Paolo Bonzini, 2022/03/10
- [PATCH 32/35] qemu_co_rwlock_wrlock, Paolo Bonzini, 2022/03/10
- [PATCH 13/35] /basic/yield, Paolo Bonzini, 2022/03/10
- [PATCH 14/35] /basic/nesting, Paolo Bonzini, 2022/03/10