[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 32/42] throttle: add detach/attach test case
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 32/42] throttle: add detach/attach test case |
Date: |
Fri, 6 Jun 2014 18:13:53 +0200 |
Add a test case that checks the timer is really removed/added by the
detach/attach functions.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Benoit Canet <address@hidden>
---
tests/test-throttle.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/tests/test-throttle.c b/tests/test-throttle.c
index 5fa5000..3de6ab8 100644
--- a/tests/test-throttle.c
+++ b/tests/test-throttle.c
@@ -338,6 +338,29 @@ static void test_have_timer(void)
throttle_destroy(&ts);
}
+static void test_detach_attach(void)
+{
+ /* zero the structure */
+ memset(&ts, 0, sizeof(ts));
+
+ /* init the structure */
+ throttle_init(&ts, ctx, QEMU_CLOCK_VIRTUAL,
+ read_timer_cb, write_timer_cb, &ts);
+
+ /* timer set by init should return true */
+ g_assert(throttle_have_timer(&ts));
+
+ /* timer should no longer exist after detaching */
+ throttle_detach_aio_context(&ts);
+ g_assert(!throttle_have_timer(&ts));
+
+ /* timer should exist again after attaching */
+ throttle_attach_aio_context(&ts, ctx);
+ g_assert(throttle_have_timer(&ts));
+
+ throttle_destroy(&ts);
+}
+
static bool do_test_accounting(bool is_ops, /* are we testing bps or ops */
int size, /* size of the operation to do */
double avg, /* io limit */
@@ -486,6 +509,7 @@ int main(int argc, char **argv)
g_test_add_func("/throttle/init", test_init);
g_test_add_func("/throttle/destroy", test_destroy);
g_test_add_func("/throttle/have_timer", test_have_timer);
+ g_test_add_func("/throttle/detach_attach", test_detach_attach);
g_test_add_func("/throttle/config/enabled", test_enabled);
g_test_add_func("/throttle/config/conflicting", test_conflicting_config);
g_test_add_func("/throttle/config/is_valid", test_is_valid);
--
1.9.3
- [Qemu-devel] [PULL 24/42] dataplane: delete IOQueue since it is no longer used, (continued)
- [Qemu-devel] [PULL 24/42] dataplane: delete IOQueue since it is no longer used, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 25/42] dataplane: implement async flush, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 20/42] sheepdog: implement .bdrv_detach/attach_aio_context(), Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 26/42] raw-posix: drop raw_get_aio_fd() since it is no longer used, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 27/42] block: Move declaration of bdrv_get_aio_context to block.h, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 22/42] vmdk: implement .bdrv_detach/attach_aio_context(), Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 28/42] virtio-blk: Allow config-wce in dataplane, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 29/42] virtio-blk: Factor out virtio_blk_handle_scsi_req from virtio_blk_handle_scsi, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 31/42] throttle: add throttle_detach/attach_aio_context(), Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 30/42] dataplane: Support VIRTIO_BLK_T_SCSI_CMD, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 32/42] throttle: add detach/attach test case,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 33/42] blockdev: acquire AioContext in block_set_io_throttle, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 34/42] block: fix wrong order in live block migration setup, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 36/42] rbd: Fix leaks in rbd_start_aio() error path, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 35/42] qemu-img: Document check exit codes, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 40/42] qapi: create two block related json modules, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 39/42] qapi: Extract qapi/common.json definitions, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 41/42] qapi: Extract qapi/block-core.json definitions, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 42/42] qapi: Extract qapi/block.json definitions, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 23/42] dataplane: use the QEMU block layer for I/O, Stefan Hajnoczi, 2014/06/06
- [Qemu-devel] [PULL 37/42] sheepdog: fix vdi object update after live snapshot, Stefan Hajnoczi, 2014/06/06