public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] fix "aio_error" test
@ 2010-09-30  5:44 Mitani
  2010-10-08  7:29 ` Bian Naimeng
  0 siblings, 1 reply; 4+ messages in thread
From: Mitani @ 2010-09-30  5:44 UTC (permalink / raw)
  To: ltp-list; +Cc: 當座 健市

[-- Attachment #1: Type: text/plain, Size: 2857 bytes --]

Hi,


"conformance/interfaces/aio_error/3-1" failed with following message:
------------
conformance/interfaces/aio_error/3-1: execution: FAILED: Output: 
aio_error/3-1.c bad aio_read return value()
------------

This testset seems to be the error root test for "aio_error()".
Therefore, "aio_error()" must be called after failure of "aio_write()", 
I think.
But, "exit()" is called when expected failure of "aio_write()" occurred:
------------(3-1.c)
        if (aio_write(&aiocb) != 0)
 {
                printf(TNAME " bad aio_read return value()\n");
                exit(PTS_FAIL);
 }
------------

I think that "exit()" must be called when "aio_write()" succeeded.

And the message of unexpected movement of "aio_write()" is 
"aio_read()"'s one.
And the indent of this program "3-1.c" seems to include both space and tab.
I want to revise them, too.


Signed-off-by: Tomonori Mitani <mitani@ryobi.co.jp>
============
---
a/testcases/open_posix_testsuite/conformance/interfaces/aio_error/3-1.c	2010
-09-22 22:31:24.000000000 +0900
+++
b/testcases/open_posix_testsuite/conformance/interfaces/aio_error/3-1.c	2010
-09-30 09:51:42.000000000 +0900
@@ -36,42 +36,41 @@
 
 int main()
 {
-
-        char tmpfname[256];
+	char tmpfname[256];
 #define BUF_SIZE 512
-        char buf[BUF_SIZE];
-        int fd;
-        struct aiocb aiocb;
+	char buf[BUF_SIZE];
+	int fd;
+	struct aiocb aiocb;
 	int ret=0;
 
 	if (sysconf(_SC_ASYNCHRONOUS_IO) != 200112L)
 		return PTS_UNSUPPORTED;
 
-        snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_error_3_1_%d",
-                  getpid());
-        unlink(tmpfname);
-        fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
-                  S_IRUSR | S_IWUSR);
-        if (fd == -1)
-        {
-                printf(TNAME " Error at open(): %s\n",
-                       strerror(errno));
-                exit(PTS_UNRESOLVED);
-        }
+	snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_error_3_1_%d",
+			 getpid());
+	unlink(tmpfname);
+	fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
+			  S_IRUSR | S_IWUSR);
+	if (fd == -1)
+	{
+		printf(TNAME " Error at open(): %s\n",
+			   strerror(errno));
+		exit(PTS_UNRESOLVED);
+	}
 
-        unlink(tmpfname);
+	unlink(tmpfname);
 
 	memset (&aiocb, 0, sizeof (struct aiocb));
 
-        aiocb.aio_fildes = fd;
-        aiocb.aio_buf = buf;
-        aiocb.aio_reqprio = -1;
-        aiocb.aio_nbytes = BUF_SIZE;
+	aiocb.aio_fildes = fd;
+	aiocb.aio_buf = buf;
+	aiocb.aio_reqprio = -1;
+	aiocb.aio_nbytes = BUF_SIZE;
 
-        if (aio_write(&aiocb) != 0)
+	if (aio_write(&aiocb) == 0)
 	{
-                printf(TNAME " bad aio_read return value()\n");
-                exit(PTS_FAIL);
+		printf(TNAME " bad aio_write return value()\n");
+		exit(PTS_FAIL);
 	}
 
 	while (aio_error (&aiocb) == EINPROGRESS);
============


Regards--

-Tomonori Mitani

[-- Attachment #2: 3-1.patch --]
[-- Type: application/octet-stream, Size: 1957 bytes --]

--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_error/3-1.c	2010-09-22 22:31:24.000000000 +0900
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_error/3-1.c	2010-09-30 09:51:42.000000000 +0900
@@ -36,42 +36,41 @@
 
 int main()
 {
-
-        char tmpfname[256];
+	char tmpfname[256];
 #define BUF_SIZE 512
-        char buf[BUF_SIZE];
-        int fd;
-        struct aiocb aiocb;
+	char buf[BUF_SIZE];
+	int fd;
+	struct aiocb aiocb;
 	int ret=0;
 
 	if (sysconf(_SC_ASYNCHRONOUS_IO) != 200112L)
 		return PTS_UNSUPPORTED;
 
-        snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_error_3_1_%d",
-                  getpid());
-        unlink(tmpfname);
-        fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
-                  S_IRUSR | S_IWUSR);
-        if (fd == -1)
-        {
-                printf(TNAME " Error at open(): %s\n",
-                       strerror(errno));
-                exit(PTS_UNRESOLVED);
-        }
+	snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_error_3_1_%d",
+			 getpid());
+	unlink(tmpfname);
+	fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
+			  S_IRUSR | S_IWUSR);
+	if (fd == -1)
+	{
+		printf(TNAME " Error at open(): %s\n",
+			   strerror(errno));
+		exit(PTS_UNRESOLVED);
+	}
 
-        unlink(tmpfname);
+	unlink(tmpfname);
 
 	memset (&aiocb, 0, sizeof (struct aiocb));
 
-        aiocb.aio_fildes = fd;
-        aiocb.aio_buf = buf;
-        aiocb.aio_reqprio = -1;
-        aiocb.aio_nbytes = BUF_SIZE;
+	aiocb.aio_fildes = fd;
+	aiocb.aio_buf = buf;
+	aiocb.aio_reqprio = -1;
+	aiocb.aio_nbytes = BUF_SIZE;
 
-        if (aio_write(&aiocb) != 0)
+	if (aio_write(&aiocb) == 0)
 	{
-                printf(TNAME " bad aio_read return value()\n");
-                exit(PTS_FAIL);
+		printf(TNAME " bad aio_write return value()\n");
+		exit(PTS_FAIL);
 	}
 
 	while (aio_error (&aiocb) == EINPROGRESS);

[-- Attachment #3: Type: text/plain, Size: 276 bytes --]

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH] fix "aio_error" test
  2010-09-30  5:44 [LTP] [PATCH] fix "aio_error" test Mitani
@ 2010-10-08  7:29 ` Bian Naimeng
  2010-10-12 20:24   ` Garrett Cooper
  0 siblings, 1 reply; 4+ messages in thread
From: Bian Naimeng @ 2010-10-08  7:29 UTC (permalink / raw)
  To: Mitani; +Cc: ltp-list, 當座 健市

> Hi,
> 
> 
> "conformance/interfaces/aio_error/3-1" failed with following message:
> ------------
> conformance/interfaces/aio_error/3-1: execution: FAILED: Output: 
> aio_error/3-1.c bad aio_read return value()
> ------------
> 
> This testset seems to be the error root test for "aio_error()".
> Therefore, "aio_error()" must be called after failure of "aio_write()", 
> I think.
> But, "exit()" is called when expected failure of "aio_write()" occurred:
> ------------(3-1.c)
>         if (aio_write(&aiocb) != 0)
>  {
>                 printf(TNAME " bad aio_read return value()\n");
>                 exit(PTS_FAIL);
>  }
> ------------
> 
> I think that "exit()" must be called when "aio_write()" succeeded.
> 

  Agree.

> And the message of unexpected movement of "aio_write()" is 
> "aio_read()"'s one.
> And the indent of this program "3-1.c" seems to include both space and tab.
> I want to revise them, too.
> 
 
  Another one should be fix like this.

	if (ret != EINVAL)
	{
-		printf(TNAME " errno is not EINVAL %s\n", strerror(errno));
+		printf(TNAME " errno is not EINVAL %s\n", strerror(ret));
		return PTS_FAIL;
	}

> 
> Signed-off-by: Tomonori Mitani <mitani@ryobi.co.jp>
> ============
> ---
> a/testcases/open_posix_testsuite/conformance/interfaces/aio_error/3-1.c	2010
> -09-22 22:31:24.000000000 +0900
> +++
> b/testcases/open_posix_testsuite/conformance/interfaces/aio_error/3-1.c	2010
> -09-30 09:51:42.000000000 +0900
> @@ -36,42 +36,41 @@
>  
>  int main()
>  {
> -
> -        char tmpfname[256];
> +	char tmpfname[256];
>  #define BUF_SIZE 512
> -        char buf[BUF_SIZE];
> -        int fd;
> -        struct aiocb aiocb;
> +	char buf[BUF_SIZE];
> +	int fd;
> +	struct aiocb aiocb;
>  	int ret=0;
>  
>  	if (sysconf(_SC_ASYNCHRONOUS_IO) != 200112L)
>  		return PTS_UNSUPPORTED;
>  
> -        snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_error_3_1_%d",
> -                  getpid());
> -        unlink(tmpfname);
> -        fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
> -                  S_IRUSR | S_IWUSR);
> -        if (fd == -1)
> -        {
> -                printf(TNAME " Error at open(): %s\n",
> -                       strerror(errno));
> -                exit(PTS_UNRESOLVED);
> -        }
> +	snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_error_3_1_%d",
> +			 getpid());
> +	unlink(tmpfname);
> +	fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
> +			  S_IRUSR | S_IWUSR);
> +	if (fd == -1)
> +	{
> +		printf(TNAME " Error at open(): %s\n",
> +			   strerror(errno));
> +		exit(PTS_UNRESOLVED);
> +	}
>  
> -        unlink(tmpfname);
> +	unlink(tmpfname);
>  
>  	memset (&aiocb, 0, sizeof (struct aiocb));
>  
> -        aiocb.aio_fildes = fd;
> -        aiocb.aio_buf = buf;
> -        aiocb.aio_reqprio = -1;
> -        aiocb.aio_nbytes = BUF_SIZE;
> +	aiocb.aio_fildes = fd;
> +	aiocb.aio_buf = buf;
> +	aiocb.aio_reqprio = -1;
> +	aiocb.aio_nbytes = BUF_SIZE;
>  
> -        if (aio_write(&aiocb) != 0)
> +	if (aio_write(&aiocb) == 0)
>  	{
> -                printf(TNAME " bad aio_read return value()\n");
> -                exit(PTS_FAIL);
> +		printf(TNAME " bad aio_write return value()\n");
> +		exit(PTS_FAIL);
>  	}
>  
>  	while (aio_error (&aiocb) == EINPROGRESS);
> ============
> 
> 
> Regards--
> 
> -Tomonori Mitani
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list

-- 
Regards
Bian Naimeng


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH] fix "aio_error" test
  2010-10-08  7:29 ` Bian Naimeng
