mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
tests: virlogtest: Fix testLogParseOutputs return value
The test can return positive value even though it should have failed. It just returns the value parser returned, which should be flipped back to -1 if something went wrong or the result was unexpected, but it isn't.
This commit is contained in:
parent
68b726b93c
commit
f2b799cfc7
@ -47,10 +47,11 @@ static int
|
|||||||
testLogParseOutputs(const void *opaque)
|
testLogParseOutputs(const void *opaque)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
int noutputs;
|
||||||
const struct testLogData *data = opaque;
|
const struct testLogData *data = opaque;
|
||||||
|
|
||||||
ret = virLogParseOutputs(data->str);
|
noutputs = virLogParseOutputs(data->str);
|
||||||
if (ret < 0) {
|
if (noutputs < 0) {
|
||||||
if (!data->pass) {
|
if (!data->pass) {
|
||||||
VIR_TEST_DEBUG("Got expected error: %s\n",
|
VIR_TEST_DEBUG("Got expected error: %s\n",
|
||||||
virGetLastErrorMessage());
|
virGetLastErrorMessage());
|
||||||
@ -58,9 +59,9 @@ testLogParseOutputs(const void *opaque)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else if (ret != data->count) {
|
} else if (noutputs != data->count) {
|
||||||
VIR_TEST_DEBUG("Expected number of parsed outputs is %d, "
|
VIR_TEST_DEBUG("Expected number of parsed outputs is %d, "
|
||||||
"but got %d\n", data->count, ret);
|
"but got %d\n", data->count, noutputs);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else if (!data->pass) {
|
} else if (!data->pass) {
|
||||||
VIR_TEST_DEBUG("Test should have failed\n");
|
VIR_TEST_DEBUG("Test should have failed\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user