mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
tests: qemuxml2xml: Avoid crash when processing an XML that fails to parse
Failure to parse a XML that was not supposed to fail would result into a crash in the test suite as the vcpu bitmap would not be filled prior to the active XML->XML test. Skip formatting of the vcpu snippet in the fake status XML formatter in such case to avoid the crash. The test would fail anyways.
This commit is contained in:
parent
fc0378a973
commit
c934f1e0fd
@ -112,9 +112,12 @@ testGetStatuXMLPrefixVcpus(virBufferPtr buf,
|
||||
virBufferAddLit(buf, "<vcpus>\n");
|
||||
virBufferAdjustIndent(buf, 2);
|
||||
|
||||
while ((vcpuid = virBitmapNextSetBit(data->activeVcpus, vcpuid)) >= 0)
|
||||
virBufferAsprintf(buf, "<vcpu id='%zd' pid='%zd'/>\n",
|
||||
vcpuid, vcpuid + 3803519);
|
||||
/* Make sure we can format the fake vcpu list. The test will fail regardles. */
|
||||
if (data->activeVcpus) {
|
||||
while ((vcpuid = virBitmapNextSetBit(data->activeVcpus, vcpuid)) >= 0)
|
||||
virBufferAsprintf(buf, "<vcpu id='%zd' pid='%zd'/>\n",
|
||||
vcpuid, vcpuid + 3803519);
|
||||
}
|
||||
|
||||
virBufferAdjustIndent(buf, -2);
|
||||
virBufferAddLit(buf, "</vcpus>\n");
|
||||
|
Loading…
Reference in New Issue
Block a user