summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-12-18 16:35:11 +0100
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:28:24 -0600
commit770e7b1aa4d9e060c184ca47d579eff1cce0c601 (patch)
treeb1e3dcd8cf3c8492288c8e6cccf9ad601df4e817 /tests
parent674380db88c129f88078287e952d984739e6ccfc (diff)
downloadhqemu-770e7b1aa4d9e060c184ca47d579eff1cce0c601.zip
hqemu-770e7b1aa4d9e060c184ca47d579eff1cce0c601.tar.gz
test-throttle: Simplify qemu_init_main_loop() error handling
The code looks like it tries to check for both qemu_init_main_loop() and qemu_get_aio_context() failure in one conditional. In fact, qemu_get_aio_context() can fail only after qemu_init_main_loop() failed. Simplify accordingly: check for qemu_init_main_loop() error directly, without bothering to improve its error message. Call qemu_get_aio_context() only when qemu_get_aio_context() succeeded. It can't fail then, so no need to check. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1450452927-8346-9-git-send-email-armbru@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test-throttle.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/tests/test-throttle.c b/tests/test-throttle.c
index 85c9b6c..a95039f 100644
--- a/tests/test-throttle.c
+++ b/tests/test-throttle.c
@@ -581,21 +581,8 @@ static void test_groups(void)
int main(int argc, char **argv)
{
- Error *local_error = NULL;
-
- qemu_init_main_loop(&local_error);
+ qemu_init_main_loop(&error_fatal);
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);
- }
- exit(1);
- }
-
bdrv_init();
do {} while (g_main_context_iteration(NULL, false));
OpenPOWER on IntegriCloud