From dev-return-23653-apmail-couchdb-dev-archive=couchdb.apache.org@couchdb.apache.org Wed Oct 31 15:33:33 2012 Return-Path: X-Original-To: apmail-couchdb-dev-archive@www.apache.org Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E8888DA31 for ; Wed, 31 Oct 2012 15:33:33 +0000 (UTC) Received: (qmail 90282 invoked by uid 500); 31 Oct 2012 15:33:33 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 90247 invoked by uid 500); 31 Oct 2012 15:33:33 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 90216 invoked by uid 99); 31 Oct 2012 15:33:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Oct 2012 15:33:32 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of paul.joseph.davis@gmail.com designates 209.85.216.180 as permitted sender) Received: from [209.85.216.180] (HELO mail-qc0-f180.google.com) (209.85.216.180) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Oct 2012 15:33:26 +0000 Received: by mail-qc0-f180.google.com with SMTP id v28so975074qcm.11 for ; Wed, 31 Oct 2012 08:33:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=FFPvpBCmskYvENiJDSYFCyK0/xyDMvLWyoFWl0H+u3o=; b=jfnfIsXgjKq0Mza32bMICWKzPh+A/kFEHRtGP6bMBVAj3JMe9C59+mwzFZpwz+k0vt yvy/UtPLt9joRXev5RwcvTcsr48bz/n31wt0Wyfec+inuX4+BE4CjwD8WdO8mEbopwMx aJFClFW/3vZTCfkY/kP0GRjU8nTCmuebKEaPNusYGF2Q1im9wjE9x4fsKRU5n7jztVYj EKJMQ6RmHBGjoIS6OTwiL8tRSpjANMFvNOuytMSUJjY7YFrkkvQhMOOKdA66XAb4rvZU T1+Ug75p1O2zGFFQjPyI0S7pwlPnxbfQodJv1Q/AHg8zpd3tSs7xAw71jyi2Hi8aNr9G nG3g== Received: by 10.49.29.103 with SMTP id j7mr29386387qeh.47.1351697585196; Wed, 31 Oct 2012 08:33:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.49.24.79 with HTTP; Wed, 31 Oct 2012 08:32:24 -0700 (PDT) In-Reply-To: <20121031152914.2C9625114E@tyr.zones.apache.org> References: <20121031152914.2C9625114E@tyr.zones.apache.org> From: Paul Davis Date: Wed, 31 Oct 2012 11:32:24 -0400 Message-ID: Subject: Re: git commit: COUCHDB-1424 Fix etap to not consume any message To: dev@couchdb.apache.org Cc: commits@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Nice find On Wed, Oct 31, 2012 at 11:29 AM, wrote: > Updated Branches: > refs/heads/1424-fix-etap-consuming-any-test-message [created] 67d531b02 > > > COUCHDB-1424 Fix etap to not consume any message > > Turns out that etap consumes any message in the mailbox in > some cases. This can make some tests that use message passing > hang, as etap itself consumes the messages. > > > Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo > Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/67d531b0 > Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/67d531b0 > Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/67d531b0 > > Branch: refs/heads/1424-fix-etap-consuming-any-test-message > Commit: 67d531b028503b316c9ff8842b8fb34ea75db29d > Parents: 8ccf696 > Author: Filipe David Borba Manana > Authored: Wed Oct 31 16:19:48 2012 +0100 > Committer: Filipe David Borba Manana > Committed: Wed Oct 31 16:19:48 2012 +0100 > > ---------------------------------------------------------------------- > src/etap/etap.erl | 21 +++++++++++---------- > 1 files changed, 11 insertions(+), 10 deletions(-) > ---------------------------------------------------------------------- > > > http://git-wip-us.apache.org/repos/asf/couchdb/blob/67d531b0/src/etap/etap.erl > ---------------------------------------------------------------------- > diff --git a/src/etap/etap.erl b/src/etap/etap.erl > index 7380013..ae3896c 100644 > --- a/src/etap/etap.erl > +++ b/src/etap/etap.erl > @@ -120,14 +120,14 @@ plan(N) when is_integer(N), N > 0 -> > %% @doc End the current test plan and output test results. > %% @todo This should probably be done in the test_server process. > end_tests() -> > - timer:sleep(100), > + Ref = make_ref(), > case whereis(etap_server) of > - undefined -> self() ! true; > - _ -> etap_server ! {self(), state} > + undefined -> self() ! {Ref, true}; > + _ -> etap_server ! {self(), state, Ref} > end, > - State = receive X -> X end, > + State = receive {Ref, X} -> X end, > if > - State#test_state.planned == -1 -> > + is_record(State, test_state) andalso State#test_state.planned == -1 -> > io:format("1..~p~n", [State#test_state.count]); > true -> > ok > @@ -564,8 +564,8 @@ test_server(State) -> > count = State#test_state.count + 1, > fail = State#test_state.fail + 1 > }; > - {From, state} -> > - From ! State, > + {From, state, Ref} -> > + From ! {Ref, State}, > State; > {_From, diag, Message} -> > io:format("~s~n", [Message]), > @@ -573,8 +573,8 @@ test_server(State) -> > {From, count} -> > From ! State#test_state.count, > State; > - {From, is_skip} -> > - From ! State#test_state.skip, > + {From, is_skip, Ref} -> > + From ! {Ref, State#test_state.skip}, > State; > done -> > exit(normal) > @@ -584,7 +584,8 @@ test_server(State) -> > %% @private > %% @doc Process the result of a test and send it to the etap_server process. > mk_tap(Result, Desc) -> > - IsSkip = lib:sendw(etap_server, is_skip), > + etap_server ! {self(), is_skip, Ref = make_ref()} , > + receive {Ref, IsSkip} -> ok end, > case [IsSkip, Result] of > [_, true] -> > etap_server ! {self(), pass, Desc}, >