All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
To: shuang.qiu@oracle.com, ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] syscalls/fstatfs:using temporary file description to test the system call
Date: Fri, 25 Apr 2014 14:55:11 +0400	[thread overview]
Message-ID: <535A3F0F.7030404@oracle.com> (raw)
In-Reply-To: <1398334546-5820-1-git-send-email-shuang.qiu@oracle.com>

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.qiu@oracle.com wrote:
> From: Shuang Qiu <shuang.qiu@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.qiu@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	other threads:[~2014-04-25 10:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-24 10:15 [LTP] [PATCH] syscalls/fstatfs:using temporary file description to test the system call shuang.qiu
2014-04-25 10:55 ` Stanislav Kholmanskikh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=535A3F0F.7030404@oracle.com \
    --to=stanislav.kholmanskikh@oracle.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=shuang.qiu@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.