Re: [PATCH v2 3/4] selftests/resctrl: Split validate_resctrl_feature_request()

From: Reinette Chatre
Date: Wed Jan 17 2024 - 13:49:11 EST


Hi Maciej,

On 1/17/2024 1:49 AM, Maciej Wieczór-Retman wrote:
> On 2024-01-08 at 14:38:45 -0800, Reinette Chatre wrote:
>> On 12/12/2023 6:52 AM, Maciej Wieczor-Retman wrote:


>>> +
>>> + snprintf(res_path, sizeof(res_path), "%s/%s/%s", INFO_PATH, resource,
>>> + feature);
>>> +
>>> + if (stat(res_path, &statbuf))
>>> + return false;
>>
>> I think it will be more robust to look at statbuf to learn if the file type
>> is correct and the file is actually readable.
>
> Could that file be unreadable or of wrong type?

It should be readable and the correct type when all goes well. Hence the term
"more robust".

>
> Also I thought that since read_info_res_file() opens and reads that file any
> errors should be handled there. Shouldn't this part of the test only return
> whether the file is there or not since that indicates if something is supported
> in the kernel?

ok.


Reinette