[libvirt] [PATCH 14/23] cputest: Separate QEMUCaps creation from cpuTestCPUIDJson

John Ferlan jferlan at redhat.com
Fri Oct 13 18:56:17 UTC 2017



On 10/13/2017 01:27 PM, Jiri Denemark wrote:
> On Thu, Oct 12, 2017 at 17:20:06 -0400, John Ferlan wrote:
>>
>>
>> On 10/04/2017 10:58 AM, Jiri Denemark wrote:
>>> To make the code reusable by other tests.
>>>
>>> Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
>>> ---
>>>  tests/cputest.c | 97 +++++++++++++++++++++++++++++++++++----------------------
>>>  1 file changed, 60 insertions(+), 37 deletions(-)
>>>
>>> diff --git a/tests/cputest.c b/tests/cputest.c
>>> index 0a07a2da14..b72c17a168 100644
>>> --- a/tests/cputest.c
>>> +++ b/tests/cputest.c
>>> @@ -460,6 +460,64 @@ cpuTestHasFeature(const void *arg)
>>>  }
>>>  
>>>  
>>> +typedef enum {
>>> +    JSON_NONE,
>>> +    JSON_HOST,
>>> +    JSON_MODELS,
>>> +} cpuTestCPUIDJson;
>>> +
>>> +#if WITH_QEMU && WITH_YAJL
>>> +static virQEMUCapsPtr
>>> +cpuTestMakeQEMUCaps(const struct data *data)
>>> +{
>>> +    virQEMUCapsPtr qemuCaps = NULL;
>>> +    qemuMonitorTestPtr testMon = NULL;
>>> +    qemuMonitorCPUModelInfoPtr model = NULL;
>>> +    char *json = NULL;
>>> +
>>> +    if (virAsprintf(&json, "%s/cputestdata/%s-cpuid-%s.json",
>>> +                    abs_srcdir, virArchToString(data->arch), data->host) < 0)
>>> +        goto error;
>>
>> could be cleanup;
> 
> Yeah, but since we have the "error" label and we are jumping in case of
> error I think it's slightly better to keep it as is. And it's less
> fragile when someone comes and shuffles the code around. I don't really
> mind either way, though.
> 
> Jirka
> 

Fair enough - leave it it as is. It wasn't that important.

John




More information about the libvir-list mailing list