[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/69] test-coroutine: Regression test for yield bug
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 03/69] test-coroutine: Regression test for yield bug |
Date: |
Fri, 27 Feb 2015 18:18:01 +0000 |
This adds a test for reentering a coroutine that previously yielded to a
coroutine that has meanwhile terminated.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
tests/test-coroutine.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/tests/test-coroutine.c b/tests/test-coroutine.c
index 27d1b6f..b552d9f 100644
--- a/tests/test-coroutine.c
+++ b/tests/test-coroutine.c
@@ -13,6 +13,7 @@
#include <glib.h>
#include "block/coroutine.h"
+#include "block/coroutine_int.h"
/*
* Check that qemu_in_coroutine() works
@@ -122,6 +123,30 @@ static void test_yield(void)
g_assert_cmpint(i, ==, 5); /* coroutine must yield 5 times */
}
+static void coroutine_fn c2_fn(void *opaque)
+{
+ qemu_coroutine_yield();
+}
+
+static void coroutine_fn c1_fn(void *opaque)
+{
+ Coroutine *c2 = opaque;
+ qemu_coroutine_enter(c2, NULL);
+}
+
+static void test_co_queue(void)
+{
+ Coroutine *c1;
+ Coroutine *c2;
+
+ c1 = qemu_coroutine_create(c1_fn);
+ c2 = qemu_coroutine_create(c2_fn);
+
+ qemu_coroutine_enter(c1, c2);
+ memset(c1, 0xff, sizeof(Coroutine));
+ qemu_coroutine_enter(c2, NULL);
+}
+
/*
* Check that creation, enter, and return work
*/
@@ -343,6 +368,7 @@ static void perf_cost(void)
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
+ g_test_add_func("/basic/co_queue", test_co_queue);
g_test_add_func("/basic/lifecycle", test_lifecycle);
g_test_add_func("/basic/yield", test_yield);
g_test_add_func("/basic/nesting", test_nesting);
--
2.1.0
- [Qemu-devel] [PULL 00/69] Block patches, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 03/69] test-coroutine: Regression test for yield bug,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 01/69] coroutine: Fix use after free with qemu_coroutine_yield(), Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 02/69] coroutine: Clean up qemu_coroutine_enter(), Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 04/69] vpc: Fix size in fixed image creation, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 07/69] block/raw-posix: fix compilation warning on OSX, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 05/69] vpc: Implement bdrv_co_get_block_status(), Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 08/69] qcow2: Remove unused struct QCowCreateState, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 09/69] virtio-blk: Check return value of blk_aio_ioctl, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 11/69] tests: Prepare virtio-blk-test for multi-arch implementation, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 10/69] libqos: Change use of pointers to uint64_t in virtio, Stefan Hajnoczi, 2015/02/27
- [Qemu-devel] [PULL 12/69] libqos: Remove PCI assumptions in constants of virtio driver, Stefan Hajnoczi, 2015/02/27