@ 2010-10-12 20:24   ` Garrett Cooper
  2010-10-13  1:00     ` Mitani
  0 siblings, 1 reply; 4+ messages in thread
From: Garrett Cooper @ 2010-10-12 20:24 UTC (permalink / raw)
  To: Bian Naimeng; +Cc: ltp-list, 當座 健市, Mitani

2010/10/8 Bian Naimeng <biannm@cn.fujitsu.com>:
>> Hi,
>>
>>
>> "conformance/interfaces/aio_error/3-1" failed with following message:
>> ------------
>> conformance/interfaces/aio_error/3-1: execution: FAILED: Output:
>> aio_error/3-1.c bad aio_read return value()
>> ------------
>>
>> This testset seems to be the error root test for "aio_error()".
>> Therefore, "aio_error()" must be called after failure of "aio_write()",
>> I think.
>> But, "exit()" is called when expected failure of "aio_write()" occurred:
>> ------------(3-1.c)
>>         if (aio_write(&aiocb) != 0)
>>  {
>>                 printf(TNAME " bad aio_read return value()\n");
>>                 exit(PTS_FAIL);
>>  }
>> ------------
>>
>> I think that "exit()" must be called when "aio_write()" succeeded.
>>
>
>  Agree.
>
>> And the message of unexpected movement of "aio_write()" is
>> "aio_read()"'s one.
>> And the indent of this program "3-1.c" seems to include both space and tab.
>> I want to revise them, too.
>>
>
>  Another one should be fix like this.
>
>        if (ret != EINVAL)
>        {
> -               printf(TNAME " errno is not EINVAL %s\n", strerror(errno));
> +               printf(TNAME " errno is not EINVAL %s\n", strerror(ret));
>                return PTS_FAIL;
>        }
>
>>
>> Signed-off-by: Tomonori Mitani <mitani@ryobi.co.jp>
>> ============
>> ---
>> a/testcases/open_posix_testsuite/conformance/interfaces/aio_error/3-1.c       2010
>> -09-22 22:31:24.000000000 +0900
>> +++
>> b/testcases/open_posix_testsuite/conformance/interfaces/aio_error/3-1.c       2010
>> -09-30 09:51:42.000000000 +0900
>> @@ -36,42 +36,41 @@
>>
>>  int main()
>>  {
>> -
>> -        char tmpfname[256];
>> +     char tmpfname[256];
>>  #define BUF_SIZE 512
>> -        char buf[BUF_SIZE];
>> -        int fd;
>> -        struct aiocb aiocb;
>> +     char buf[BUF_SIZE];
>> +     int fd;
>> +     struct aiocb aiocb;
>>       int ret=0;
>>
>>       if (sysconf(_SC_ASYNCHRONOUS_IO) != 200112L)
>>               return PTS_UNSUPPORTED;
>>
>> -        snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_error_3_1_%d",
>> -                  getpid());
>> -        unlink(tmpfname);
>> -        fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
>> -                  S_IRUSR | S_IWUSR);
>> -        if (fd == -1)
>> -        {
>> -                printf(TNAME " Error at open(): %s\n",
>> -                       strerror(errno));
>> -                exit(PTS_UNRESOLVED);
>> -        }
>> +     snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_error_3_1_%d",
>> +                      getpid());
>> +     unlink(tmpfname);
>> +     fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
>> +                       S_IRUSR | S_IWUSR);
>> +     if (fd == -1)
>> +     {
>> +             printf(TNAME " Error at open(): %s\n",
>> +                        strerror(errno));
>> +             exit(PTS_UNRESOLVED);
>> +     }
>>
>> -        unlink(tmpfname);
>> +     unlink(tmpfname);
>>
>>       memset (&aiocb, 0, sizeof (struct aiocb));
>>
>> -        aiocb.aio_fildes = fd;
>> -        aiocb.aio_buf = buf;
>> -        aiocb.aio_reqprio = -1;
>> -        aiocb.aio_nbytes = BUF_SIZE;
>> +     aiocb.aio_fildes = fd;
>> +     aiocb.aio_buf = buf;
>> +     aiocb.aio_reqprio = -1;
>> +     aiocb.aio_nbytes = BUF_SIZE;
>>
>> -        if (aio_write(&aiocb) != 0)
>> +     if (aio_write(&aiocb) == 0)
>>       {
>> -                printf(TNAME " bad aio_read return value()\n");
>> -                exit(PTS_FAIL);
>> +             printf(TNAME " bad aio_write return value()\n");
>> +             exit(PTS_FAIL);
>>       }
>>
>>       while (aio_error (&aiocb) == EINPROGRESS);

    I'll respond to this sometime in the next couple of days after I
