[LTP] [PATCH v3 2/2] fanotify14: Improve check for unsupported init flags
Martin Doucha
mdoucha@suse.cz
Mon Oct 23 14:51:07 CEST 2023
On 20. 10. 23 18:05, Amir Goldstein wrote:
> On Fri, Oct 20, 2023 at 6:07 PM Martin Doucha <mdoucha@suse.cz> wrote:
>>
>> Test case 8 of fanotify14 uses init flags supported only on kernel 5.9+
>> but does not properly check for their support. Rewrite fanotify feature
>> checks using new helper function.
>>
>> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
>> ---
>>
>> Changes since v1:
>> - Added FAN_CLASS_* constants to support check in setup()
>> - Added longer patch description
>>
>> Changes since v2: None
>>
>> I'd rather not squash this patch so that it can be reverted without
>> potentially breaking other tests.
>>
>> testcases/kernel/syscalls/fanotify/fanotify14.c | 15 +++++++++------
>> 1 file changed, 9 insertions(+), 6 deletions(-)
>>
>> diff --git a/testcases/kernel/syscalls/fanotify/fanotify14.c b/testcases/kernel/syscalls/fanotify/fanotify14.c
>> index 4596511f0..0bb789188 100644
>> --- a/testcases/kernel/syscalls/fanotify/fanotify14.c
>> +++ b/testcases/kernel/syscalls/fanotify/fanotify14.c
>> @@ -45,8 +45,8 @@
>>
>> static int pipes[2] = {-1, -1};
>> static int fanotify_fd;
>> -static int fan_report_target_fid_unsupported;
>> static int ignore_mark_unsupported;
>> +static unsigned int supported_init_flags;
>>
>> struct test_case_flags_t {
>> unsigned long long flags;
>> @@ -246,9 +246,8 @@ static void do_test(unsigned int number)
>> tst_res(TINFO, "Test case %d: fanotify_init(%s, O_RDONLY)", number,
>> tc->init.desc);
>>
>> - if (fan_report_target_fid_unsupported && tc->init.flags & FAN_REPORT_TARGET_FID) {
>> - FANOTIFY_INIT_FLAGS_ERR_MSG(FAN_REPORT_TARGET_FID,
>> - fan_report_target_fid_unsupported);
>> + if (tc->init.flags & ~supported_init_flags) {
>> + tst_res(TCONF, "Unsupported init flags"
>
> suggest to preserve the information printed by
> FANOTIFY_INIT_FLAGS_ERR_MSG, you can use tc->init.desc
> the for the flag name string.
tc->init.desc gets printed by the TINFO message at the start of the
patch chunk. The return value from fanotify_init_flags_supported_on_fs()
is not preserved anywhere by the new fanotify_get_supported_init_flags()
helper function so I have nothing to pass as the second argument of
FANOTIFY_INIT_FLAGS_ERR_MSG().
--
Martin Doucha mdoucha@suse.cz
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic
More information about the ltp
mailing list