aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-02-12 16:37:44 +0100
committerMarkus Armbruster <armbru@redhat.com>2015-02-26 14:46:32 +0100
commitcccb7967bdf19f9d31e65d2d07d4d311e07545c4 (patch)
tree1521f4b26e1615206e2e7ecbb29221099156a9dc /tests
parentc5c6d7f81a6950d8e32a3b5a0bafd37bfa5a8e88 (diff)
downloadqemu-cccb7967bdf19f9d31e65d2d07d4d311e07545c4.zip
qemu-cccb7967bdf19f9d31e65d2d07d4d311e07545c4.tar.gz
qemu-cccb7967bdf19f9d31e65d2d07d4d311e07545c4.tar.bz2
QemuOpts: Convert qemu_opt_set_bool() to Error, fix its use
Return the Error object instead of reporting it with qerror_report_err(). Change callers that assume the function can't fail to pass &error_abort, so that should the assumption ever break, it'll break noisily. Turns out all callers outside its unit test assume that. We could drop the Error ** argument, but that would make the interface less regular, so don't. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test-qemu-opts.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/test-qemu-opts.c b/tests/test-qemu-opts.c
index ca08ac5..6b0ae33 100644
--- a/tests/test-qemu-opts.c
+++ b/tests/test-qemu-opts.c
@@ -169,10 +169,10 @@ static void test_qemu_opt_get(void)
static void test_qemu_opt_get_bool(void)
{
+ Error *err = NULL;
QemuOptsList *list;
QemuOpts *opts;
bool opt;
- int ret;
list = qemu_find_opts("opts_list_02");
g_assert(list != NULL);
@@ -192,16 +192,16 @@ static void test_qemu_opt_get_bool(void)
opt = qemu_opt_get_bool(opts, "bool1", false);
g_assert(opt == false);
- ret = qemu_opt_set_bool(opts, "bool1", true);
- g_assert(ret == 0);
+ qemu_opt_set_bool(opts, "bool1", true, &err);
+ g_assert(!err);
/* now we have set bool1, should know about it */
opt = qemu_opt_get_bool(opts, "bool1", false);
g_assert(opt == true);
/* having reset the value, opt should be the reset one not defval */
- ret = qemu_opt_set_bool(opts, "bool1", false);
- g_assert(ret == 0);
+ qemu_opt_set_bool(opts, "bool1", false, &err);
+ g_assert(!err);
opt = qemu_opt_get_bool(opts, "bool1", true);
g_assert(opt == false);