set forkmode=once for junit tests, it made the build process faster by 5x

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@763881 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yegor Kozlov 2009-04-10 06:45:04 +00:00
parent 806706b135
commit 9ac1e8df71
3 changed files with 17 additions and 14 deletions

View File

@ -562,7 +562,7 @@ under the License.
<target name="test-main" unless="main.test.notRequired" <target name="test-main" unless="main.test.notRequired"
depends="compile-main, -test-main-check, fail-unless-junit-is-available"> depends="compile-main, -test-main-check, fail-unless-junit-is-available">
<junit fork="yes" printsummary="yes" haltonfailure="${halt.on.test.failure}" <junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="${halt.on.test.failure}"
failureproperty="main.test.failed" showoutput="true"> failureproperty="main.test.failed" showoutput="true">
<classpath refid="test.classpath"/> <classpath refid="test.classpath"/>
<sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/> <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
@ -676,7 +676,7 @@ under the License.
</target> </target>
<target name="test-scratchpad" depends="compile-main,compile-scratchpad,-test-scratchpad-check" unless="scratchpad.test.notRequired"> <target name="test-scratchpad" depends="compile-main,compile-scratchpad,-test-scratchpad-check" unless="scratchpad.test.notRequired">
<junit printsummary="yes" fork="yes" haltonfailure="${halt.on.test.failure}" failureproperty="scratchpad.test.failed"> <junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}" failureproperty="scratchpad.test.failed">
<classpath> <classpath>
<path refid="scratchpad.classpath"/> <path refid="scratchpad.classpath"/>
<pathelement location="${main.output.dir}"/> <pathelement location="${main.output.dir}"/>
@ -782,7 +782,7 @@ under the License.
</target> </target>
<target name="test-ooxml" depends="compile-main,compile-ooxml,-test-ooxml-check" unless="ooxml.test.notRequired"> <target name="test-ooxml" depends="compile-main,compile-ooxml,-test-ooxml-check" unless="ooxml.test.notRequired">
<junit printsummary="yes" fork="yes" haltonfailure="${halt.on.test.failure}" failureproperty="ooxml.test.failed"> <junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}" failureproperty="ooxml.test.failed">
<classpath refid="test.ooxml.classpath" /> <classpath refid="test.ooxml.classpath" />
<sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/> <sysproperty key="POIFS.testdata.path" file="${main.src.test}/org/apache/poi/poifs/data"/>
<sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/> <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>

View File

@ -21,9 +21,9 @@ package org.apache.poi.poifs.storage;
import java.io.*; import java.io.*;
import java.util.Random; import java.util.Random;
import java.lang.reflect.Field;
import org.apache.poi.util.DummyPOILogger; import org.apache.poi.util.DummyPOILogger;
import org.apache.poi.util.POILogFactory;
import junit.framework.*; import junit.framework.*;
@ -115,9 +115,10 @@ public class TestRawDataBlock
public void testShortConstructor() throws Exception public void testShortConstructor() throws Exception
{ {
// Get the logger to be used // Get the logger to be used
DummyPOILogger logger = (DummyPOILogger)POILogFactory.getLogger( DummyPOILogger logger = new DummyPOILogger();
RawDataBlock.class Field fld = RawDataBlock.class.getDeclaredField("log");
); fld.setAccessible(true);
fld.set(null, logger);
assertEquals(0, logger.logged.size()); assertEquals(0, logger.logged.size());
// Test for various data sizes // Test for various data sizes
@ -168,9 +169,10 @@ public class TestRawDataBlock
*/ */
public void testSlowInputStream() throws Exception { public void testSlowInputStream() throws Exception {
// Get the logger to be used // Get the logger to be used
DummyPOILogger logger = (DummyPOILogger)POILogFactory.getLogger( DummyPOILogger logger = new DummyPOILogger();
RawDataBlock.class Field fld = RawDataBlock.class.getDeclaredField("log");
); fld.setAccessible(true);
fld.set(null, logger);
assertEquals(0, logger.logged.size()); assertEquals(0, logger.logged.size());
// Test for various ok data sizes // Test for various ok data sizes

View File

@ -20,10 +20,10 @@
package org.apache.poi.poifs.storage; package org.apache.poi.poifs.storage;
import java.io.*; import java.io.*;
import java.lang.reflect.Field;
import org.apache.poi.poifs.common.POIFSConstants; import org.apache.poi.poifs.common.POIFSConstants;
import org.apache.poi.util.DummyPOILogger; import org.apache.poi.util.DummyPOILogger;
import org.apache.poi.util.POILogFactory;
import junit.framework.*; import junit.framework.*;
@ -91,9 +91,10 @@ public class TestRawDataBlockList
public void testShortConstructor() throws Exception public void testShortConstructor() throws Exception
{ {
// Get the logger to be used // Get the logger to be used
DummyPOILogger logger = (DummyPOILogger)POILogFactory.getLogger( DummyPOILogger logger = new DummyPOILogger();
RawDataBlock.class Field fld = RawDataBlock.class.getDeclaredField("log");
); fld.setAccessible(true);
fld.set(null, logger);
assertEquals(0, logger.logged.size()); assertEquals(0, logger.logged.size());
// Test for various short sizes // Test for various short sizes