do some more investigation on the issue.
Thanks,
-Garrett

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH] fix "aio_error" test
  2010-10-12 20:24   ` Garrett Cooper
@ 2010-10-13  1:00     ` Mitani
  0 siblings, 0 replies; 4+ messages in thread
From: Mitani @ 2010-10-13  1:00 UTC (permalink / raw)
  To: 'Garrett Cooper'; +Cc: ltp-list, 當座 健市

[-- Attachment #1: Type: text/plain, Size: 7774 bytes --]

> -----Original Message-----
> From: Garrett Cooper [mailto:yanegomi@gmail.com]
> Sent: Wednesday, October 13, 2010 5:24 AM
> To: Bian Naimeng
> Cc: Mitani; ltp-list@lists.sourceforge.net; 當座 健市
> Subject: Re: [LTP] [PATCH] fix "aio_error" test
> 
> 2010/10/8 Bian Naimeng <biannm@cn.fujitsu.com>:
> >> Hi,
> >>
> >>
> >> "conformance/interfaces/aio_error/3-1" failed with following
> message:
> >> ------------
> >> conformance/interfaces/aio_error/3-1: execution: FAILED: Output:
> >> aio_error/3-1.c bad aio_read return value()
> >> ------------
> >>
> >> This testset seems to be the error root test for "aio_error()".
> >> Therefore, "aio_error()" must be called after failure of
> "aio_write()",
> >> I think.
> >> But, "exit()" is called when expected failure of "aio_write()"
> occurred:
> >> ------------(3-1.c)
> >>         if (aio_write(&aiocb) != 0)
> >>  {
> >>                 printf(TNAME " bad aio_read return value()\n");
> >>                 exit(PTS_FAIL);
> >>  }
> >> ------------
> >>
> >> I think that "exit()" must be called when "aio_write()" succeeded.
> >>
> >
> >  Agree.
> >
> >> And the message of unexpected movement of "aio_write()" is
> >> "aio_read()"'s one.
> >> And the indent of this program "3-1.c" seems to include both space
> and tab.
> >> I want to revise them, too.
> >>
> >
> >  Another one should be fix like this.
> >
> >        if (ret != EINVAL)
> >        {
> > -               printf(TNAME " errno is not EINVAL %s\n",
> strerror(errno));
> > +               printf(TNAME " errno is not EINVAL %s\n",
> strerror(ret));
> >                return PTS_FAIL;
> >        }
> >
> >>
> >> Signed-off-by: Tomonori Mitani <mitani@ryobi.co.jp>
> >> ============
> >> ---
> >>
> a/testcases/open_posix_testsuite/conformance/interfaces/aio_error/
> 3-1.c       2010
> >> -09-22 22:31:24.000000000 +0900
> >> +++
> >>
> b/testcases/open_posix_testsuite/conformance/interfaces/aio_error/
> 3-1.c       2010
> >> -09-30 09:51:42.000000000 +0900
> >> @@ -36,42 +36,41 @@
> >>
> >>  int main()
> >>  {
> >> -
> >> -        char tmpfname[256];
> >> +     char tmpfname[256];
> >>  #define BUF_SIZE 512
> >> -        char buf[BUF_SIZE];
> >> -        int fd;
> >> -        struct aiocb aiocb;
> >> +     char buf[BUF_SIZE];
> >> +     int fd;
> >> +     struct aiocb aiocb;
> >>       int ret=0;
> >>
> >>       if (sysconf(_SC_ASYNCHRONOUS_IO) != 200112L)
> >>               return PTS_UNSUPPORTED;
> >>
> >> -        snprintf(tmpfname, sizeof(tmpfname),
> "/tmp/pts_aio_error_3_1_%d",
> >> -                  getpid());
> >> -        unlink(tmpfname);
> >> -        fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
> >> -                  S_IRUSR | S_IWUSR);
> >> -        if (fd == -1)
> >> -        {
> >> -                printf(TNAME " Error at open(): %s\n",
> >> -                       strerror(errno));
> >> -                exit(PTS_UNRESOLVED);
> >> -        }
> >> +     snprintf(tmpfname, sizeof(tmpfname),
> "/tmp/pts_aio_error_3_1_%d",
> >> +                      getpid());
> >> +     unlink(tmpfname);
> >> +     fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
> >> +                       S_IRUSR | S_IWUSR);
> >> +     if (fd == -1)
> >> +     {
> >> +             printf(TNAME " Error at open(): %s\n",
> >> +                        strerror(errno));
> >> +             exit(PTS_UNRESOLVED);
> >> +     }
> >>
> >> -        unlink(tmpfname);
> >> +     unlink(tmpfname);
> >>
> >>       memset (&aiocb, 0, sizeof (struct aiocb));
> >>
> >> -        aiocb.aio_fildes = fd;
> >> -        aiocb.aio_buf = buf;
> >> -        aiocb.aio_reqprio = -1;
> >> -        aiocb.aio_nbytes = BUF_SIZE;
> >> +     aiocb.aio_fildes = fd;
> >> +     aiocb.aio_buf = buf;
> >> +     aiocb.aio_reqprio = -1;
> >> +     aiocb.aio_nbytes = BUF_SIZE;
> >>
> >> -        if (aio_write(&aiocb) != 0)
> >> +     if (aio_write(&aiocb) == 0)
> >>       {
> >> -                printf(TNAME " bad aio_read return value()\n");
> >> -                exit(PTS_FAIL);
> >> +             printf(TNAME " bad aio_write return value()\n");
> >> +             exit(PTS_FAIL);
> >>       }
> >>
> >>       while (aio_error (&aiocb) == EINPROGRESS);
> 
>     I'll respond to this sometime in the next couple of days after I
> do some more investigation on the issue.
> Thanks,
> -Garrett


