svn commit: r306962 - head/tests/sys/kern/pipe
Ruslan Bukin
ruslan.bukin at cl.cam.ac.uk
Mon Oct 10 16:50:54 UTC 2016
There is some direct mode activated when you send >=8192,
so this line is required
Ruslan
On Mon, Oct 10, 2016 at 08:04:44AM -0700, Conrad Meyer wrote:
> We also observed this test was broken, but I think the right fix is
> much smaller:
>
> --- a/tests/sys/kern/pipe/pipe_fstat_bug_test.c
> +++ b/tests/sys/kern/pipe/pipe_fstat_bug_test.c
> @@ -108,7 +108,6 @@ main(void)
> SYNC_W(0, go2);
>
> SYNC_R(0, go);
> - SYNC_W(0, go2); /* XXX: why is this required? */
> WRITE(8192);
> SYNC_W(0, go2);
>
> (That line breaks the synchronization mechanism that is the only
> guarantee the test passes.)
>
> Best,
> Conrad
>
>
> On Mon, Oct 10, 2016 at 6:40 AM, Ruslan Bukin <br at freebsd.org> wrote:
> > Author: br
> > Date: Mon Oct 10 13:40:05 2016
> > New Revision: 306962
> > URL: https://svnweb.freebsd.org/changeset/base/306962
> >
> > Log:
> > Ensure data in pipe is available to read.
> > Useful for latest (5th, direct mode) test only.
> >
> > Sponsored by: DARPA, AFRL
> > Sponsored by: HEIF5
> >
> > Modified:
> > head/tests/sys/kern/pipe/pipe_fstat_bug_test.c
> >
> > Modified: head/tests/sys/kern/pipe/pipe_fstat_bug_test.c
> > ==============================================================================
> > --- head/tests/sys/kern/pipe/pipe_fstat_bug_test.c Mon Oct 10 11:53:54 2016 (r306961)
> > +++ head/tests/sys/kern/pipe/pipe_fstat_bug_test.c Mon Oct 10 13:40:05 2016 (r306962)
> > @@ -26,6 +26,7 @@ SUCH DAMAGE.
> > #include <sys/types.h>
> > #include <sys/stat.h>
> > #include <sys/wait.h>
> > +#include <sys/event.h>
> > #include <assert.h>
> > #include <err.h>
> > #include <errno.h>
> > @@ -49,10 +50,12 @@ main(void)
> > {
> > char buffer[32768], buffer2[32768], go[] = "go", go2[] = "go2";
> > int desc[2], ipc_coord[2];
> > + struct kevent event, ke;
> > ssize_t error;
> > int successes = 0;
> > struct stat status;
> > pid_t new_pid;
> > + int kq;
> >
> > error = pipe(desc);
> > if (error == -1)
> > @@ -118,9 +121,24 @@ main(void)
> > _exit(0);
> > }
> >
> > + kq = kqueue();
> > + if (kq == -1)
> > + _exit(1);
> > +
> > + EV_SET(&ke, desc[0], EVFILT_READ, EV_ADD, 0, 0, NULL);
> > +
> > + /* Attach event to the kqueue. */
> > + if (kevent(kq, &ke, 1, NULL, 0, NULL) != 0)
> > + _exit(2);
> > +
> > while (successes < 5) {
> > SYNC_W(1, go);
> > SYNC_R(1, go2);
> > +
> > + /* Ensure data is available to read */
> > + if (kevent(kq, NULL, 0, &event, 1, NULL) != 1)
> > + _exit(3);
> > +
> > fstat(desc[0], &status);
> > error = read(desc[0], &buffer2, sizeof(buffer2));
> >
> >
>
More information about the svn-src-all
mailing list