summaryrefslogtreecommitdiff
path: root/tests/qemuhelptest.c
diff options
context:
space:
mode:
authorPeter Krempa <pkrempa@redhat.com>2017-07-25 15:13:33 +0200
committerPeter Krempa <pkrempa@redhat.com>2017-07-27 09:37:21 +0200
commitb650caedf12860c519e84ca152ebb591046d1cc5 (patch)
tree06a72e9581d18dcd1081c0893a640295c4cf09e8 /tests/qemuhelptest.c
parentd492b19259dc96a9233022bbcdb628f2e5fbdea6 (diff)
downloadlibvirt-b650caedf12860c519e84ca152ebb591046d1cc5.tar.gz
tests: qemuhelp: convert to virTestLoadFilePath
As a sample usage of the new helper convert the calls in qemuhelptest to the new helper. Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/qemuhelptest.c')
-rw-r--r--tests/qemuhelptest.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 7485d2dcd9..1a6e7092fd 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -44,7 +44,6 @@ static void printMismatchedFlags(virQEMUCapsPtr got,
static int testHelpStrParsing(const void *data)
{
const struct testInfo *info = data;
- char *path = NULL;
char *help = NULL;
unsigned int version, kvm_version;
bool is_kvm;
@@ -53,10 +52,7 @@ static int testHelpStrParsing(const void *data)
char *got = NULL;
char *expected = NULL;
- if (virAsprintf(&path, "%s/qemuhelpdata/%s", abs_srcdir, info->name) < 0)
- return -1;
-
- if (virTestLoadFile(path, &help) < 0)
+ if (!(help = virTestLoadFilePath("qemuhelpdata/", info->name, NULL)))
goto cleanup;
if (!(flags = virQEMUCapsNew()))
@@ -76,13 +72,8 @@ static int testHelpStrParsing(const void *data)
virQEMUCapsSet(flags, QEMU_CAPS_MONITOR_JSON);
# endif
- VIR_FREE(path);
VIR_FREE(help);
- if (virAsprintf(&path, "%s/qemuhelpdata/%s-device", abs_srcdir,
- info->name) < 0)
- goto cleanup;
-
- if (virTestLoadFile(path, &help) < 0)
+ if (!(help = virTestLoadFilePath("qemuhelpdata/", info->name, "-device", NULL)))
goto cleanup;
if (virQEMUCapsParseDeviceStr(flags, help) < 0)
@@ -125,7 +116,6 @@ static int testHelpStrParsing(const void *data)
ret = 0;
cleanup:
- VIR_FREE(path);
VIR_FREE(help);
virObjectUnref(flags);
VIR_FREE(got);