diff options
Diffstat (limited to 'src/junit')
17 files changed, 114 insertions, 16 deletions
diff --git a/src/junit/com/jogamp/common/nio/BuffersTest.java b/src/junit/com/jogamp/common/nio/BuffersTest.java index 836e46d..675f8e1 100644 --- a/src/junit/com/jogamp/common/nio/BuffersTest.java +++ b/src/junit/com/jogamp/common/nio/BuffersTest.java @@ -34,12 +34,14 @@ package com.jogamp.common.nio; import java.nio.IntBuffer; import org.junit.Test; +import com.jogamp.junit.util.TestTracer; + import static org.junit.Assert.*; /** * @author Michael Bien */ -public class BuffersTest { +public class BuffersTest extends TestTracer { @Test public void slice() { diff --git a/src/junit/com/jogamp/common/nio/CachedBufferFactoryTest.java b/src/junit/com/jogamp/common/nio/CachedBufferFactoryTest.java index a00f4c9..4157bdf 100644 --- a/src/junit/com/jogamp/common/nio/CachedBufferFactoryTest.java +++ b/src/junit/com/jogamp/common/nio/CachedBufferFactoryTest.java @@ -42,6 +42,8 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import com.jogamp.junit.util.TestTracer; + import static java.lang.System.*; import static org.junit.Assert.*; @@ -49,7 +51,7 @@ import static org.junit.Assert.*; * * @author Michael Bien */ -public class CachedBufferFactoryTest { +public class CachedBufferFactoryTest extends TestTracer { private final int BUFFERCOUNT = 120; diff --git a/src/junit/com/jogamp/common/nio/TestBuffersFloatDoubleConversion.java b/src/junit/com/jogamp/common/nio/TestBuffersFloatDoubleConversion.java index 0555578..d62cd69 100644 --- a/src/junit/com/jogamp/common/nio/TestBuffersFloatDoubleConversion.java +++ b/src/junit/com/jogamp/common/nio/TestBuffersFloatDoubleConversion.java @@ -33,7 +33,9 @@ import org.junit.Assert; import org.junit.Test; -public class TestBuffersFloatDoubleConversion { +import com.jogamp.junit.util.TestTracer; + +public class TestBuffersFloatDoubleConversion extends TestTracer { public static boolean cmpFloatArray(float[] d1, int d1_offset, float[] d2, int d2_offset, int len) { if( d1.length - d1_offset < len) { diff --git a/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java b/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java index 43d6a61..798457d 100644 --- a/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java +++ b/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java @@ -4,13 +4,14 @@ package com.jogamp.common.nio; import java.io.IOException; import com.jogamp.common.os.*; +import com.jogamp.junit.util.TestTracer; import org.junit.Assert; import org.junit.Test; import static java.lang.System.*; -public class TestPointerBufferEndian { +public class TestPointerBufferEndian extends TestTracer { protected void testImpl (boolean direct) { final MachineDescription machine = Platform.getMachineDescription(); diff --git a/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java b/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java index 4a9173e..5f13ec9 100644 --- a/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java +++ b/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java @@ -2,6 +2,7 @@ package com.jogamp.common.nio; import com.jogamp.common.os.*; import com.jogamp.gluegen.test.junit.generation.Test1p1JavaEmitter; +import com.jogamp.junit.util.TestTracer; import java.io.IOException; import java.nio.*; @@ -11,7 +12,7 @@ import org.junit.Test; import static java.lang.System.*; -public class TestStructAccessorEndian { +public class TestStructAccessorEndian extends TestTracer { @Test public void testStructAccessorEndian1 () { diff --git a/src/junit/com/jogamp/common/util/TestArrayHashSet01.java b/src/junit/com/jogamp/common/util/TestArrayHashSet01.java index b16cc74..a41b86c 100644 --- a/src/junit/com/jogamp/common/util/TestArrayHashSet01.java +++ b/src/junit/com/jogamp/common/util/TestArrayHashSet01.java @@ -34,7 +34,9 @@ import java.io.IOException; import org.junit.Assert; import org.junit.Test; -public class TestArrayHashSet01 { +import com.jogamp.junit.util.TestTracer; + +public class TestArrayHashSet01 extends TestTracer { public static class Dummy { int i1, i2, i3; diff --git a/src/junit/com/jogamp/common/util/TestIOUtil01.java b/src/junit/com/jogamp/common/util/TestIOUtil01.java index fd95652..3875acd 100644 --- a/src/junit/com/jogamp/common/util/TestIOUtil01.java +++ b/src/junit/com/jogamp/common/util/TestIOUtil01.java @@ -46,8 +46,9 @@ import org.junit.Test; import com.jogamp.common.os.MachineDescription; import com.jogamp.common.os.Platform; +import com.jogamp.junit.util.TestTracer; -public class TestIOUtil01 { +public class TestIOUtil01 extends TestTracer { static final MachineDescription machine = Platform.getMachineDescription(); static final int tsz = machine.pageSizeInBytes() + machine.pageSizeInBytes() / 2 ; diff --git a/src/junit/com/jogamp/common/util/TestIteratorIndexCORE.java b/src/junit/com/jogamp/common/util/TestIteratorIndexCORE.java index 20eee3f..eb3e2ee 100644 --- a/src/junit/com/jogamp/common/util/TestIteratorIndexCORE.java +++ b/src/junit/com/jogamp/common/util/TestIteratorIndexCORE.java @@ -38,8 +38,9 @@ import org.junit.AfterClass; import org.junit.Test; import com.jogamp.common.os.Platform; +import com.jogamp.junit.util.TestTracer; -public class TestIteratorIndexCORE { +public class TestIteratorIndexCORE extends TestTracer { static int elems = 10; static int loop = ( Platform.getCPUFamily() == Platform.CPUFamily.ARM ) ? 20 : 9999999; diff --git a/src/junit/com/jogamp/common/util/TestJarUtil.java b/src/junit/com/jogamp/common/util/TestJarUtil.java index 9eef97d..11540d9 100644 --- a/src/junit/com/jogamp/common/util/TestJarUtil.java +++ b/src/junit/com/jogamp/common/util/TestJarUtil.java @@ -46,8 +46,9 @@ import com.jogamp.common.GlueGenVersion; import com.jogamp.common.util.cache.TempCacheReg; import com.jogamp.common.util.cache.TempFileCache; import com.jogamp.common.util.cache.TempJarCache; +import com.jogamp.junit.util.TestTracer; -public class TestJarUtil { +public class TestJarUtil extends TestTracer { static TempFileCache fileCache; @BeforeClass diff --git a/src/junit/com/jogamp/common/util/TestPlatform01.java b/src/junit/com/jogamp/common/util/TestPlatform01.java index c10bf0b..d26ecf5 100644 --- a/src/junit/com/jogamp/common/util/TestPlatform01.java +++ b/src/junit/com/jogamp/common/util/TestPlatform01.java @@ -33,8 +33,9 @@ import org.junit.Test; import com.jogamp.common.os.MachineDescription; import com.jogamp.common.os.Platform; +import com.jogamp.junit.util.TestTracer; -public class TestPlatform01 { +public class TestPlatform01 extends TestTracer { @Test public void testInfo00() { diff --git a/src/junit/com/jogamp/common/util/TestRunnableTask01.java b/src/junit/com/jogamp/common/util/TestRunnableTask01.java index f72a7a7..8fa776f 100644 --- a/src/junit/com/jogamp/common/util/TestRunnableTask01.java +++ b/src/junit/com/jogamp/common/util/TestRunnableTask01.java @@ -34,7 +34,9 @@ import java.lang.reflect.InvocationTargetException; import org.junit.Assert; import org.junit.Test; -public class TestRunnableTask01 { +import com.jogamp.junit.util.TestTracer; + +public class TestRunnableTask01 extends TestTracer { @Test public void testInvokeAndWait00() throws IOException, InterruptedException, InvocationTargetException { diff --git a/src/junit/com/jogamp/common/util/TestTempJarCache.java b/src/junit/com/jogamp/common/util/TestTempJarCache.java index f1630d4..bff66f9 100644 --- a/src/junit/com/jogamp/common/util/TestTempJarCache.java +++ b/src/junit/com/jogamp/common/util/TestTempJarCache.java @@ -47,8 +47,9 @@ import com.jogamp.common.os.Platform; import com.jogamp.common.util.cache.TempCacheReg; import com.jogamp.common.util.cache.TempFileCache; import com.jogamp.common.util.cache.TempJarCache; +import com.jogamp.junit.util.TestTracer; -public class TestTempJarCache { +public class TestTempJarCache extends TestTracer { static TempFileCache fileCache; static class TestClassLoader extends URLClassLoader { diff --git a/src/junit/com/jogamp/common/util/TestVersionInfo.java b/src/junit/com/jogamp/common/util/TestVersionInfo.java index 65e6e63..910b478 100644 --- a/src/junit/com/jogamp/common/util/TestVersionInfo.java +++ b/src/junit/com/jogamp/common/util/TestVersionInfo.java @@ -29,11 +29,13 @@ package com.jogamp.common.util; import com.jogamp.common.GlueGenVersion; +import com.jogamp.junit.util.TestTracer; + import java.io.IOException; import org.junit.Test; -public class TestVersionInfo { +public class TestVersionInfo extends TestTracer { @Test public void testInfo01() { diff --git a/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java b/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java index 3654428..a224633 100644 --- a/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java +++ b/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java @@ -40,8 +40,9 @@ import org.junit.Assert; import org.junit.Test; import com.jogamp.common.os.Platform; +import com.jogamp.junit.util.TestTracer; -public class TestRecursiveLock01 { +public class TestRecursiveLock01 extends TestTracer { public enum YieldMode { NONE(0), YIELD(1), SLEEP(2); diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java index f2a85fe..0bed9f5 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java @@ -32,6 +32,8 @@ import com.jogamp.common.nio.Buffers; import com.jogamp.common.nio.PointerBuffer; import com.jogamp.common.os.MachineDescription; import com.jogamp.common.os.Platform; +import com.jogamp.junit.util.TestTracer; + import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; @@ -46,7 +48,7 @@ import org.junit.Assert; * @author Michael Bien * @author Sven Gothel */ -public class BaseClass { +public class BaseClass extends TestTracer { /** * Verifies the existence and creation of the generated class. diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java index a881445..3438c3d 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java @@ -43,7 +43,7 @@ import org.junit.Test; */ public class Test1p2ProcAddressEmitter extends BaseClass { - NativeLibrary dynamicLookupHelper; + static NativeLibrary dynamicLookupHelper; /** * Verifies loading of the new library. diff --git a/src/junit/com/jogamp/junit/util/TestTracer.java b/src/junit/com/jogamp/junit/util/TestTracer.java new file mode 100644 index 0000000..c7d3cba --- /dev/null +++ b/src/junit/com/jogamp/junit/util/TestTracer.java @@ -0,0 +1,76 @@ +/** + * Copyright 2011 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +package com.jogamp.junit.util; + +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Rule; +import org.junit.rules.TestName; + + +public abstract class TestTracer { + @Rule public TestName _unitTestName = new TestName(); + + public final String getTestMethodName() { + return _unitTestName.getMethodName(); + } + + public final String getSimpleTestName() { + return getClass().getSimpleName()+" - "+getTestMethodName(); + } + + public final String getFullTestName() { + return getClass().getName()+" - "+getTestMethodName(); + } + + @BeforeClass + public static void oneTimeSetUp() { + // one-time initialization code + } + + @AfterClass + public static void oneTimeTearDown() { + // one-time cleanup code + System.gc(); // force cleanup + } + + @Before + public void setUp() { + System.err.println("++++ TestCase.setUp: "+getFullTestName()); + } + + @After + public void tearDown() { + System.err.println("++++ TestCase.tearDown: "+getFullTestName()); + } + +} + |