mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-06 09:55:46 +00:00
virshtest: refactor testCompareOutputLit
Use g_autofree and get rid of the cleanup label. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
994688e0df
commit
8bacdde9d5
@ -60,26 +60,20 @@ static int
|
|||||||
testCompareOutputLit(const char *expectData,
|
testCompareOutputLit(const char *expectData,
|
||||||
const char *filter, const char *const argv[])
|
const char *filter, const char *const argv[])
|
||||||
{
|
{
|
||||||
int result = -1;
|
g_autofree char *actualData = NULL;
|
||||||
char *actualData = NULL;
|
|
||||||
|
|
||||||
if (virTestCaptureProgramOutput(argv, &actualData, 4096) < 0)
|
if (virTestCaptureProgramOutput(argv, &actualData, 4096) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (filter && testFilterLine(actualData, filter) < 0)
|
if (filter && testFilterLine(actualData, filter) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (STRNEQ(expectData, actualData)) {
|
if (STRNEQ(expectData, actualData)) {
|
||||||
virTestDifference(stderr, expectData, actualData);
|
virTestDifference(stderr, expectData, actualData);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
VIR_FREE(actualData);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# define VIRSH_DEFAULT abs_top_builddir "/tools/virsh", \
|
# define VIRSH_DEFAULT abs_top_builddir "/tools/virsh", \
|
||||||
|
Loading…
Reference in New Issue
Block a user