On Mon, Aug 19, 2024 at 12:00:56 +0200, Anthony Harivel wrote: > Hi, > > I'm trying to implement the libvirt part of a new feature that has > landed in QEMU staging [1]. > The current draft of this implementations is the following [2]. > It compiles on top of master. > But when I want to run the tests suites, I hit an issue I don't managed > to find the problem. > > It runs until: > [...] > 278/279 libvirt:bin / qemuxmlconftest FAIL 8.63s exit status 1 > [...] > > then it tells me to run the following to understand the issue: > VIR_TEST_DEBUG=1 VIR_TEST_RANGE=850-851,854-855 /home/aharivel/work/libvirt/build/tests/qemuxmlconftest > > It outputs this: > [...] > 850) QEMU XML def -> XML kvm-features.x86_64-latest ... > In '/home/aharivel/work/libvirt/tests/qemuxmlconfdata/kvm-features.x86_64-latest.xml': > Offset 533 > Expect [ socket='/run/qemu-vmsr-helper.sock'/] > Actual [/] These test cases parse an XML and format it back. You've got a bug in the code formatting the socket into the XML: if (def->kvm_features->socket == NULL) { virBufferAsprintf(&childBuf, " socket='%s'/>\n", def->kvm_features->socket); } else { virBufferAddLit(&childBuf, "/>\n"); } The above hunk formats the socket only if it's NULL, and skips it if it's non-null (inverted condition). > 851) QEMU XML OUT -> XML kvm-features.x86_64-latest ... > In '/home/aharivel/work/libvirt/tests/qemuxmlconfdata/kvm-features.x86_64-latest.xml': > Offset 533 > Expect [ socket='/run/qemu-vmsr-helper.sock'/] > Actual [/] So it's missing in the output file when you provide it in the input file. > ... FAILED > 854) QEMU XML def -> XML kvm-features-off.x86_64-latest ... > In '/home/aharivel/work/libvirt/tests/qemuxmlconfdata/kvm-features-off.x86_64-latest.xml': > Offset 527 > Expect [/] > Actual [ socket='(null)'/] And formats it when it's NULL. > ... FAILED > 855) QEMU XML OUT -> XML kvm-features-off.x86_64-latest ... > In '/home/aharivel/work/libvirt/tests/qemuxmlconfdata/kvm-features-off.x86_64-latest.xml': > Offset 527 > Expect [/] > Actual [ socket='(null)'/] > [...] ... FAILED