]> git.proxmox.com Git - mirror_qemu.git/blobdiff - tests/test-throttle.c
async: aio_context_new(): Handle event_notifier_init failure
[mirror_qemu.git] / tests / test-throttle.c
index 000ae31af92743f6a85a2a9a7bf19991853a9ed6..d8ba415e43fa8cae2261de573581f713850af2ab 100644 (file)
@@ -14,6 +14,7 @@
 #include <math.h>
 #include "block/aio.h"
 #include "qemu/throttle.h"
+#include "qemu/error-report.h"
 
 static AioContext     *ctx;
 static LeakyBucket    bkt;
@@ -492,10 +493,17 @@ static void test_accounting(void)
 int main(int argc, char **argv)
 {
     GSource *src;
+    Error *local_error = NULL;
 
     init_clocks();
 
-    ctx = aio_context_new();
+    ctx = aio_context_new(&local_error);
+    if (!ctx) {
+        error_report("Failed to create AIO Context: '%s'",
+                     error_get_pretty(local_error));
+        error_free(local_error);
+        exit(1);
+    }
     src = aio_get_g_source(ctx);
     g_source_attach(src, NULL);
     g_source_unref(src);