qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH v1 21/25] tests: Update error API usages


From: Peter Crosthwaite
Subject: [Qemu-devel] [RFC PATCH v1 21/25] tests: Update error API usages
Date: Thu, 10 Sep 2015 22:33:31 -0700

Use error_prefix() and error_report_err() as appropriate.

Cc: Stefan Hajnoczi <address@hidden>
Signed-off-by: Peter Crosthwaite <address@hidden>
---

 tests/test-aio.c         | 5 ++---
 tests/test-thread-pool.c | 5 ++---
 tests/test-throttle.c    | 9 ++++-----
 3 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/tests/test-aio.c b/tests/test-aio.c
index 217e337..daeeb47 100644
--- a/tests/test-aio.c
+++ b/tests/test-aio.c
@@ -802,9 +802,8 @@ int main(int argc, char **argv)
 
     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);
+        error_prefix(local_err, "Failed to create AIO Context: ");
+        error_report_err(local_err);
         exit(1);
     }
     src = aio_get_g_source(ctx);
diff --git a/tests/test-thread-pool.c b/tests/test-thread-pool.c
index 6a0b981..231c789 100644
--- a/tests/test-thread-pool.c
+++ b/tests/test-thread-pool.c
@@ -229,9 +229,8 @@ int main(int argc, char **argv)
 
     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);
+        error_prefix(local_error, "Failed to create AIO Context:");
+        error_report_err(local_error);
         exit(1);
     }
     pool = aio_get_thread_pool(ctx);
diff --git a/tests/test-throttle.c b/tests/test-throttle.c
index 85c9b6c..4996445 100644
--- a/tests/test-throttle.c
+++ b/tests/test-throttle.c
@@ -587,12 +587,11 @@ int main(int argc, char **argv)
     ctx = qemu_get_aio_context();
 
     if (!ctx) {
-        error_report("Failed to create AIO Context: '%s'",
-                     local_error ? error_get_pretty(local_error) :
-                     "Failed to initialize the QEMU main loop");
-        if (local_error) {
-            error_free(local_error);
+        if (!local_error) {
+           error_setg(&local_error, "Failed to initialize the QEMU main loop");
         }
+        error_prefix(local_error, "Failed to create AIO Context: ");
+        error_report_err(local_error);
         exit(1);
     }
 
-- 
1.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]