incubator-hama-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filipe David Manana <fdman...@apache.org>
Subject Re: issue with TestBSPPeer
Date Wed, 27 Oct 2010 16:50:45 GMT
Found this:

http://today.java.net/pub/a/today/2003/08/06/multithreadedTests.html

(I never had the need to use multiple threads doing assertions in tests before)

The license of that JUnit extension seems to be MIT.
Afaik, it's ok to add to an Apache project (I think we some JavaScript
MIT libs in CouchDB).

Anyone against adopting this library?
If not, I'll start working on adding it.

It will be necessary (or some other trick) to test the supersteps counter patch.

On Wed, Oct 27, 2010 at 1:03 PM, Filipe David Manana
<fdmanana@apache.org> wrote:
> Hi,
>
> I've noticed that if an assertion fails in one of the Threads launched
> by TestBSPPeer.java, running "ant test" doesn't report any failure:
>
> fdmanana@localhost ~/git/apache/hama (dev)> ant test
> Buildfile: build.xml
>
> init:
>
> compile:
>
> compile-test:
>    [javac] Compiling 1 source file to /home/fdmanana/git/apache/hama/build/test
>      [jar] Building jar:
> /home/fdmanana/git/apache/hama/build/hama-0.2.0-dev-test.jar
>
> test:
>    [junit] WARNING: multiple versions of ant detected in path for junit
>    [junit]
> jar:file:/usr/share/java/ant-1.7.1.jar!/org/apache/tools/ant/Project.class
>    [junit]      and
> jar:file:/home/fdmanana/git/apache/hama/lib/findbugs/ant.jar!/org/apache/tools/ant/Project.class
>    [junit] Running org.apache.hama.bsp.TestBSPPeer
>    [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 13.941 sec
>
>
> However, looking at the test report (file
> build/reports/tests/TEST-org.apache.hama.bsp.TestBSPPeer.txt), I have
> entries like:
>
> 2010-10-27 12:54:09,361 ERROR [Thread-97]
> server.NIOServerCnxn$Factory$1(81): Thread Thread[Thread-97,5,main]
> died
> junit.framework.AssertionFailedError: expected:<20> but was:<1>
>        at junit.framework.Assert.fail(Assert.java:47)
>        at junit.framework.Assert.failNotEquals(Assert.java:282)
>        at junit.framework.Assert.assertEquals(Assert.java:64)
>        at junit.framework.Assert.assertEquals(Assert.java:201)
>        at junit.framework.Assert.assertEquals(Assert.java:207)
>        at org.apache.hama.bsp.TestBSPPeer$BSPPeerThread.run(TestBSPPeer.java:131)
> 2010-10-27 12:54:09,362 ERROR [Thread-81]
> server.NIOServerCnxn$Factory$1(81): Thread Thread[Thread-81,5,main]
> died
> junit.framework.AssertionFailedError: expected:<20> but was:<1>
>        at junit.framework.Assert.fail(Assert.java:47)
>        at junit.framework.Assert.failNotEquals(Assert.java:282)
>        at junit.framework.Assert.assertEquals(Assert.java:64)
>        at junit.framework.Assert.assertEquals(Assert.java:201)
>        at junit.framework.Assert.assertEquals(Assert.java:207)
>        at org.apache.hama.bsp.TestBSPPeer$BSPPeerThread.run(TestBSPPeer.java:131)
>
> The lines causing this issues (numbers 131 and 135) are:
>
> assertEquals(peer.getNumCurrentMessages(), 1);
>
> and
>
> assertEquals(peer.getNumCurrentMessages(), NUM_PEER * ROUND);
>
> both introduced by me :(
>
> Adding a LOG.info statement, I can see that the value given by
> peer.getNumCurrentMessages() is not constant, that is, it seems to
> vary due to timing issues.
> Should we remove these 2 assertions?
>
> Anyway, we need to fix the test suite so that an assertion failing in
> a Thread gets reported when running "ant test". I haven't noticed this
> before.
>
> --
> Filipe David Manana,
> fdmanana@gmail.com, fdmanana@apache.org
>
> "Reasonable men adapt themselves to the world.
>  Unreasonable men adapt the world to themselves.
>  That's why all progress depends on unreasonable men."
>



-- 
Filipe David Manana,
fdmanana@gmail.com, fdmanana@apache.org

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."

Mime
View raw message