From owner-svn-src-all@freebsd.org Mon Oct 10 16:50:54 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60569C0BD1D; Mon, 10 Oct 2016 16:50:54 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-31.csi.cam.ac.uk (ppsw-31.csi.cam.ac.uk [131.111.8.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B5491E8; Mon, 10 Oct 2016 16:50:53 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from sc1.bsdpad.com ([163.172.212.18]:35514) by ppsw-31.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.157]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1btdmu-000vmT-KG (Exim 4.86_36-e07b163) (return-path ); Mon, 10 Oct 2016 17:50:52 +0100 Date: Mon, 10 Oct 2016 16:50:38 +0000 From: Ruslan Bukin To: Conrad Meyer Cc: Ruslan Bukin , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r306962 - head/tests/sys/kern/pipe Message-ID: <20161010165038.GA31246@bsdpad.com> References: <201610101340.u9ADe5XW093068@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 16:50:54 -0000 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 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 > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -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)); > > > > >