Hi,

I added Bian's following opinion to patch:
------------
  Another one should be fix like this.

	if (ret != EINVAL)
	{
-		printf(TNAME " errno is not EINVAL %s\n", strerror(errno));
+		printf(TNAME " errno is not EINVAL %s\n", strerror(ret));
		return PTS_FAIL;
	}
------------

And I added following two modifications.

 - Closing the file descriptor when exit.

 - Clear "errno".
   The first "unlink()" fails because the file doesn't exist.
   After that, ENOENT is set to "errno" and kept intact.
   I revised to clear "errno".

I noticed that there were similar problems in the other "aio-..." test programs.
But I cannot judge whether other test programs must be revised.
I revise only "aio_error/3-1". 


Signed-off-by: Tomonori Mitani <mitani@ryobi.co.jp>
============
--- testcases/open_posix_testsuite/conformance/interfaces/aio_error/3-1.c	2010-10-03 09:53:52.000000000 +0900
+++ testcases/open_posix_testsuite/conformance/interfaces/aio_error/3-1.new	2010-10-13 09:30:12.000000000 +0900
@@ -36,42 +36,43 @@
 
 int main()
 {
-
-        char tmpfname[256];
+	char tmpfname[256];
 #define BUF_SIZE 512
-        char buf[BUF_SIZE];
-        int fd;
-        struct aiocb aiocb;
+	char buf[BUF_SIZE];
+	int fd;
+	struct aiocb aiocb;
 	int ret=0;
 
 	if (sysconf(_SC_ASYNCHRONOUS_IO) != 200112L)
 		return PTS_UNSUPPORTED;
 
-        snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_error_3_1_%d",
-                  getpid());
-        unlink(tmpfname);
-        fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
-                  S_IRUSR | S_IWUSR);
-        if (fd == -1)
-        {
-                printf(TNAME " Error at open(): %s\n",
-                       strerror(errno));
-                exit(PTS_UNRESOLVED);
-        }
+	snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_error_3_1_%d",
+			 getpid());
+	unlink(tmpfname);
+	errno = 0;
+	fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
+			  S_IRUSR | S_IWUSR);
+	if (fd == -1)
+	{
+		printf(TNAME " Error at open(): %s\n",
+			   strerror(errno));
+		exit(PTS_UNRESOLVED);
+	}
 
-        unlink(tmpfname);
+	unlink(tmpfname);
 
 	memset (&aiocb, 0, sizeof (struct aiocb));
 
-        aiocb.aio_fildes = fd;
-        aiocb.aio_buf = buf;
-        aiocb.aio_reqprio = -1;
-        aiocb.aio_nbytes = BUF_SIZE;
+	aiocb.aio_fildes = fd;
+	aiocb.aio_buf = buf;
+	aiocb.aio_reqprio = -1;
+	aiocb.aio_nbytes = BUF_SIZE;
 
-        if (aio_write(&aiocb) != 0)
+	if (aio_write(&aiocb) == 0)
 	{
-                printf(TNAME " bad aio_read return value()\n");
-                exit(PTS_FAIL);
+		close(fd);
+		printf(TNAME " bad aio_write return value()\n");
+		exit(PTS_FAIL);
 	}
 
 	while (aio_error (&aiocb) == EINPROGRESS);
@@ -79,7 +80,8 @@
 
 	if (ret != EINVAL)
 	{
-		printf(TNAME " errno is not EINVAL %s\n", strerror(errno));
+		close(fd);
+		printf(TNAME " errno is not EINVAL %s\n", strerror(ret));
 		return PTS_FAIL;
 	}
 
============


Regards--

-Tomonori Mitani

