db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: squeezing some multi-processing out of the nightly test runs?
Date Fri, 16 May 2008 13:55:10 GMT
Rick Hillegas <Richard.Hillegas@Sun.COM> writes:

> Mike Matrigali wrote:
>> I would like to get the nightly tests to run faster on machines that
>> have more than one cpu - or even hyperthreaded on a single cpu.
>> Since most of the tests are single threaded I think this means
>> somehow running more than one test at a time.  For me
>> it might even help if I was just able to run tests on 2 different
>> codelines on the same machine at the same time.
>> I think going forward this will be more and
>> more common for developers.  You can find reasonably priced laptops
>> nowadays that come dual core already.
>>
>> I know what outstanding issue is that the network tests default to the
>> same port.  I believe at least for the junit tests one can set a
>> different port number.  Does anyone know if this fixes all the
>> issues
>> for the junit tests - I think I have seen some tests try different ports
>> rather than the default one.
> Hi Mike,
>
> I don't know how much work is needed to make the junit tests
> independent of the port number. I can't find a JIRA which lists all of
> the problem cases. However, the following JIRAs may be helpful:
> DERBY-2440 and DERBY-2404.

It is possible to change the port for all tests in a JUnit suite if we
run the suite like this:

  java -Dport=XXX -DjmxPort=YYY ...

Note that some tests also use port XXX+1, so you shouldn't allocate
ports to close to each other if you run many JUnit processes in
parallel.

One thing I've considered, is to have a shell script that runs each
top-level test suite in a separate process using different ports. To
make such a script more maintainable (for instance, I don't like the
thought of having to update the script each time a new suite is added) I
was thinking that we could change the AllPackages class so that it
prints the list of test suites if we execute the class from the command
line. Then we could have a shell script which did something like this:

port=1527
for i in $(java org.apache.derbyTesting.functionTests.suites.AllPackages)
do
  java junit.textui.TestRunner -Dport=$port -DjmxPort=$((port+5)) $i &
  ((port += 10))
done

>> Also what is the situation with the derbyall tests.  How much work
>> to get the rest of the network server tests converted to junit.
>>
>> On a separate note how hard would it be to get a test runner to execute
>> more than one test (fixture? not sure of the junit terminology),
>> at a time.  I don't think we could execute them in the same db as most
>> seem to assume they can use any name space and then clean up the whole
>> db when they are done.  From those knowledgeable about junit, should I
>> look for a test runner with these features or is this just a programming
>> job for derby specific tests?  Maybe just a different set of suites?
> I haven't experimented with this myself, but the following link might
> be useful: https://parallel-junit.dev.java.net/

That looks interesting! We could perhaps have a helper method that
creates a ParallelTestSuite, if that class is available, or an ordinary
TestSuite if the class isn't available. As a first step to increase the
parallelism, we could make TestConfiguration.defaultSuite() run the
embedded test suite in parallel with the client/server test suite. Then
we don't need to worry about port collisions, we only need to make sure
the two threads use different databases.

Many of the existing tests can probably be parallelized even further
with that library without too much effort, but there are also many that
need to be executed sequentially because they work on the same set of
tables and require that the tearDown() method of the preceding test case
has done the proper clean-up. Some of the tests also reboot the
database, which could affect tests running in parallel against the same
database.

-- 
Knut Anders

Mime
View raw message