The same issue as:
    commit 352358cd9f69f6e8296cc201b14bae938287796e
    Author: Jan Stancek <[email protected]>
    Date: Mon, 28 Jan 2013 11:36:48 +0100
    aio_fsync/2-1.c: fix race at exit, check if write completed
This patch waits for aio_fsync to complete and after that
checks that previously queued write is also completed.

Signed-off-by: Yan Lei <[email protected]>

diff --git 
a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/3-1.c 
b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/3-1.c
index f30f472..6f0098d 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/3-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/3-1.c
@@ -27,7 +27,7 @@ int main()
 {
        char tmpfname[256];
        char buf[BUF_SIZE];
-       int fd;
+       int fd, ret;
        struct aiocb aiocb_write;
        struct aiocb aiocb_fsync;
 
@@ -62,10 +62,28 @@ int main()
                printf(TNAME " Error at aio_fsync(): %s\n", strerror(errno));
                exit(PTS_FAIL);
        }
+       /* wait for aio_fsync */
+       do {
+               usleep(10000);
+               ret = aio_error(&aiocb_fsync);
+       } while (ret == EINPROGRESS);
 
-       close(fd);
+       ret = aio_return(&aiocb_fsync);
+       if (ret) {
+               printf(TNAME " Error at aio_return(): %d (%s)\n",
+                       ret, strerror(errno));
+               close(fd);
+               return PTS_FAIL;
+       }
 
-       /* we didn't check if the operation is really performed */
+       /* check that aio_write is completed at this point */
+       ret = aio_error(&aiocb_write);
+       if (ret == EINPROGRESS) {
+               printf(TNAME " aiocb_write still in progress\n");
+               close(fd);
+               return PTS_FAIL;
+       }
 
-       return PTS_UNTESTED;
+       close(fd);
+       return PTS_PASS;
 }
-- 
1.8.1.rc3.11.g86c3e6e


------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to