summaryrefslogtreecommitdiff
path: root/tests/test-qemu-opts.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-02-12 16:46:36 +0100
committerMarkus Armbruster <armbru@redhat.com>2015-02-26 14:47:32 +0100
commit39101f2511f6adf1ae4380f8d729dba1213b9d7a (patch)
tree8c67d373be53ff4ad9d2a7e54112d4f0beb279be /tests/test-qemu-opts.c
parentcccb7967bdf19f9d31e65d2d07d4d311e07545c4 (diff)
QemuOpts: Convert qemu_opt_set_number() 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/test-qemu-opts.c')
-rw-r--r--tests/test-qemu-opts.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/test-qemu-opts.c b/tests/test-qemu-opts.c
index 6b0ae333d4..3fea96ab94 100644
--- a/tests/test-qemu-opts.c
+++ b/tests/test-qemu-opts.c
@@ -215,10 +215,10 @@ static void test_qemu_opt_get_bool(void)
static void test_qemu_opt_get_number(void)
{
+ Error *err = NULL;
QemuOptsList *list;
QemuOpts *opts;
uint64_t opt;
- int ret;
list = qemu_find_opts("opts_list_01");
g_assert(list != NULL);
@@ -238,16 +238,16 @@ static void test_qemu_opt_get_number(void)
opt = qemu_opt_get_number(opts, "number1", 5);
g_assert(opt == 5);
- ret = qemu_opt_set_number(opts, "number1", 10);
- g_assert(ret == 0);
+ qemu_opt_set_number(opts, "number1", 10, &err);
+ g_assert(!err);
/* now we have set number1, should know about it */
opt = qemu_opt_get_number(opts, "number1", 5);
g_assert(opt == 10);
/* having reset it, the returned should be the reset one not defval */
- ret = qemu_opt_set_number(opts, "number1", 15);
- g_assert(ret == 0);
+ qemu_opt_set_number(opts, "number1", 15, &err);
+ g_assert(!err);
opt = qemu_opt_get_number(opts, "number1", 5);
g_assert(opt == 15);
@@ -349,10 +349,10 @@ static void test_qemu_opt_unset(void)
static void test_qemu_opts_reset(void)
{
+ Error *err = NULL;
QemuOptsList *list;
QemuOpts *opts;
uint64_t opt;
- int ret;
list = qemu_find_opts("opts_list_01");
g_assert(list != NULL);
@@ -372,8 +372,8 @@ static void test_qemu_opts_reset(void)
opt = qemu_opt_get_number(opts, "number1", 5);
g_assert(opt == 5);
- ret = qemu_opt_set_number(opts, "number1", 10);
- g_assert(ret == 0);
+ qemu_opt_set_number(opts, "number1", 10, &err);
+ g_assert(!err);
/* now we have set number1, should know about it */
opt = qemu_opt_get_number(opts, "number1", 5);