aboutsummaryrefslogtreecommitdiff
path: root/tests/test-qemu-opts.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-06-30 11:03:29 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-07-02 06:25:28 +0200
commitd8da9e71b6c79c2899c08bb168cd0ae88da70596 (patch)
tree0965f9b9391d00e65b79e37776f7eb546f14d2d5 /tests/test-qemu-opts.c
parent9261ef5e32b0559642ccb70565836e1bc023937e (diff)
tests: Use &error_abort where appropriate
Receiving the error in a local variable only to assert there is none is less clear than passing &error_abort. Clean up. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20200630090351.1247703-5-armbru@redhat.com>
Diffstat (limited to 'tests/test-qemu-opts.c')
-rw-r--r--tests/test-qemu-opts.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/tests/test-qemu-opts.c b/tests/test-qemu-opts.c
index 2a0f42a09b..297ffe79dd 100644
--- a/tests/test-qemu-opts.c
+++ b/tests/test-qemu-opts.c
@@ -187,7 +187,6 @@ static void test_qemu_opt_get(void)
static void test_qemu_opt_get_bool(void)
{
- Error *err = NULL;
QemuOptsList *list;
QemuOpts *opts;
bool opt;
@@ -210,16 +209,14 @@ static void test_qemu_opt_get_bool(void)
opt = qemu_opt_get_bool(opts, "bool1", false);
g_assert(opt == false);
- qemu_opt_set_bool(opts, "bool1", true, &err);
- g_assert(!err);
+ qemu_opt_set_bool(opts, "bool1", true, &error_abort);
/* 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 */
- qemu_opt_set_bool(opts, "bool1", false, &err);
- g_assert(!err);
+ qemu_opt_set_bool(opts, "bool1", false, &error_abort);
opt = qemu_opt_get_bool(opts, "bool1", true);
g_assert(opt == false);
@@ -233,7 +230,6 @@ 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;
@@ -256,16 +252,14 @@ static void test_qemu_opt_get_number(void)
opt = qemu_opt_get_number(opts, "number1", 5);
g_assert(opt == 5);
- qemu_opt_set_number(opts, "number1", 10, &err);
- g_assert(!err);
+ qemu_opt_set_number(opts, "number1", 10, &error_abort);
/* 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 */
- qemu_opt_set_number(opts, "number1", 15, &err);
- g_assert(!err);
+ qemu_opt_set_number(opts, "number1", 15, &error_abort);
opt = qemu_opt_get_number(opts, "number1", 5);
g_assert(opt == 15);
@@ -367,7 +361,6 @@ static void test_qemu_opt_unset(void)
static void test_qemu_opts_reset(void)
{
- Error *err = NULL;
QemuOptsList *list;
QemuOpts *opts;
uint64_t opt;
@@ -390,8 +383,7 @@ static void test_qemu_opts_reset(void)
opt = qemu_opt_get_number(opts, "number1", 5);
g_assert(opt == 5);
- qemu_opt_set_number(opts, "number1", 10, &err);
- g_assert(!err);
+ qemu_opt_set_number(opts, "number1", 10, &error_abort);
/* now we have set number1, should know about it */
opt = qemu_opt_get_number(opts, "number1", 5);
@@ -406,7 +398,6 @@ static void test_qemu_opts_reset(void)
static void test_qemu_opts_set(void)
{
- Error *err = NULL;
QemuOptsList *list;
QemuOpts *opts;
const char *opt;
@@ -421,8 +412,7 @@ static void test_qemu_opts_set(void)
g_assert(opts == NULL);
/* implicitly create opts and set str3 value */
- qemu_opts_set(list, NULL, "str3", "value", &err);
- g_assert(!err);
+ qemu_opts_set(list, NULL, "str3", "value", &error_abort);
g_assert(!QTAILQ_EMPTY(&list->head));
/* get the just created opts */