Re: New features tests fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Peter,

> 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).
>

Doh! I think it's time for me to take some PTO...

Thank you !


However, I tried my best to follow your advice using 
virBufferEscapeString() so that i can get rid of the condition on the 
socket but it fails for "feature-off". 

But this is passing the test suite:

if (def->kvm_features->features[j] != VIR_TRISTATE_SWITCH_ABSENT) {
    virBufferAsprintf(&childBuf, "<%s state='%s'", virDomainKVMTypeToString(j),
        virTristateSwitchTypeToString(def->kvm_features->features[j]));
    if (def->kvm_features->socket != NULL) {
        virBufferEscapeString(&childBuf, " socket='%s'/>\n", def->kvm_features->socket);
    } else {
         virBufferAddLit(&childBuf, "/>\n");
    }
}

Is ok if I send my patch like this or would you prefer me to dig more 
into simplifying the code ?

Regards,
Anthony




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux