All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] aio_return: Remove cases and refactor 4-1.c
Date: Wed, 25 Mar 2020 17:26:45 +0800	[thread overview]
Message-ID: <3329abd9-38f8-1268-d288-a9f874959e01@cn.fujitsu.com> (raw)
In-Reply-To: <1585127864-1341-1-git-send-email-xuyang2018.jy@cn.fujitsu.com>

Hi


>  From aio_return(3) manpage, the aio_return() function returns the
> final return status for the asynchronous I/O request with control
> block pointed to by aiocbp. It should be called only once for any
> given request. If we want to call twice for same aiocbp, it only
> returns the last value. It doesn't make sense. So remove 2-1.c and
> 3-2.c.
> 
> For 4-1.c, it failed with the same reason. But we can refactor this
> , firstly call aio_return(&aiocb2) and then call aio_return(&aiocb).
> It tests whether value override.
> 
> Reported-by: Gang Liu <liug.fnst@cn.fujitsu.com>
> Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> ---
>   .../conformance/interfaces/aio_return/2-1.c   | 108 -----------------
>   .../conformance/interfaces/aio_return/3-2.c   | 111 ------------------
>   .../conformance/interfaces/aio_return/4-1.c   |  23 +++-
>   3 files changed, 18 insertions(+), 224 deletions(-)
>   delete mode 100644 testcases/open_posix_testsuite/conformance/interfaces/aio_return/2-1.c
>   delete mode 100644 testcases/open_posix_testsuite/conformance/interfaces/aio_return/3-2.c
> 
> 
> diff --git a/testcases/open_posix_testsuite/conformance/interfaces/aio_return/4-1.c b/testcases/open_posix_testsuite/conformance/interfaces/aio_return/4-1.c
> index 7a039b13f..770699b54 100644
> --- a/testcases/open_posix_testsuite/conformance/interfaces/aio_return/4-1.c
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_return/4-1.c
> @@ -17,8 +17,10 @@
>    *
>    *	- Open a file
>    *	- fill in an aiocb for writing
> - *	- call aio_write usign this aiocb
> + *	- call aio_write using this aiocb
>    *	- fill in a new aiocb
> + *	- call aio_write using this aiocb
> + *	- call aio_return with aiocb
>    *	- call aio_return with this last aiocb
>    */
>   
> @@ -86,20 +88,31 @@ int main(void)
>   		aiocb2.aio_fildes = fd;
>   		aiocb2.aio_buf = buf;
>   		aiocb2.aio_nbytes = BUF_SIZE;
> +		if (aio_write(&aiocb2) == -1) {
> +			close(fd);
> +			printf(TNAME " Error at aio_write(): %s\n", strerror(errno));
> +			return PTS_FAIL;
> +		}
> +
> +		do {
> +			nanosleep(&completion_wait_ts, NULL);
> +			retval = aio_error(&aiocb);
Here should be aio_error(&aiocb2). Sorry.
> +		} while (retval == EINPROGRESS);
>   
>   		retval = aio_return(&aiocb2);
>   
> -		if (retval != -1 || aio_error(&aiocb) != EINVAL) {
> +		if (retval != BUF_SIZE) {
>   			close(fd);
> -			printf(TNAME "aio_return() have not failed\n");
> -			return PTS_UNTESTED;
> +			printf(TNAME " Error at aio_return(&aiocb2): %d, %s\n", retval,
> +				strerror(aio_error(&aiocb)));
Here as well.
> +			return PTS_UNRESOLVED;
>   		}
>   
>   		retval = aio_return(&aiocb);
>   
>   		if (retval != BUF_SIZE) {
>   			close(fd);
> -			printf(TNAME " Error at aio_return(): %d, %s\n", retval,
> +			printf(TNAME " Error at aio_return(&aiocb): %d, %s\n", retval,
>   			       strerror(aio_error(&aiocb)));
>   			return PTS_UNRESOLVED;
>   		}
> 



  reply	other threads:[~2020-03-25  9:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-25  9:17 [LTP] [PATCH] aio_return: Remove cases and refactor 4-1.c Yang Xu
2020-03-25  9:26 ` Yang Xu [this message]
2020-03-25 13:40 ` Cyril Hrubis
2020-03-26  7:15   ` Yang Xu

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=3329abd9-38f8-1268-d288-a9f874959e01@cn.fujitsu.com \
    --to=xuyang2018.jy@cn.fujitsu.com \
    --cc=ltp@lists.linux.it \
    /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.