mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-08 12:41:29 +00:00
tests: nodedev: remove unnecessary cleanup label
Now that the last cleanup task was removed in the previous commit, just remove the label and return early on error rather than goto cleanup. Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
65b109f7e6
commit
8e98c90f90
@ -44,7 +44,6 @@ testMdevctlCmd(virMdevctlCommand cmd_type,
|
|||||||
g_autoptr(virNodeDeviceDef) def = NULL;
|
g_autoptr(virNodeDeviceDef) def = NULL;
|
||||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
const char *actualCmdline = NULL;
|
const char *actualCmdline = NULL;
|
||||||
int ret = -1;
|
|
||||||
g_autofree char *outbuf = NULL;
|
g_autofree char *outbuf = NULL;
|
||||||
g_autofree char *errbuf = NULL;
|
g_autofree char *errbuf = NULL;
|
||||||
g_autofree char *stdinbuf = NULL;
|
g_autofree char *stdinbuf = NULL;
|
||||||
@ -64,18 +63,18 @@ testMdevctlCmd(virMdevctlCommand cmd_type,
|
|||||||
break;
|
break;
|
||||||
case MDEVCTL_CMD_LAST:
|
case MDEVCTL_CMD_LAST:
|
||||||
default:
|
default:
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(def = virNodeDeviceDefParseFile(mdevxml, create, VIRT_TYPE)))
|
if (!(def = virNodeDeviceDefParseFile(mdevxml, create, VIRT_TYPE)))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
/* this function will set a stdin buffer containing the json configuration
|
/* this function will set a stdin buffer containing the json configuration
|
||||||
* of the device. The json value is captured in the callback above */
|
* of the device. The json value is captured in the callback above */
|
||||||
cmd = nodeDeviceGetMdevctlCommand(def, cmd_type, &outbuf, &errbuf);
|
cmd = nodeDeviceGetMdevctlCommand(def, cmd_type, &outbuf, &errbuf);
|
||||||
|
|
||||||
if (!cmd)
|
if (!cmd)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (create)
|
if (create)
|
||||||
virCommandSetDryRun(dryRunToken, &buf, true, true,
|
virCommandSetDryRun(dryRunToken, &buf, true, true,
|
||||||
@ -84,21 +83,18 @@ testMdevctlCmd(virMdevctlCommand cmd_type,
|
|||||||
virCommandSetDryRun(dryRunToken, &buf, true, true, NULL, NULL);
|
virCommandSetDryRun(dryRunToken, &buf, true, true, NULL, NULL);
|
||||||
|
|
||||||
if (virCommandRun(cmd, NULL) < 0)
|
if (virCommandRun(cmd, NULL) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (!(actualCmdline = virBufferCurrentContent(&buf)))
|
if (!(actualCmdline = virBufferCurrentContent(&buf)))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (virTestCompareToFileFull(actualCmdline, cmdfile, false) < 0)
|
if (virTestCompareToFileFull(actualCmdline, cmdfile, false) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (create && virTestCompareToFile(stdinbuf, jsonfile) < 0)
|
if (create && virTestCompareToFile(stdinbuf, jsonfile) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user