aboutsummaryrefslogtreecommitdiffstats
path: root/test/com
diff options
context:
space:
mode:
authorWade Walker <[email protected]>2014-02-25 09:20:55 -0600
committerWade Walker <[email protected]>2014-02-25 09:20:55 -0600
commit6fc26e139d239219bead7e32ea40821a92ce3ef7 (patch)
tree2a4de626d2e0a50607a76a96abf4cf78646a877e /test/com
parentaf62da5b7ee3d99da7dc9364f1240fa7a8f5968e (diff)
parent54ced2cf5d801470c106275291be17583e5e206d (diff)
Merge remote-tracking branch 'personal/bug_978_fix_solaris_tests'
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 5b5d0e38..50820d4e 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;
import com.jogamp.common.util.Bitstream;
@@ -67,6 +68,8 @@ public class CLBufferTest extends UITestCase {
public void createBufferTest() {
out.println(" - - - highLevelTest; create buffer test - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
CLContext context = CLContext.create();
try{
@@ -122,6 +125,8 @@ public class CLBufferTest extends UITestCase {
public void writeCopyReadBufferTest() {
out.println(" - - - highLevelTest; copy buffer test - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
final int elements = NUM_ELEMENTS;
@@ -154,6 +159,8 @@ public class CLBufferTest extends UITestCase {
public void bufferWithHostPointerTest() {
out.println(" - - - highLevelTest; host pointer test - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
final int elements = NUM_ELEMENTS;
@@ -198,6 +205,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;
@@ -251,6 +260,8 @@ public class CLBufferTest extends UITestCase {
public void subBufferTest01ByteBuffer() {
out.println(" - - - subBufferTest - - - ");
+ if(MiscUtils.isOpenCLUnavailable())
+ return;
CLPlatform platform = CLPlatform.getDefault(version(CL_1_1));
if(platform == null) {
@@ -343,6 +354,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 672cc8b0..491eab53 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 3141f522..26e53ed2 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 eaf954e9..7fb7bc32 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 7e056bed..a0a67595 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();
@@ -206,6 +209,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));
@@ -222,6 +228,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();
@@ -281,6 +289,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 e7b069e1..90027e13 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 19bc1c99..52f0e574 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 8332c24a..a7d54543 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 a8c10ed4..b9b0b62d 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 {