mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
tests: qemumonitor: Prepare for more test data in testBlockNodeNameDetect
Rename 'json' and related variables to 'nodeNameJson'. Also rename the test files along. This is a preparation for modifying how we detect node names which will also require data from 'query-blockstats'. Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
2b5d5d68ca
commit
f1ce954b32
@ -2740,19 +2740,19 @@ static int
|
|||||||
testBlockNodeNameDetect(const void *opaque)
|
testBlockNodeNameDetect(const void *opaque)
|
||||||
{
|
{
|
||||||
const struct testBlockNodeNameDetectData *data = opaque;
|
const struct testBlockNodeNameDetectData *data = opaque;
|
||||||
char *jsonFile = NULL;
|
char *namedNodesFile = NULL;
|
||||||
char *jsonStr = NULL;
|
char *namedNodesStr = NULL;
|
||||||
char *resultFile = NULL;
|
char *resultFile = NULL;
|
||||||
char *actual = NULL;
|
char *actual = NULL;
|
||||||
char **nodenames = NULL;
|
char **nodenames = NULL;
|
||||||
char **next;
|
char **next;
|
||||||
virJSONValuePtr json = NULL;
|
virJSONValuePtr namedNodesJson = NULL;
|
||||||
virHashTablePtr nodedata = NULL;
|
virHashTablePtr nodedata = NULL;
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (virAsprintf(&jsonFile,
|
if (virAsprintf(&namedNodesFile,
|
||||||
"%s/qemumonitorjsondata/qemumonitorjson-nodename-%s.json",
|
"%s/qemumonitorjsondata/qemumonitorjson-nodename-%s-named-nodes.json",
|
||||||
abs_srcdir, data->name) < 0 ||
|
abs_srcdir, data->name) < 0 ||
|
||||||
virAsprintf(&resultFile,
|
virAsprintf(&resultFile,
|
||||||
"%s/qemumonitorjsondata/qemumonitorjson-nodename-%s.result",
|
"%s/qemumonitorjsondata/qemumonitorjson-nodename-%s.result",
|
||||||
@ -2762,13 +2762,13 @@ testBlockNodeNameDetect(const void *opaque)
|
|||||||
if (!(nodenames = virStringSplit(data->nodenames, ",", 0)))
|
if (!(nodenames = virStringSplit(data->nodenames, ",", 0)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virTestLoadFile(jsonFile, &jsonStr) < 0)
|
if (virTestLoadFile(namedNodesFile, &namedNodesStr) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(json = virJSONValueFromString(jsonStr)))
|
if (!(namedNodesJson = virJSONValueFromString(namedNodesStr)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(nodedata = qemuBlockNodeNameGetBackingChain(json)))
|
if (!(nodedata = qemuBlockNodeNameGetBackingChain(namedNodesJson)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
for (next = nodenames; *next; next++)
|
for (next = nodenames; *next; next++)
|
||||||
@ -2787,13 +2787,13 @@ testBlockNodeNameDetect(const void *opaque)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(jsonFile);
|
VIR_FREE(namedNodesFile);
|
||||||
VIR_FREE(resultFile);
|
VIR_FREE(resultFile);
|
||||||
VIR_FREE(jsonStr);
|
VIR_FREE(namedNodesStr);
|
||||||
VIR_FREE(actual);
|
VIR_FREE(actual);
|
||||||
virHashFree(nodedata);
|
virHashFree(nodedata);
|
||||||
virStringListFree(nodenames);
|
virStringListFree(nodenames);
|
||||||
virJSONValueFree(json);
|
virJSONValueFree(namedNodesJson);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user