Date: Mon, 10 Oct 2016 08:04:44 -0700 From: Conrad Meyer <cem@freebsd.org> To: Ruslan Bukin <br@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r306962 - head/tests/sys/kern/pipe Message-ID: <CAG6CVpU%2B-pbFe4ogzvnUEKB4iSRRx-o_W1qFVj-2igxPL6TmzQ@mail.gmail.com> In-Reply-To: <201610101340.u9ADe5XW093068@repo.freebsd.org> References: <201610101340.u9ADe5XW093068@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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@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));
>
>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpU%2B-pbFe4ogzvnUEKB4iSRRx-o_W1qFVj-2igxPL6TmzQ>
