lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Miller <markrmil...@gmail.com>
Subject Re: [jira] Commented: (LUCENE-1709) Parallelize Tests
Date Fri, 26 Jun 2009 02:31:11 GMT
I found a couple external solutions last I looked. They appeared to have 
various limitations though. I really think, longer term, the built in 
support is the way to go. I'd hate to require a certain version of ANT 
(its only the very latest 4.6 release), but perhaps we could set it up 
to work easily in the case that you do have the right version, or we 
could package it up as a contrib somehow?

Thats where the plug-ability of an external is nice - but for long term 
maintainability and correctness - I'd lean towards built in support myself.

### Test scheduling strategies ###

`JUnitCore` now includes an experimental method that allows you to
specify a model of the `Computer` that runs your tests.  Currently,
the only built-in Computers are the default, serial runner, and two
runners provided in the `ParallelRunner` class:
`ParallelRunner.classes()`, which runs classes in parallel, and
`ParallelRunner.methods()`, which runs classes and methods in parallel.

This feature is currently less stable than MaxCore, and may be
merged with MaxCore in some way in the future.

Example:

	public static class Example {
		@Test public void one() throws InterruptedException {
			Thread.sleep(1000);
		}
		@Test public void two() throws InterruptedException {
			Thread.sleep(1000);
		}
	}
	
	@Test public void testsRunInParallel() {
		long start= System.currentTimeMillis();
		Result result= JUnitCore.runClasses(ParallelComputer.methods(),
				Example.class);
		assertTrue(result.wasSuccessful());
		long end= System.currentTimeMillis();
		assertThat(end - start, betweenInclusive(1000, 1500));
	}




- Mark

Jason Rutherglen wrote:
> There's this foreach parallel ant-contrib task.  Perhaps we have a winner!
>
> http://www.jadeliquid.com/liquidtest/docs/doku.php?id=developers:cookbooks:scaling_liquidtest_with_junit_parallel:home
>
> http://ant-contrib.sourceforge.net/tasks/tasks/foreach.html
>
> On Thu, Jun 25, 2009 at 7:14 PM, Mark Miller <markrmiller@gmail.com 
> <mailto:markrmiller@gmail.com>> wrote:
>
>     JUnit also supports parallelizing tasks, but its only in the very
>     latest release. I'd check out that. There are generally more
>     issues than just firing off multiple tests at once.
>
>     -- 
>     - Mark
>
>     http://www.lucidimagination.com
>
>
>
>
>     Jason Rutherglen (JIRA) wrote:
>
>            [
>         https://issues.apache.org/jira/browse/LUCENE-1709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12724325#action_12724325
>         <https://issues.apache.org/jira/browse/LUCENE-1709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12724325#action_12724325>
>         ]
>         Jason Rutherglen commented on LUCENE-1709:
>         ------------------------------------------
>
>         {quote} Do you mean that you would implement your own task? In
>         which module would you put this custom ant task? {quote}
>
>         Yes, seems creating a custom task should work? In contrib/ant?
>         Last time I tried to use Maven I couldn't get it to work (was
>         running into a bug) so my knowledge isn't very good. We're using
>         ant and ivy for our webapp dev. I don't know what Lucene's
>         position is on Maven, but am interested pursuing whatever makes
>         sense.
>
>          
>
>             Parallelize Tests
>             -----------------
>
>                            Key: LUCENE-1709
>                            URL:
>             https://issues.apache.org/jira/browse/LUCENE-1709
>                        Project: Lucene - Java
>                     Issue Type: Improvement
>                     Components: Index
>               Affects Versions: 2.4.1
>                       Reporter: Jason Rutherglen
>                        Fix For: 3.0
>
>              Original Estimate: 48h
>              Remaining Estimate: 48h
>
>             The Lucene tests can be parallelized to make for a faster
>             testing system.  This task from ANT can be used:
>             http://ant.apache.org/manual/CoreTasks/parallel.html
>             Previous discussion:
>             http://www.gossamer-threads.com/lists/lucene/java-dev/69669
>             Notes from Mike M.:
>             {quote}
>             I'd love to see a clean solution here (the tests are
>             embarrassingly
>             parallelizable, and we all have machines with good
>             concurrency these
>             days)... I have a rather hacked up solution now, that uses
>             "-Dtestpackage=XXX" to split the tests up.
>             Ideally I would be able to say "use N threads" and it'd do
>             the right
>             thing... like the -j flag to make.
>             {quote}
>                
>
>
>          
>
>
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
>     <mailto:java-dev-unsubscribe@lucene.apache.org>
>     For additional commands, e-mail: java-dev-help@lucene.apache.org
>     <mailto:java-dev-help@lucene.apache.org>
>
>


-- 
- Mark

http://www.lucidimagination.com




---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message