aboutsummaryrefslogtreecommitdiffstats
path: root/test/com
diff options
context:
space:
mode:
Diffstat (limited to 'test/com')
-rw-r--r--test/com/jogamp/opencl/CLBufferTest.java13
-rw-r--r--test/com/jogamp/opencl/CLCommandQueueTest.java13
-rw-r--r--test/com/jogamp/opencl/CLImageTest.java10
-rw-r--r--test/com/jogamp/opencl/CLProgramTest.java13
-rw-r--r--test/com/jogamp/opencl/HighLevelBindingTest.java10
-rw-r--r--test/com/jogamp/opencl/LowLevelBindingTest.java7
-rw-r--r--test/com/jogamp/opencl/gl/CLGLTest.java9
-rw-r--r--test/com/jogamp/opencl/test/util/MiscUtils.java15
-rw-r--r--test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java7
9 files changed, 95 insertions, 2 deletions
diff --git a/test/com/jogamp/opencl/CLBufferTest.java b/test/com/jogamp/opencl/CLBufferTest.java
index 0638844..3ac1fff 100644
--- a/test/com/jogamp/opencl/CLBufferTest.java
+++ b/test/com/jogamp/opencl/CLBufferTest.java
@@ -30,6 +30,7 @@ package com.jogamp.opencl;
import com.jogamp.opencl.CLMemory.Mem;
import com.jogamp.opencl.CLMemory.Map;
+import com.jogamp.opencl.test.util.MiscUtils;
import com.jogamp.opencl.test.util.UITestCase;
import com.jogamp.common.nio.Buffers;
@@ -66,6 +67,8 @@ public class CLBufferTest extends UITestCase {
public void createBufferTest() {
out.println(" - - - highLevelTest; create buffer test - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
CLContext context = CLContext.create();
try{
@@ -121,6 +124,8 @@ public class CLBufferTest extends UITestCase {
public void writeCopyReadBufferTest() {
out.println(" - - - highLevelTest; copy buffer test - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
final int elements = NUM_ELEMENTS;
@@ -153,6 +158,8 @@ public class CLBufferTest extends UITestCase {
public void bufferWithHostPointerTest() {
out.println(" - - - highLevelTest; host pointer test - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
final int elements = NUM_ELEMENTS;
@@ -197,6 +204,8 @@ public class CLBufferTest extends UITestCase {
public void mapBufferTest() {
out.println(" - - - highLevelTest; map buffer test - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
final int elements = NUM_ELEMENTS;
final int sizeInBytes = elements*SIZEOF_INT;
@@ -250,6 +259,8 @@ public class CLBufferTest extends UITestCase {
public void subBufferTest() {
out.println(" - - - subBufferTest - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
CLPlatform platform = CLPlatform.getDefault(version(CL_1_1));
if(platform == null) {
@@ -313,6 +324,8 @@ public class CLBufferTest extends UITestCase {
public void destructorCallbackTest() throws InterruptedException {
out.println(" - - - destructorCallbackTest - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
CLPlatform platform = CLPlatform.getDefault(version(CL_1_1));
if(platform == null) {
diff --git a/test/com/jogamp/opencl/CLCommandQueueTest.java b/test/com/jogamp/opencl/CLCommandQueueTest.java
index c9b1b56..7626028 100644
--- a/test/com/jogamp/opencl/CLCommandQueueTest.java
+++ b/test/com/jogamp/opencl/CLCommandQueueTest.java
@@ -35,6 +35,7 @@ import org.junit.runners.MethodSorters;
import java.util.concurrent.CountDownLatch;
+import com.jogamp.opencl.test.util.MiscUtils;
import com.jogamp.opencl.test.util.UITestCase;
import com.jogamp.opencl.util.MultiQueueBarrier;
import com.jogamp.opencl.CLCommandQueue.Mode;
@@ -101,6 +102,8 @@ public class CLCommandQueueTest extends UITestCase {
public void eventsTest() throws IOException {
out.println(" - - - event synchronization test - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
CLContext context = CLContext.create();
@@ -171,6 +174,8 @@ public class CLCommandQueueTest extends UITestCase {
public void eventConditionsTest() throws IOException {
out.println(" - - - event conditions test - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
CLPlatform platform = CLPlatform.getDefault(CLPlatformFilters.queueMode(OUT_OF_ORDER_MODE));
@@ -231,6 +236,8 @@ public class CLCommandQueueTest extends UITestCase {
public void profilingEventsTest() throws IOException {
out.println(" - - - event synchronization test - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
CLContext context = CLContext.create();
@@ -286,6 +293,8 @@ public class CLCommandQueueTest extends UITestCase {
@Test
public void customEventsTest() throws IOException, InterruptedException {
out.println(" - - - user events test - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
CLPlatform[] platforms = CLPlatform.listCLPlatforms();
CLPlatform theChosenOne = platforms[0];
@@ -362,6 +371,8 @@ public class CLCommandQueueTest extends UITestCase {
public void eventCallbackTest() throws InterruptedException {
out.println(" - - - event callback test - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
CLPlatform platform = CLPlatform.getDefault();
@@ -402,6 +413,8 @@ public class CLCommandQueueTest extends UITestCase {
public void concurrencyTest() throws IOException, InterruptedException {
out.println(" - - - QueueBarrier test - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
final int elements = ONE_MB / SIZEOF_INT * 10; // 20MB per buffer
diff --git a/test/com/jogamp/opencl/CLImageTest.java b/test/com/jogamp/opencl/CLImageTest.java
index 3141f52..26e53ed 100644
--- a/test/com/jogamp/opencl/CLImageTest.java
+++ b/test/com/jogamp/opencl/CLImageTest.java
@@ -40,6 +40,7 @@ import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
+import com.jogamp.opencl.test.util.MiscUtils;
import com.jogamp.opencl.test.util.UITestCase;
import static org.junit.Assert.*;
@@ -83,6 +84,9 @@ public class CLImageTest extends UITestCase {
@Test
public void supportedImageFormatsTest() {
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
+
CLDevice device = getCompatibleDevice();
if(device == null) {
out.println("WARNING: can not test image api.");
@@ -106,6 +110,9 @@ public class CLImageTest extends UITestCase {
@Test
public void image2dCopyTest() throws IOException {
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
+
CLDevice device = getCompatibleDevice();
if(device == null) {
out.println("WARNING: can not test image api.");
@@ -142,6 +149,9 @@ public class CLImageTest extends UITestCase {
@Test
public void image2dKernelCopyTest() throws IOException {
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
+
CLDevice device = getCompatibleDevice();
if(device == null) {
out.println("WARNING: can not test image api.");
diff --git a/test/com/jogamp/opencl/CLProgramTest.java b/test/com/jogamp/opencl/CLProgramTest.java
index eaf954e..7fb7bc3 100644
--- a/test/com/jogamp/opencl/CLProgramTest.java
+++ b/test/com/jogamp/opencl/CLProgramTest.java
@@ -28,6 +28,7 @@
package com.jogamp.opencl;
+import com.jogamp.opencl.test.util.MiscUtils;
import com.jogamp.opencl.test.util.UITestCase;
import com.jogamp.opencl.util.CLBuildConfiguration;
import com.jogamp.opencl.util.CLProgramConfiguration;
@@ -78,6 +79,8 @@ public class CLProgramTest extends UITestCase {
public void rebuildProgramTest() throws IOException {
out.println(" - - - CLProgramTest; rebuild program test - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
CLContext context = CLContext.create();
CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl"));
@@ -117,6 +120,8 @@ public class CLProgramTest extends UITestCase {
public void programBinariesTest() throws IOException {
out.println(" - - - CLProgramTest; down-/upload binaries test - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
CLContext context = CLContext.create();
CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl"))
@@ -194,6 +199,8 @@ public class CLProgramTest extends UITestCase {
@Test
public void builderTest() throws IOException, ClassNotFoundException, InterruptedException {
out.println(" - - - CLProgramTest; program builder test - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
CLContext context = CLContext.create();
CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl"));
@@ -276,6 +283,9 @@ public class CLProgramTest extends UITestCase {
@Test
public void kernelTest() {
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
+
String source = "__attribute__((reqd_work_group_size(1, 1, 1))) kernel void foo(float a, int b, short c) { }\n";
CLContext context = CLContext.create();
@@ -324,6 +334,9 @@ public class CLProgramTest extends UITestCase {
@Test
public void createAllKernelsTest() {
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
+
String source = "kernel void foo(int a) { }\n"+
"kernel void bar(float b) { }\n";
diff --git a/test/com/jogamp/opencl/HighLevelBindingTest.java b/test/com/jogamp/opencl/HighLevelBindingTest.java
index 6dd6a73..6a00343 100644
--- a/test/com/jogamp/opencl/HighLevelBindingTest.java
+++ b/test/com/jogamp/opencl/HighLevelBindingTest.java
@@ -40,6 +40,7 @@ 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.MiscUtils;
import com.jogamp.opencl.test.util.UITestCase;
import java.io.IOException;
@@ -137,6 +138,8 @@ public class HighLevelBindingTest extends UITestCase {
public void contextlessTest() {
out.println(" - - - highLevelTest; contextless - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
// platform/device info tests
CLPlatform[] clPlatforms = CLPlatform.listCLPlatforms();
@@ -205,6 +208,9 @@ public class HighLevelBindingTest extends UITestCase {
@Test
public void platformTest() {
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
+
CLPlatform platformGPU = CLPlatform.getDefault(version(CL_1_0), type(GPU));
CLPlatform platformCPU = CLPlatform.getDefault(version(CL_1_0), type(CPU));
@@ -221,6 +227,8 @@ public class HighLevelBindingTest extends UITestCase {
public void createContextTest() {
out.println(" - - - highLevelTest; create context - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
CLPlatform platform = CLPlatform.getDefault();
CLDevice[] devices = platform.listCLDevices();
@@ -280,6 +288,8 @@ public class HighLevelBindingTest extends UITestCase {
public void vectorAddGMTest() throws IOException {
out.println(" - - - highLevelTest; global memory kernel - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
CLPlatform[] clPlatforms = CLPlatform.listCLPlatforms();
CLContext context = CLContext.create(clPlatforms[0]);
diff --git a/test/com/jogamp/opencl/LowLevelBindingTest.java b/test/com/jogamp/opencl/LowLevelBindingTest.java
index 2780c07..5381cab 100644
--- a/test/com/jogamp/opencl/LowLevelBindingTest.java
+++ b/test/com/jogamp/opencl/LowLevelBindingTest.java
@@ -33,6 +33,7 @@ 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.MiscUtils;
import com.jogamp.opencl.test.util.UITestCase;
import java.io.IOException;
@@ -102,6 +103,8 @@ public class LowLevelBindingTest extends UITestCase {
public void contextlessTest() {
out.println(" - - - lowLevelTest; contextless binding - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
CL cl = CLPlatform.getLowLevelCLInterface();
@@ -174,6 +177,8 @@ public class LowLevelBindingTest extends UITestCase {
public void createContextTest() {
out.println(" - - - createContextTest - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
CL cl = CLPlatform.getLowLevelCLInterface();
@@ -219,6 +224,8 @@ public class LowLevelBindingTest extends UITestCase {
public void lowLevelVectorAddTest() throws InterruptedException {
out.println(" - - - lowLevelTest2; VectorAdd kernel - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
CL cl = CLPlatform.getLowLevelCLInterface();
diff --git a/test/com/jogamp/opencl/gl/CLGLTest.java b/test/com/jogamp/opencl/gl/CLGLTest.java
index 19bc1c9..52f0e57 100644
--- a/test/com/jogamp/opencl/gl/CLGLTest.java
+++ b/test/com/jogamp/opencl/gl/CLGLTest.java
@@ -45,6 +45,7 @@ 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.MiscUtils;
import com.jogamp.opencl.test.util.UITestCase;
import com.jogamp.opencl.util.CLDeviceFilters;
import com.jogamp.opencl.util.CLPlatformFilters;
@@ -106,9 +107,11 @@ public class CLGLTest extends UITestCase {
@Test(timeout=15000)
public void createContextTest() {
- initGL();
-
out.println(" - - - glcl; createContextTest - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
+
+ initGL();
CLPlatform platform = CLPlatform.getDefault(CLPlatformFilters.glSharing());
CLDevice device = platform.getMaxFlopsDevice(CLDeviceFilters.glSharing());
@@ -149,6 +152,8 @@ public class CLGLTest extends UITestCase {
public void vboSharing() {
out.println(" - - - glcl; vboSharing - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
initGL();
makeGLCurrent();
diff --git a/test/com/jogamp/opencl/test/util/MiscUtils.java b/test/com/jogamp/opencl/test/util/MiscUtils.java
index 8332c24..a7d5454 100644
--- a/test/com/jogamp/opencl/test/util/MiscUtils.java
+++ b/test/com/jogamp/opencl/test/util/MiscUtils.java
@@ -31,6 +31,8 @@ package com.jogamp.opencl.test.util;
import java.nio.ByteBuffer;
import java.util.Random;
+import com.jogamp.opencl.llb.impl.CLAbstractImpl;
+
import static java.lang.System.*;
import static org.junit.Assert.*;
@@ -77,4 +79,17 @@ public class MiscUtils {
a.rewind();
b.rewind();
}
+
+ /**
+ * @return true if OpenCL is not available for this operating system, CPU architecture, et cetera.
+ * This is meant to be a check that there can't possibly be a driver installed because
+ * nobody makes one, not just a check that we didn't see one.
+ */
+ public static final boolean isOpenCLUnavailable() {
+ if(!CLAbstractImpl.isAvailable() && System.getProperty("os.name").startsWith("SunOS")) {
+ out.println("OpenCL not available on this operating system. Skipping test.");
+ return true;
+ }
+ return false;
+ }
}
diff --git a/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java b/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
index a8c10ed..b9b0b62 100644
--- a/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
+++ b/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
@@ -10,6 +10,7 @@ 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.MiscUtils;
import com.jogamp.opencl.test.util.UITestCase;
import com.jogamp.opencl.util.concurrent.CLQueueContext.CLSimpleQueueContext;
import com.jogamp.opencl.util.concurrent.CLQueueContextFactory.CLSimpleContextFactory;
@@ -48,6 +49,9 @@ public class CLMultiContextTest extends UITestCase {
@Test
public void createMultiContextTest() {
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
+
CLMultiContext mc = CLMultiContext.create(CLPlatform.listCLPlatforms());
try{
@@ -117,6 +121,9 @@ public class CLMultiContextTest extends UITestCase {
@Test
public void commandQueuePoolTest() throws InterruptedException, ExecutionException {
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
+
CLMultiContext mc = CLMultiContext.create(CLPlatform.listCLPlatforms());
try {