aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-01-26 03:33:17 +0100
committerSven Gothel <[email protected]>2014-01-26 03:33:17 +0100
commit00502aedb935a8bbb0d5f4407dfe35d8e60c8f97 (patch)
treeddd2f8409202eaf00cd1acbb5342b6973aa7b150 /test
parent30b423fc8d71d05e789c087b2d45cf0e7bf8c542 (diff)
Adapt all unit tests to use UITestCase and enforce named unit test order. Added main entry and listed in tests.sh for manual test.
Diffstat (limited to 'test')
-rw-r--r--test/com/jogamp/opencl/CLBufferTest.java20
-rw-r--r--test/com/jogamp/opencl/CLCommandQueueTest.java67
-rw-r--r--test/com/jogamp/opencl/CLExceptionTest.java25
-rw-r--r--test/com/jogamp/opencl/CLImageTest.java30
-rw-r--r--test/com/jogamp/opencl/CLProgramTest.java29
-rw-r--r--test/com/jogamp/opencl/HighLevelBindingTest.java28
-rw-r--r--test/com/jogamp/opencl/LowLevelBindingTest.java24
-rw-r--r--test/com/jogamp/opencl/TestUtils.java24
-rw-r--r--test/com/jogamp/opencl/gl/CLGLTest.java68
-rw-r--r--test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java23
10 files changed, 226 insertions, 112 deletions
diff --git a/test/com/jogamp/opencl/CLBufferTest.java b/test/com/jogamp/opencl/CLBufferTest.java
index e85f4504..1b9b8357 100644
--- a/test/com/jogamp/opencl/CLBufferTest.java
+++ b/test/com/jogamp/opencl/CLBufferTest.java
@@ -30,7 +30,10 @@ package com.jogamp.opencl;
import com.jogamp.opencl.CLMemory.Mem;
import com.jogamp.opencl.CLMemory.Map;
+import com.jogamp.opencl.test.util.UITestCase;
import com.jogamp.common.nio.Buffers;
+
+import java.io.IOException;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.DoubleBuffer;
@@ -41,7 +44,10 @@ import java.nio.ShortBuffer;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+
+import org.junit.FixMethodOrder;
import org.junit.Test;
+import org.junit.runners.MethodSorters;
import static org.junit.Assert.*;
import static java.lang.System.*;
@@ -51,11 +57,10 @@ import static com.jogamp.opencl.util.CLPlatformFilters.*;
import static com.jogamp.opencl.CLVersion.*;
/**
- *
- * @author Michael Bien
+ * @author Michael Bien, et.al.
*/
-public class CLBufferTest {
-
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class CLBufferTest extends UITestCase {
@Test
public void createBufferTest() {
@@ -94,7 +99,7 @@ public class CLBufferTest {
assertEquals(buffer.getNIOSize(), buffer.getCLSize());
assertEquals(sizeOfBufferElem(nio), buffer.getElementSize());
assertEquals(nio.capacity() * sizeOfBufferElem(nio), buffer.getCLSize());
-
+
CLBuffer<ByteBuffer> clone = buffer.cloneWith(anotherNIO);
assertEquals(buffer.ID, clone.ID);
@@ -341,5 +346,8 @@ public class CLBufferTest {
}
-
+ public static void main(String[] args) throws IOException {
+ String tstname = CLBufferTest.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
}
diff --git a/test/com/jogamp/opencl/CLCommandQueueTest.java b/test/com/jogamp/opencl/CLCommandQueueTest.java
index a83acda2..cc8a6d82 100644
--- a/test/com/jogamp/opencl/CLCommandQueueTest.java
+++ b/test/com/jogamp/opencl/CLCommandQueueTest.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -28,20 +28,27 @@
package com.jogamp.opencl;
+import org.junit.FixMethodOrder;
import org.junit.Rule;
import org.junit.rules.Timeout;
+import org.junit.runners.MethodSorters;
+
import java.util.concurrent.CountDownLatch;
+
+import com.jogamp.opencl.test.util.UITestCase;
import com.jogamp.opencl.util.MultiQueueBarrier;
import com.jogamp.opencl.CLCommandQueue.Mode;
import com.jogamp.opencl.CLMemory.Mem;
import com.jogamp.opencl.util.CLDeviceFilters;
import com.jogamp.opencl.util.CLPlatformFilters;
import com.jogamp.opencl.llb.CL;
+
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.EnumSet;
import java.util.concurrent.TimeUnit;
+
import org.junit.Test;
import static org.junit.Assert.*;
@@ -53,10 +60,10 @@ import static com.jogamp.common.nio.Buffers.*;
import static com.jogamp.opencl.CLCommandQueue.Mode.*;
/**
- *
- * @author Michael Bien
+ * @author Michael Bien, et.al.
*/
-public class CLCommandQueueTest {
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class CLCommandQueueTest extends UITestCase {
@Rule
public Timeout methodTimeout = new Timeout(20000);
@@ -100,7 +107,7 @@ public class CLCommandQueueTest {
try{
CLDevice device = context.getDevices()[0];
int groupSize = device.getMaxWorkItemSizes()[0];
-
+
final int elements = roundUp(groupSize, ONE_MB / SIZEOF_INT * 5); // 5MB per buffer
CLBuffer<ByteBuffer> clBufferA = context.createByteBuffer(elements * SIZEOF_INT, Mem.READ_ONLY);
@@ -145,10 +152,10 @@ public class CLCommandQueueTest {
.putWaitForEvent(events, 1, true);
events.release();
-
+
queue.putReadBuffer(clBufferC, false, events)
.putReadBuffer(clBufferD, false, events);
-
+
queue.putWaitForEvents(events, true);
events.release();
@@ -159,14 +166,14 @@ public class CLCommandQueueTest {
context.release();
}
}
-
+
@Test
public void eventConditionsTest() throws IOException {
-
+
out.println(" - - - event conditions test - - - ");
CLPlatform platform = CLPlatform.getDefault(CLPlatformFilters.queueMode(OUT_OF_ORDER_MODE));
-
+
CLDevice device = null;
// we can still test this with in-order queues
if(platform == null) {
@@ -174,17 +181,17 @@ public class CLCommandQueueTest {
}else{
device = platform.getMaxFlopsDevice(CLDeviceFilters.queueMode(OUT_OF_ORDER_MODE));
}
-
+
CLContext context = CLContext.create(device);
-
+
try{
-
+
CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl")).build();
-
+
CLBuffer<IntBuffer> buffer = context.createBuffer(newDirectIntBuffer(new int[]{ 1,1,1, 1,1,1, 1,1,1 }));
-
+
int elements = buffer.getNIOCapacity();
-
+
CLCommandQueue queue;
if(device.getQueueProperties().contains(OUT_OF_ORDER_MODE)) {
queue = device.createCommandQueue(OUT_OF_ORDER_MODE);
@@ -194,30 +201,30 @@ public class CLCommandQueueTest {
// simulate in-order queue by accumulating events of prior commands
CLEventList events = new CLEventList(3);
-
+
// (1+1)*2 = 4; conditions enforce propper order
CLKernel addKernel = program.createCLKernel("add").putArg(buffer).putArg(1).putArg(elements);
CLKernel mulKernel = program.createCLKernel("mul").putArg(buffer).putArg(2).putArg(elements);
-
+
queue.putWriteBuffer(buffer, false, events);
-
+
queue.put1DRangeKernel(addKernel, 0, elements, 1, events, events);
queue.put1DRangeKernel(mulKernel, 0, elements, 1, events, events);
-
+
queue.putReadBuffer(buffer, false, events, null);
-
+
queue.finish();
-
+
events.release();
-
+
for (int i = 0; i < elements; i++) {
assertEquals(4, buffer.getBuffer().get(i));
}
-
+
}finally{
context.release();
}
-
+
}
@Test
@@ -505,4 +512,8 @@ public class CLCommandQueueTest {
}
}
+ public static void main(String[] args) throws IOException {
+ String tstname = CLCommandQueueTest.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
}
diff --git a/test/com/jogamp/opencl/CLExceptionTest.java b/test/com/jogamp/opencl/CLExceptionTest.java
index 61d43648..5a1ce89b 100644
--- a/test/com/jogamp/opencl/CLExceptionTest.java
+++ b/test/com/jogamp/opencl/CLExceptionTest.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -28,15 +28,22 @@
package com.jogamp.opencl;
+import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+
+import org.junit.FixMethodOrder;
import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.opencl.test.util.UITestCase;
+
import static org.junit.Assert.*;
/**
- *
- * @author Michael Bien
+ * @author Michael Bien, et.al.
*/
-public class CLExceptionTest {
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class CLExceptionTest extends UITestCase {
@Test
public void testCLExceptions() throws InstantiationException, IllegalAccessException, NoSuchMethodException, IllegalArgumentException, InvocationTargetException {
@@ -61,4 +68,8 @@ public class CLExceptionTest {
}
}
+ public static void main(String[] args) throws IOException {
+ String tstname = CLExceptionTest.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
}
diff --git a/test/com/jogamp/opencl/CLImageTest.java b/test/com/jogamp/opencl/CLImageTest.java
index 862b7798..3141f522 100644
--- a/test/com/jogamp/opencl/CLImageTest.java
+++ b/test/com/jogamp/opencl/CLImageTest.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -32,9 +32,16 @@ package com.jogamp.opencl;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.nio.IntBuffer;
+
import javax.imageio.ImageIO;
+
import org.junit.BeforeClass;
+import org.junit.FixMethodOrder;
import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.opencl.test.util.UITestCase;
+
import static org.junit.Assert.*;
import static java.lang.System.*;
import static com.jogamp.common.nio.Buffers.*;
@@ -43,9 +50,10 @@ import static com.jogamp.opencl.CLImageFormat.ChannelType.*;
/**
* Test testing CLImage API.
- * @author Michael Bien
+ * @author Michael Bien, et.al
*/
-public class CLImageTest {
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class CLImageTest extends UITestCase {
private static int[] pixels;
@@ -94,7 +102,7 @@ public class CLImageTest {
}
}
-
+
@Test
public void image2dCopyTest() throws IOException {
@@ -110,14 +118,14 @@ public class CLImageTest {
try{
CLImageFormat format = new CLImageFormat(RGBA, UNSIGNED_INT32);
-
+
CLImage2d<IntBuffer> imageA = context.createImage2d(newDirectIntBuffer(pixels), 128, 128, format);
CLImage2d<IntBuffer> imageB = context.createImage2d(newDirectIntBuffer(pixels.length), 128, 128, format);
queue.putWriteImage(imageA, false)
.putCopyImage(imageA, imageB)
.putReadImage(imageB, true);
-
+
IntBuffer bufferA = imageA.getBuffer();
IntBuffer bufferB = imageB.getBuffer();
@@ -177,5 +185,9 @@ public class CLImageTest {
}
}
+ public static void main(String[] args) throws IOException {
+ String tstname = CLImageTest.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
}
diff --git a/test/com/jogamp/opencl/CLProgramTest.java b/test/com/jogamp/opencl/CLProgramTest.java
index d083c770..eaf954e9 100644
--- a/test/com/jogamp/opencl/CLProgramTest.java
+++ b/test/com/jogamp/opencl/CLProgramTest.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -28,11 +28,13 @@
package com.jogamp.opencl;
+import com.jogamp.opencl.test.util.UITestCase;
import com.jogamp.opencl.util.CLBuildConfiguration;
import com.jogamp.opencl.util.CLProgramConfiguration;
import com.jogamp.opencl.CLProgram.Status;
import com.jogamp.opencl.util.CLBuildListener;
import com.jogamp.opencl.llb.CL;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -41,9 +43,12 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
+
+import org.junit.FixMethodOrder;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
+import org.junit.runners.MethodSorters;
import static org.junit.Assert.*;
import static java.lang.System.*;
@@ -51,9 +56,10 @@ import static com.jogamp.opencl.CLProgram.CompilerOptions.*;
/**
*
- * @author Michael Bien
+ * @author Michael Bien, et.al
*/
-public class CLProgramTest {
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class CLProgramTest extends UITestCase {
@Rule
public TemporaryFolder tmpFolder = new TemporaryFolder();
@@ -300,7 +306,7 @@ public class CLProgramTest {
kernel.putArg((short)3);
assertEquals(3, kernel.position());
-
+
try{
kernel.putArg(3);
fail("exception not thrown");
@@ -313,11 +319,11 @@ public class CLProgramTest {
context.release();
}
- }
+ }
@Test
public void createAllKernelsTest() {
-
+
String source = "kernel void foo(int a) { }\n"+
"kernel void bar(float b) { }\n";
@@ -353,4 +359,9 @@ public class CLProgramTest {
}
}
+ public static void main(String[] args) throws IOException {
+ String tstname = CLProgramTest.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
+
}
diff --git a/test/com/jogamp/opencl/HighLevelBindingTest.java b/test/com/jogamp/opencl/HighLevelBindingTest.java
index fe6bef51..bdff8041 100644
--- a/test/com/jogamp/opencl/HighLevelBindingTest.java
+++ b/test/com/jogamp/opencl/HighLevelBindingTest.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -40,14 +40,19 @@ import com.jogamp.opencl.CLDevice.LocalMemType;
import com.jogamp.opencl.CLDevice.Type;
import com.jogamp.opencl.CLDevice.Capabilities;
import com.jogamp.opencl.llb.CL;
+import com.jogamp.opencl.test.util.UITestCase;
+
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.Map;
+
import org.junit.BeforeClass;
+import org.junit.FixMethodOrder;
import org.junit.Test;
+import org.junit.runners.MethodSorters;
import static org.junit.Assert.*;
import static java.lang.System.*;
@@ -59,9 +64,10 @@ import static com.jogamp.common.nio.Buffers.*;
/**
* Test testing the high level bindings.
- * @author Michael Bien
+ * @author Michael Bien, et.al
*/
-public class HighLevelBindingTest {
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class HighLevelBindingTest extends UITestCase {
@BeforeClass
public static void setUpClass() throws Exception {
@@ -73,7 +79,7 @@ public class HighLevelBindingTest {
@Test
public void enumsTest() {
-
+
// enum tests
final EnumSet<FPConfig> singleFPConfig = FPConfig.valuesOf(CL.CL_FP_DENORM | CL.CL_FP_ROUND_TO_INF);
assertEquals(0, FPConfig.valuesOf(0).size());
@@ -201,7 +207,7 @@ public class HighLevelBindingTest {
CLPlatform platformGPU = CLPlatform.getDefault(version(CL_1_0), type(GPU));
CLPlatform platformCPU = CLPlatform.getDefault(version(CL_1_0), type(CPU));
-
+
if(platformGPU != null) {
assertTrue(platformGPU.listCLDevices(GPU).length > 0);
}else if(platformCPU != null) {
@@ -362,5 +368,9 @@ public class HighLevelBindingTest {
context.release();
}
-
+ public static void main(String[] args) throws IOException {
+ String tstname = HighLevelBindingTest.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
+
}
diff --git a/test/com/jogamp/opencl/LowLevelBindingTest.java b/test/com/jogamp/opencl/LowLevelBindingTest.java
index 9a5e034e..a4135b98 100644
--- a/test/com/jogamp/opencl/LowLevelBindingTest.java
+++ b/test/com/jogamp/opencl/LowLevelBindingTest.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -29,10 +29,13 @@
package com.jogamp.opencl;
import java.util.Random;
+
import com.jogamp.common.nio.PointerBuffer;
import com.jogamp.opencl.llb.impl.BuildProgramCallback;
import com.jogamp.opencl.llb.CL;
+import com.jogamp.opencl.test.util.UITestCase;
+import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;
@@ -46,7 +49,9 @@ import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.junit.BeforeClass;
+import org.junit.FixMethodOrder;
import org.junit.Test;
+import org.junit.runners.MethodSorters;
import static java.lang.System.*;
import static org.junit.Assert.*;
@@ -59,7 +64,8 @@ import static com.jogamp.opencl.TestUtils.*;
* Test testing the low level bindings.
* @author Michael Bien, et al.
*/
-public class LowLevelBindingTest {
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class LowLevelBindingTest extends UITestCase {
private final static String programSource =
" // OpenCL Kernel Function for element by element vector addition \n"
@@ -256,7 +262,7 @@ public class LowLevelBindingTest {
out.println("using device# " + offset);
offset *= (is32Bit() ? 4 : 8);
long device = is32Bit()?bb.getInt(offset):bb.getLong(offset);
-
+
ret = cl.clGetDeviceInfo(device, CL.CL_DEVICE_MAX_WORK_GROUP_SIZE, bb.capacity(), bb, null);
checkError("on clGetDeviceInfo", ret);
int maxWGS = bb.getInt();
@@ -438,7 +444,7 @@ public class LowLevelBindingTest {
}
});
}
-
+
for (Future<Object> future : pool.invokeAll(tasks)) {
try {
future.get();
@@ -465,5 +471,9 @@ public class LowLevelBindingTest {
throw CLException.newException(ret, msg);
}
+ public static void main(String[] args) throws IOException {
+ String tstname = LowLevelBindingTest.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
}
diff --git a/test/com/jogamp/opencl/TestUtils.java b/test/com/jogamp/opencl/TestUtils.java
index bf1fd153..a5c4e2b3 100644
--- a/test/com/jogamp/opencl/TestUtils.java
+++ b/test/com/jogamp/opencl/TestUtils.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -28,16 +28,23 @@
package com.jogamp.opencl;
+import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Random;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.opencl.test.util.UITestCase;
+
import static java.lang.System.*;
import static org.junit.Assert.*;
/**
- * @author Michael Bien
+ * @author Michael Bien, et.al
*/
-public class TestUtils {
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestUtils extends UITestCase {
//decrease this value on systems with few memory.
final static int ONE_MB = 1048576;
@@ -77,4 +84,9 @@ public class TestUtils {
a.rewind();
b.rewind();
}
+
+ public static void main(String[] args) throws IOException {
+ String tstname = TestUtils.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
}
diff --git a/test/com/jogamp/opencl/gl/CLGLTest.java b/test/com/jogamp/opencl/gl/CLGLTest.java
index 5ccebb1a..19bc1c99 100644
--- a/test/com/jogamp/opencl/gl/CLGLTest.java
+++ b/test/com/jogamp/opencl/gl/CLGLTest.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -34,8 +34,10 @@ package com.jogamp.opencl.gl;
import com.jogamp.common.nio.Buffers;
import com.jogamp.opencl.CLCommandQueue;
+
import javax.media.opengl.GL2;
import javax.media.opengl.GLException;
+
import com.jogamp.opencl.CLDevice;
import com.jogamp.newt.NewtFactory;
import com.jogamp.newt.Window;
@@ -43,13 +45,20 @@ import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opencl.CLContext;
import com.jogamp.opencl.CLMemory.Mem;
import com.jogamp.opencl.CLPlatform;
+import com.jogamp.opencl.test.util.UITestCase;
import com.jogamp.opencl.util.CLDeviceFilters;
import com.jogamp.opencl.util.CLPlatformFilters;
+
+import java.io.IOException;
import java.nio.IntBuffer;
+
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
import javax.media.opengl.GLContext;
+
+import org.junit.FixMethodOrder;
import org.junit.Test;
+import org.junit.runners.MethodSorters;
import static com.jogamp.opencl.util.CLPlatformFilters.*;
import static org.junit.Assert.*;
@@ -57,9 +66,10 @@ import static java.lang.System.*;
/**
* Test testing the JOGL - JOCL interoperability.
- * @author Michael Bien
+ * @author Michael Bien, et.al
*/
-public class CLGLTest {
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class CLGLTest extends UITestCase {
private static GLContext glcontext;
private static GLWindow glWindow;
@@ -87,7 +97,7 @@ public class CLGLTest {
glcontext.release();
glWindow.destroy();
window.destroy();
-
+
glcontext = null;
glWindow = null;
window = null;
@@ -111,11 +121,11 @@ public class CLGLTest {
}
out.println(device.getPlatform());
-
+
assertNotNull(glcontext);
makeGLCurrent();
assertTrue(glcontext.isCurrent());
-
+
CLContext context = CLGLContext.create(glcontext, device);
assertNotNull(context);
@@ -129,40 +139,40 @@ public class CLGLTest {
}finally{
// destroy cl context, gl context still current
context.release();
-
+
deinitGL();
}
}
-
+
@Test(timeout=15000)
public void vboSharing() {
-
+
out.println(" - - - glcl; vboSharing - - - ");
-
+
initGL();
makeGLCurrent();
assertTrue(glcontext.isCurrent());
-
+
CLPlatform platform = CLPlatform.getDefault(glSharing(glcontext));
if(platform == null) {
out.println("test aborted");
return;
}
-
+
CLDevice theChosenOne = platform.getMaxFlopsDevice(CLDeviceFilters.glSharing());
out.println(theChosenOne);
-
+
CLGLContext context = CLGLContext.create(glcontext, theChosenOne);
-
+
try{
out.println(context);
-
+
GL2 gl = glcontext.getGL().getGL2();
-
+
int[] id = new int[1];
gl.glGenBuffers(id.length, id, 0);
-
+
IntBuffer glData = Buffers.newDirectIntBuffer(new int[] {0,1,2,3,4,5,6,7,8});
glData.rewind();
@@ -173,16 +183,16 @@ public class CLGLTest {
gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);
gl.glDisableClientState(GL2.GL_VERTEX_ARRAY);
gl.glFinish();
-
+
// create CLGL buffer
IntBuffer clData = Buffers.newDirectIntBuffer(9);
CLGLBuffer<IntBuffer> clBuffer = context.createFromGLBuffer(clData, id[0], glData.capacity()*4, Mem.READ_ONLY);
-
+
assertEquals(glData.capacity(), clBuffer.getCLCapacity());
assertEquals(glData.capacity()*4, clBuffer.getCLSize());
-
-
+
+
CLCommandQueue queue = theChosenOne.createCommandQueue();
// read gl buffer into cl nio buffer
@@ -197,14 +207,14 @@ public class CLGLTest {
out.println(clBuffer);
clBuffer.release();
-
+
gl.glDeleteBuffers(1, id, 0);
-
+
}finally{
context.release();
deinitGL();
}
-
+
}
private void makeGLCurrent() {
@@ -222,5 +232,9 @@ public class CLGLTest {
}
}
+ public static void main(String[] args) throws IOException {
+ String tstname = CLGLTest.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
}
diff --git a/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java b/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
index 818827c6..a8c10ed4 100644
--- a/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
+++ b/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
@@ -10,17 +10,26 @@ import com.jogamp.opencl.CLContext;
import com.jogamp.opencl.CLDevice;
import com.jogamp.opencl.CLKernel;
import com.jogamp.opencl.CLPlatform;
+import com.jogamp.opencl.test.util.UITestCase;
import com.jogamp.opencl.util.concurrent.CLQueueContext.CLSimpleQueueContext;
import com.jogamp.opencl.util.concurrent.CLQueueContextFactory.CLSimpleContextFactory;
+
+import java.io.IOException;
import java.nio.IntBuffer;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
+
+import org.junit.FixMethodOrder;
import org.junit.Rule;
import org.junit.rules.Timeout;
+import org.junit.runners.MethodSorters;
+
import com.jogamp.opencl.util.CLMultiContext;
+
import java.nio.Buffer;
import java.util.ArrayList;
import java.util.List;
+
import org.junit.Test;
import static org.junit.Assert.*;
@@ -28,9 +37,10 @@ import static java.lang.System.*;
/**
*
- * @author Michael Bien
+ * @author Michael Bien, et.al
*/
-public class CLMultiContextTest {
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class CLMultiContextTest extends UITestCase {
@Rule
public Timeout methodTimeout= new Timeout(10000);
@@ -78,7 +88,7 @@ public class CLMultiContextTest {
}
public Buffer execute(CLSimpleQueueContext qc) {
-
+
CLCommandQueue queue = qc.getQueue();
CLContext context = qc.getCLContext();
CLKernel kernel = qc.getKernel("compute");
@@ -119,7 +129,7 @@ public class CLMultiContextTest {
final int slice = 64;
final int tasksPerQueue = 10;
final int taskCount = pool.getSize() * tasksPerQueue;
-
+
IntBuffer data = Buffers.newDirectIntBuffer(slice*taskCount);
List<CLTestTask> tasks = new ArrayList<CLTestTask>(taskCount);
@@ -168,4 +178,9 @@ public class CLMultiContextTest {
data.rewind();
}
+ public static void main(String[] args) throws IOException {
+ String tstname = CLMultiContextTest.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
+
}