On Fri, Nov 13, 2026 at 12:45:39 +0100, Jiri Denemark wrote:
> On Fri, Nov 06, 2026 at 15:52:59 +0100, Denis V. Lunev wrote:
...
> I would add a comment about the expected return values from droppable.
> Something like
> 
>     /* The @droppable callback decides what should be done with the
>      * feature called @name by returning one of the following values:
>      *    -1 on error
>      *     0 when @name should stay in the CPU definition
>      *     1 if it safe to remove @name from the CPU
>      */
> 
> > +static const struct {
> > +    const char *name;
> > +    int (*droppable)(const virCPUDef *cpu,
> > +                     virCPUx86Map *map,
> > +                     const virCPUx86Data *enabled);
> > +} x86DroppableFeatures[] = {
> > +    { "spec-ctrl", x86SpecCtrlDroppable },
> > +};
> ...
> > diff --git a/tests/cputest.c b/tests/cputest.c
> > index e29c81cb8e..35b426155e 100644
> > --- a/tests/cputest.c
> > +++ b/tests/cputest.c
> > @@ -857,6 +857,15 @@ cpuTestUpdateLive(const void *arg)
> >          !(disabledData = virCPUDataParse(disabled)))
> >          return -1;
> >  
> > +    if (data->result == -1) {
> > +        if (virCPUUpdateLive(data->arch, cpu, enabledData, disabledData) 
> > == 0) {
> > +            VIR_TEST_VERBOSE("virCPUUpdateLive succeeded unexpectedly");
> > +            return -1;
> > +        }
> > +        virResetLastError();
> > +        return 0;
> > +    }
> > +
> >      expectedFile = g_strdup_printf("cpuid-%s-json", data->host);
> >      if (!(expected = cpuTestLoadXML(data->arch, expectedFile,
> >                                      data->existingTestCases))) {
> 
> This is a minimal change, but the code looks weird as virCPUUpdateLive
> is in two places. I would drop this hunk and make a separate patch
> adding support for negative tests. I sent the patch for review.
> 
> No matter what approach we choose, I can make the required changes to
> this patch (including the additional comment) if you agree and push it
> to eliminate the need for a trivial v3.

My patch was reviewed and pushed in the meantime so I dropped this hunk,
added the suggested comment and pushed the results. Thanks.

Jirka

Reply via email to