Hi!

It would be nice to have a cleanup patch beforehand (static vars, 
useless comments and etc).

I think It would be better to mark somehow inside definition of struct 
test_case_t TC, that for the second test case we don't use '1' as the 
file descriptor but use one opened on later.

And one small comment below.

On 04/24/2014 02:15 PM, shuang....@oracle.com wrote:
> From: Shuang Qiu <shuang....@oracle.com>
>
> It does not make sense to use stdout as the file description to test the
> system call fstatfs().We may get unexpected result(i.e. erron38:Function
> not implemented) if redirect stdout when running ltp.
> Using ltp temporary file instead.
>
> Signed-off-by: Shuang Qiu <shuang....@oracle.com>
> ---
>   testcases/kernel/syscalls/fstatfs/fstatfs02.c |   14 ++++++++++++++
>   1 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/fstatfs/fstatfs02.c 
> b/testcases/kernel/syscalls/fstatfs/fstatfs02.c
> index cee234f..652624b 100644
> --- a/testcases/kernel/syscalls/fstatfs/fstatfs02.c
> +++ b/testcases/kernel/syscalls/fstatfs/fstatfs02.c
> @@ -47,6 +47,7 @@
>
>   #include <sys/vfs.h>
>   #include <sys/types.h>
> +#include <sys/fcntl.h>
>   #include <sys/statfs.h>
>   #include <errno.h>
>   #include "test.h"
> @@ -59,6 +60,8 @@ char *TCID = "fstatfs02";
>
>   int exp_enos[] = { EBADF, EFAULT, 0 };
>
> +char fname[255];
> +int fd;
>   struct statfs buf;
>
>   struct test_case_t {
> @@ -91,6 +94,10 @@ int main(int ac, char **av)
>
>       setup();
>
> +#ifndef UCLINUX
> +     TC[1].fd = fd;
> +#endif
> +
Maybe move it inside setup()?


>       /* set up the expected errnos */
>       TEST_EXP_ENOS(exp_enos);
>
> @@ -138,6 +145,10 @@ void setup(void)
>
>       /* make a temporary directory and cd to it */
>       tst_tmpdir();
> +
> +     sprintf(fname, "tfile_%d", getpid());
> +     if ((fd = open(fname, O_RDWR | O_CREAT, 0700)) == -1)
> +             tst_brkm(TBROK | TERRNO, cleanup, "open failed");
>   }
>
>   /*
> @@ -152,6 +163,9 @@ void cleanup(void)
>        */
>       TEST_CLEANUP;
>
> +     if (close(fd) == -1)
> +             tst_resm(TWARN | TERRNO, "close failed");
> +
>       /* delete the test directory created in setup() */
>       tst_rmdir();
>
>

------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to