Re: [LTP] [PATCH v3] syscalls/fallocate04: add new fallocate() test

Alexey Kodanev
2015-04-20T13:36:43Z

Hi!
On 04/20/2015 12:36 PM, Jan Stancek wrote:
>
>
> ----- Original Message -----
>> From: "Alexey Kodanev" <alexey.kodanev@oracle.com>
>> To: ltp-list@lists.sourceforge.net
>> Cc: "vasily isaenko" <vasily.isaenko@oracle.com>
>> Sent: Wednesday, 15 April, 2015 11:04:16 AM
>> Subject: [LTP] [PATCH v3] syscalls/fallocate04: add new fallocate() test
>>
>> This is a new functional test of fallocate() syscall with the focus on
>> FALLOC_FL_ZERO_RANGE (since Linux 3.14) and FALLOC_FL_COLLAPSE_RANGE
>> (since Linux 3.15) modes.
> Hi,
>
> https://git.kernel.org/cgit/docs/man-pages/man-pages.git/tree/man2/fallocate.2
> says both are supported since 3.15.

Right, the fallocate man page was fixed yesterday... I've read the one
with 3.14 :)

>> Steps of test-cases:
>> * allocate a file with specified size;
>> * make a hole in the middle of the file with FALLOC_FL_PUNCH_HOLE;
>> * fill the hole and adjacent space with FALLOC_FL_ZERO_RANGE;
>> * remove a block from a file with FALLOC_FL_COLLAPSE_RANGE
>>
>> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
>> ---
>> v3: correctly indented second line in if blocks and tst_resm
>> v2: replaced lseek, read, write, etc. with LTP safe macros
>> moved FALLOC_FL_* macros to fallocate.h
>> removed FALLOC_FL_KEEP_SIZE from fallocate03 (it is now in fallocate.h)
>> made one more test-case (split setup())
>>
>> runtest/syscalls | 1 +
>> testcases/kernel/syscalls/.gitignore | 1 +
>> testcases/kernel/syscalls/fallocate/fallocate.h | 20 ++
>> testcases/kernel/syscalls/fallocate/fallocate03.c | 1 -
>> testcases/kernel/syscalls/fallocate/fallocate04.c | 278
>> +++++++++++++++++++++
>> 5 files changed, 300 insertions(+), 1 deletions(-)
>> create mode 100644 testcases/kernel/syscalls/fallocate/fallocate04.c
> I get a TFAIL on older kernel:
> # ./fallocate04
> fallocate04 0 TINFO : allocate '12288' bytes
> fallocate04 1 TFAIL : fallocate04.c:123: fallocate() failed: errno=EOPNOTSUPP(95): Operation not supported
> looking at fallocate01, it checks both ENOSYS and EOPNOTSUPP, when call fails.

OK, I'll check for EOPNOTSUPP errno as well.

> The rest looks good to me, my only nit is that tests depend on each
> other (state of the file), but it's not hard to follow.

Thanks,
Alexey