Re: New features tests fails

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

 



On Tue, Aug 20, 2024 at 11:28:05 +0200, Anthony Harivel wrote:
> 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:

I meant like this:

  if (def->kvm_features->features[j] != VIR_TRISTATE_SWITCH_ABSENT) {
      virBufferAsprintf(&childBuf, "<%s state='%s'",
                        virDomainKVMTypeToString(j),
                        virTristateSwitchTypeToString(def->kvm_features->features[j]));

      virBufferEscapeString(&childBuf, " socket='%s'", def->kvm_features->socket);
      virBufferAddLit(&childBuf, "/>\n");
  }

(note also the fixed alinment)

Note that the parser should also disallow the socket path if the feature
is explicitly off.



[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