]> git.proxmox.com Git - mirror_qemu.git/commit - tests/unit/test-visitor-serialization.c
qapi: Simplify non-error testing in test-qmp-*
authorEric Blake <eblake@redhat.com>
Fri, 6 Nov 2015 06:35:30 +0000 (23:35 -0700)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 9 Nov 2015 15:45:05 +0000 (16:45 +0100)
commit3f66f764ee25f10d3e1144ebc057a949421b7728
treede1bba1a49030a5e8f8553a94ec3f4c341a1be24
parentb18f1141d0afa00de11a8e079f4f5305c9e36893
qapi: Simplify non-error testing in test-qmp-*

By using &error_abort, we can avoid a local err variable in
situations where we expect success.  It also has the nice
effect that if the test breaks, the error message from
error_abort tends to be nicer than that of g_assert().

This patch has an additional bonus of fixing several call sites that
were passing &err to two different functions without checking it in
between.  In general that is unsafe practice; because if the first
function sets an error, the second function could abort() if it tries to
set a different error. We got away with it because we were asserting
that err was NULL through the entire chain, but switching to
&error_abort avoids the questionable practice up front.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1446791754-23823-7-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
tests/test-qmp-input-strict.c
tests/test-qmp-input-visitor.c
tests/test-qmp-output-visitor.c
tests/test-visitor-serialization.c