[LTP] Fwd: pwrite04 ltp bug?

Cyril Hrubis chrubis@suse.cz
Mon May 23 14:39:28 CEST 2016


Hi!
> While fixing a couple of LTP regressions in the out-of-tree Orangefs
> kernel module, I think I found a problem with the pwrite04 test,
> here's what I think was meant:
> 
> # git diff testcases/kernel/syscalls/pwrite/pwrite04.c
> diff --git a/testcases/kernel/syscalls/pwrite/pwrite04.c
> b/testcases/kernel/syscalls/pwrite/pwrite04.c
> index b297682..4ca7dc1 100644
> --- a/testcases/kernel/syscalls/pwrite/pwrite04.c
> +++ b/testcases/kernel/syscalls/pwrite/pwrite04.c
> @@ -196,9 +196,9 @@ int main(int ac, char *av[])
> 
>                 }
>                 if (statbuf.st_size != K5) {
> -                       tst_resm(TFAIL, "file size is %ld != K4",
> +                       tst_resm(TFAIL, "file size is %ld != K5",
>                                  statbuf.st_size);

This is obvious typo fix.

> -
> +                       cleanup();

This does not look right. Looking at the test source the rest of the ifs
has the cleanup right after tst_resm() but the cleanup() fuction is
supposed to be called exactly once at the end of the test at the end of
the main.

If it's called in the testing loop the test will fail when cleanup() is
invoked second time at the test exit since it will attempt to remove
allready deleted test temporary directory. So the correct solution to
this problem would rather be to remove the cleanup() from the test loop.

>                 }
>                 tst_resm(TPASS, "O_APPEND test passed.");

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list