This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hi Uli, here're new tests for aio. The second aio_cancel call fails with: Didn't expect signal from child: got `Segmentation fault' make[2]: *** [/builds/glibc/20000725-gcc-2.96.test/rt/tst-aio.out] Error 1 make[2]: Leaving directory `/usr/src/cvs/libc/rt' make[1]: *** [rt/tests] Error 2 make[1]: Leaving directory `/usr/src/cvs/libc' make: *** [check] Error 2 gromit:/builds/glibc/20000725-gcc-2.96.test:[2]$ tst-aio: aio_misc.c:578: handle_fildes_io: Assertion `runp->running == yes' failed. Could you look into my changes, please? Andreas 2000-07-26 Andreas Jaeger <aj@suse.de> * rt/tst-aio.c: Add tests for aio_fsync and aio_cancel. (do_wait): Test requests with aio_return. (do_test): Change callers of do_wait. ============================================================ Index: rt/tst-aio.c --- rt/tst-aio.c 2000/07/26 10:36:57 1.4 +++ rt/tst-aio.c 2000/07/27 06:32:29 @@ -100,13 +100,14 @@ } -void +int do_wait (struct aiocb **cbp, size_t nent) { int go_on; + size_t cnt; + do { - size_t cnt; aio_suspend ((const struct aiocb *const *) cbp, nent, NULL); go_on = 0; @@ -117,6 +118,15 @@ cbp[cnt] = NULL; } while (go_on); + + /* Now we can call aio_return to test the return status. */ + for (cnt = 0; cnt < nent; ++cnt) + if (cbp[cnt] != NULL && aio_return (cbp[cnt]) == -1) + { + error (0, errno, "Operation failed\n"); + return 1; + } + return 0; } @@ -124,7 +134,9 @@ do_test (int argc, char *argv[]) { struct aiocb cbs[10]; + struct aiocb cbs_fsync; struct aiocb *cbp[10]; + struct aiocb *cbp_fsync; char buf[1000]; size_t cnt; int result = 0; @@ -146,7 +158,7 @@ for (cnt = 10; cnt > 0; ) aio_write (cbp[--cnt]); /* Wait 'til the results are there. */ - do_wait (cbp, 10); + result |= do_wait (cbp, 10); /* Test this. */ result |= test_file (buf, sizeof (buf), fd, "aio_write"); @@ -160,7 +172,7 @@ aio_read (cbp[cnt]); } /* Wait 'til the results are there. */ - do_wait (cbp, 10); + result |= do_wait (cbp, 10); /* Test this. */ for (cnt = 0; cnt < 1000; ++cnt) if (buf[cnt] != '0' + (cnt / 100)) @@ -190,6 +202,75 @@ lio_listio (LIO_WAIT, cbp, 10, NULL); /* ...and immediately test it since we started it in wait mode. */ result |= test_file (buf, sizeof (buf), fd, "lio_listio (write)"); + + /* Test aio_fsync. */ + cbs_fsync.aio_fildes = fd; + cbs_fsync.aio_reqprio = 0; + cbp_fsync = &cbs_fsync; + + /* Remove the test file contents first. */ + if (ftruncate (fd, 0) < 0) + { + error (0, errno, "ftruncate failed\n"); + result = 1; + } + + /* Write again. */ + for (cnt = 10; cnt > 0; ) + aio_write (cbp[--cnt]); + + if (aio_fsync (O_SYNC, cbp_fsync) < 0) + { + error (0, errno, "aio_fsync failed\n"); + result = 1; + } + result |= do_wait (&cbp_fsync, 1); + + /* ...and test since all data should be on disk now. */ + result |= test_file (buf, sizeof (buf), fd, "aio_fsync (aio_write)"); + + /* Test aio_cancel. */ + /* Remove the test file contents first. */ + if (ftruncate (fd, 0) < 0) + { + error (0, errno, "ftruncate failed\n"); + result = 1; + } + + /* Write again. */ + for (cnt = 10; cnt > 0; ) + aio_write (cbp[--cnt]); + + /* Cancel all requests. */ + if (aio_cancel (fd, NULL) == -1) + { + error (0, errno, "aio_cancel (fd, NULL) failed\n"); + result = 1; + } + result |= do_wait (cbp, 10); + + /* Another test for aio_cancel. */ + /* Remove the test file contents first. */ + if (ftruncate (fd, 0) < 0) + { + error (0, errno, "ftruncate failed\n"); + result = 1; + } + + /* Write again. */ + for (cnt = 10; cnt > 0; ) + aio_write (cbp[--cnt]); + + /* Cancel all requests. */ + for (cnt = 10; cnt > 0; ) + { + if (aio_cancel (fd, cbp[--cnt]) == -1) + { + error (0, errno, "aio_cancel (fd, cbp[cnt]) failed\n"); + result = 1; + } + } + result |= do_wait (cbp, 10); return result; } -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |