Re: [LTP] [PATCH v2 7/7] Add ioctl_ficlone04 test

Andrea Cervesato via ltp
2024-07-24T19:37:19Z

On 7/24/24 17:42, Cyril Hrubis wrote:
> Hi!
>> + switch (fd_src->type) {
>> + case TST_FD_DEV_ZERO:
>> + case TST_FD_PROC_MAPS:
>> + case TST_FD_PIPE_READ:
>> + case TST_FD_PIPE_WRITE:
>> + case TST_FD_UNIX_SOCK:
>> + case TST_FD_INET_SOCK:
>> + case TST_FD_EPOLL:
>> + case TST_FD_EVENTFD:
>> + case TST_FD_SIGNALFD:
>> + case TST_FD_TIMERFD:
>> + case TST_FD_PIDFD:
>> + case TST_FD_FANOTIFY:
>> + case TST_FD_INOTIFY:
>> + case TST_FD_USERFAULTFD:
>> + case TST_FD_PERF_EVENT:
>> + case TST_FD_IO_URING:
>> + case TST_FD_BPF_MAP:
>> + case TST_FD_FSOPEN:
>> + case TST_FD_FSPICK:
>> + case TST_FD_OPEN_TREE:
>> + case TST_FD_MEMFD:
>> + case TST_FD_MEMFD_SECRET:
>> + return;
>> + default:
>> + break;
>> + }
> Why do we skip all these cases?
>
I can't understand what's the best way to test all the combinations. As
you can see there are many flags, which means the amount of permutations
is big.
Most of those flags are handled (indeed) in the wrong way, since most of
their permutations return EXDEV. The point is that the syscall has many
error codes, so it's complex to write a code that covers all possible
results.

My idea would be to have an array of errors to give to
TST_EXP_FAIL2_ARR() and to avoid any statement around fd_src/fd_dst,
because the amount of if/switch-case might explode with the number of
permutations.

Andrea