提交 0afb159d 编写于 作者: J Jiri Denemark

qemucapabilitiestest: Uses consistent names

In other tests we use "expected" and "actual" to refer to the expected
outcome of the tested API and the result we got, respectively.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 3af43219
...@@ -86,23 +86,23 @@ testQemuFeedMonitor(char *replies, ...@@ -86,23 +86,23 @@ testQemuFeedMonitor(char *replies,
} }
static int static int
testQemuCapsCompare(virQEMUCapsPtr capsProvided, testQemuCapsCompare(virQEMUCapsPtr capsExpected,
virQEMUCapsPtr capsComputed) virQEMUCapsPtr capsActual)
{ {
int ret = 0; int ret = 0;
size_t i; size_t i;
for (i = 0; i < QEMU_CAPS_LAST; i++) { for (i = 0; i < QEMU_CAPS_LAST; i++) {
if (virQEMUCapsGet(capsProvided, i) && if (virQEMUCapsGet(capsExpected, i) &&
!virQEMUCapsGet(capsComputed, i)) { !virQEMUCapsGet(capsActual, i)) {
fprintf(stderr, "Caps mismatch: capsComputed is missing %s\n", fprintf(stderr, "Expected caps flag not set: %s\n",
virQEMUCapsTypeToString(i)); virQEMUCapsTypeToString(i));
ret = -1; ret = -1;
} }
if (virQEMUCapsGet(capsComputed, i) && if (!virQEMUCapsGet(capsExpected, i) &&
!virQEMUCapsGet(capsProvided, i)) { virQEMUCapsGet(capsActual, i)) {
fprintf(stderr, "Caps mismatch: capsProvided is missing %s\n", fprintf(stderr, "Unexpected caps flag set: %s\n",
virQEMUCapsTypeToString(i)); virQEMUCapsTypeToString(i));
ret = -1; ret = -1;
} }
...@@ -119,7 +119,8 @@ testQemuCaps(const void *opaque) ...@@ -119,7 +119,8 @@ testQemuCaps(const void *opaque)
char *repliesFile = NULL, *capsFile = NULL; char *repliesFile = NULL, *capsFile = NULL;
char *replies = NULL; char *replies = NULL;
qemuMonitorTestPtr mon = NULL; qemuMonitorTestPtr mon = NULL;
virQEMUCapsPtr capsProvided = NULL, capsComputed = NULL; virQEMUCapsPtr capsExpected = NULL;
virQEMUCapsPtr capsActual = NULL;
if (virAsprintf(&repliesFile, "%s/qemucapabilitiesdata/%s.%s.replies", if (virAsprintf(&repliesFile, "%s/qemucapabilitiesdata/%s.%s.replies",
abs_srcdir, data->base, data->archName) < 0 || abs_srcdir, data->base, data->archName) < 0 ||
...@@ -133,17 +134,17 @@ testQemuCaps(const void *opaque) ...@@ -133,17 +134,17 @@ testQemuCaps(const void *opaque)
if (!(mon = testQemuFeedMonitor(replies, data->xmlopt))) if (!(mon = testQemuFeedMonitor(replies, data->xmlopt)))
goto cleanup; goto cleanup;
if (!(capsProvided = qemuTestParseCapabilities(capsFile))) if (!(capsExpected = qemuTestParseCapabilities(capsFile)))
goto cleanup; goto cleanup;
if (!(capsComputed = virQEMUCapsNew())) if (!(capsActual = virQEMUCapsNew()))
goto cleanup; goto cleanup;
if (virQEMUCapsInitQMPMonitor(capsComputed, if (virQEMUCapsInitQMPMonitor(capsActual,
qemuMonitorTestGetMonitor(mon)) < 0) qemuMonitorTestGetMonitor(mon)) < 0)
goto cleanup; goto cleanup;
if (testQemuCapsCompare(capsProvided, capsComputed) < 0) if (testQemuCapsCompare(capsExpected, capsActual) < 0)
goto cleanup; goto cleanup;
ret = 0; ret = 0;
...@@ -152,8 +153,8 @@ testQemuCaps(const void *opaque) ...@@ -152,8 +153,8 @@ testQemuCaps(const void *opaque)
VIR_FREE(capsFile); VIR_FREE(capsFile);
VIR_FREE(replies); VIR_FREE(replies);
qemuMonitorTestFree(mon); qemuMonitorTestFree(mon);
virObjectUnref(capsProvided); virObjectUnref(capsExpected);
virObjectUnref(capsComputed); virObjectUnref(capsActual);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册