[-- Attachment #2: 3-1.patch --]
[-- Type: application/octet-stream, Size: 2203 bytes --]

--- testcases/open_posix_testsuite/conformance/interfaces/aio_error/3-1.c	2010-10-03 09:53:52.000000000 +0900
+++ testcases/open_posix_testsuite/conformance/interfaces/aio_error/3-1.new	2010-10-13 09:30:12.000000000 +0900
@@ -36,42 +36,43 @@
 
 int main()
 {
-
-        char tmpfname[256];
+	char tmpfname[256];
 #define BUF_SIZE 512
-        char buf[BUF_SIZE];
-        int fd;
-        struct aiocb aiocb;
+	char buf[BUF_SIZE];
+	int fd;
+	struct aiocb aiocb;
 	int ret=0;
 
 	if (sysconf(_SC_ASYNCHRONOUS_IO) != 200112L)
 		return PTS_UNSUPPORTED;
 
-        snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_error_3_1_%d",
-                  getpid());
-        unlink(tmpfname);
-        fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
-                  S_IRUSR | S_IWUSR);
-        if (fd == -1)
-        {
-                printf(TNAME " Error at open(): %s\n",
-                       strerror(errno));
-                exit(PTS_UNRESOLVED);
-        }
+	snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_error_3_1_%d",
+			 getpid());
+	unlink(tmpfname);
+	errno = 0;
+	fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL,
+			  S_IRUSR | S_IWUSR);
+	if (fd == -1)
+	{
+		printf(TNAME " Error at open(): %s\n",
+			   strerror(errno));
+		exit(PTS_UNRESOLVED);
+	}
 
-        unlink(tmpfname);
+	unlink(tmpfname);
 
 	memset (&aiocb, 0, sizeof (struct aiocb));
 
-        aiocb.aio_fildes = fd;
-        aiocb.aio_buf = buf;
-        aiocb.aio_reqprio = -1;
-        aiocb.aio_nbytes = BUF_SIZE;
+	aiocb.aio_fildes = fd;
+	aiocb.aio_buf = buf;
+	aiocb.aio_reqprio = -1;
+	aiocb.aio_nbytes = BUF_SIZE;
 
-        if (aio_write(&aiocb) != 0)
+	if (aio_write(&aiocb) == 0)
 	{
-                printf(TNAME " bad aio_read return value()\n");
-                exit(PTS_FAIL);
+		close(fd);
+		printf(TNAME " bad aio_write return value()\n");
+		exit(PTS_FAIL);
 	}
 
 	while (aio_error (&aiocb) == EINPROGRESS);
@@ -79,7 +80,8 @@
 
 	if (ret != EINVAL)
 	{
-		printf(TNAME " errno is not EINVAL %s\n", strerror(errno));
+		close(fd);
+		printf(TNAME " errno is not EINVAL %s\n", strerror(ret));
 		return PTS_FAIL;
 	}
 

[-- Attachment #3: Type: text/plain, Size: 369 bytes --]

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-10-13  1:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-30  5:44 [LTP] [PATCH] fix "aio_error" test Mitani
2010-10-08  7:29 ` Bian Naimeng
2010-10-12 20:24   ` Garrett Cooper
2010-10-13  1:00     ` Mitani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox