summaryrefslogtreecommitdiffstats
path: root/test/com/jogamp/opencl
diff options
context:
space:
mode:
Diffstat (limited to 'test/com/jogamp/opencl')
-rw-r--r--test/com/jogamp/opencl/CLBufferTest.java14
-rw-r--r--test/com/jogamp/opencl/CLCommandQueueTest.java12
-rw-r--r--test/com/jogamp/opencl/CLImageTest.java11
-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.java6
-rw-r--r--test/com/jogamp/opencl/gl/CLGLTest.java4
-rw-r--r--test/com/jogamp/opencl/test/util/MiscUtils.java15
-rw-r--r--test/com/jogamp/opencl/test/util/UITestCase.java15
-rw-r--r--test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java6
10 files changed, 22 insertions, 84 deletions
diff --git a/test/com/jogamp/opencl/CLBufferTest.java b/test/com/jogamp/opencl/CLBufferTest.java
index 635af4fc..53222014 100644
--- a/test/com/jogamp/opencl/CLBufferTest.java
+++ b/test/com/jogamp/opencl/CLBufferTest.java
@@ -68,8 +68,6 @@ public class CLBufferTest extends UITestCase {
public void createBufferTest() {
out.println(" - - - highLevelTest; create buffer test - - - ");
- if(MiscUtils.isOpenCLUnavailable())
- return;
CLContext context = CLContext.create();
try{
@@ -125,8 +123,6 @@ public class CLBufferTest extends UITestCase {
public void writeCopyReadBufferTest() {
out.println(" - - - highLevelTest; copy buffer test - - - ");
- if(MiscUtils.isOpenCLUnavailable())
- return;
final int elements = NUM_ELEMENTS;
@@ -159,8 +155,6 @@ public class CLBufferTest extends UITestCase {
public void bufferWithHostPointerTest() {
out.println(" - - - highLevelTest; host pointer test - - - ");
- if(MiscUtils.isOpenCLUnavailable())
- return;
final int elements = NUM_ELEMENTS;
@@ -205,8 +199,6 @@ 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;
@@ -260,8 +252,6 @@ public class CLBufferTest extends UITestCase {
public void subBufferTest01ByteBuffer() {
out.println(" - - - subBufferTest - - - ");
- if(MiscUtils.isOpenCLUnavailable())
- return;
@SuppressWarnings("unchecked")
CLPlatform platform = CLPlatform.getDefault(version(CL_1_1));
@@ -307,8 +297,6 @@ public class CLBufferTest extends UITestCase {
public void subBufferTest02FloatBuffer() {
out.println(" - - - subBufferTest - - - ");
- if(MiscUtils.isOpenCLUnavailable())
- return;
@SuppressWarnings("unchecked")
CLPlatform platform = CLPlatform.getDefault(version(CL_1_1));
@@ -358,8 +346,6 @@ public class CLBufferTest extends UITestCase {
public void destructorCallbackTest() throws InterruptedException {
out.println(" - - - destructorCallbackTest - - - ");
- if(MiscUtils.isOpenCLUnavailable())
- return;
@SuppressWarnings("unchecked")
CLPlatform platform = CLPlatform.getDefault(version(CL_1_1));
diff --git a/test/com/jogamp/opencl/CLCommandQueueTest.java b/test/com/jogamp/opencl/CLCommandQueueTest.java
index 3fc17e85..9b3ed50e 100644
--- a/test/com/jogamp/opencl/CLCommandQueueTest.java
+++ b/test/com/jogamp/opencl/CLCommandQueueTest.java
@@ -102,8 +102,6 @@ public class CLCommandQueueTest extends UITestCase {
public void eventsTest() throws IOException {
out.println(" - - - event synchronization test - - - ");
- if(MiscUtils.isOpenCLUnavailable())
- return;
CLContext context = CLContext.create();
@@ -175,8 +173,6 @@ 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));
@@ -237,8 +233,6 @@ public class CLCommandQueueTest extends UITestCase {
public void profilingEventsTest() throws IOException {
out.println(" - - - event synchronization test - - - ");
- if(MiscUtils.isOpenCLUnavailable())
- return;
CLContext context = CLContext.create();
@@ -294,8 +288,6 @@ 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];
@@ -372,8 +364,6 @@ public class CLCommandQueueTest extends UITestCase {
public void eventCallbackTest() throws InterruptedException {
out.println(" - - - event callback test - - - ");
- if(MiscUtils.isOpenCLUnavailable())
- return;
CLPlatform platform = CLPlatform.getDefault();
@@ -414,8 +404,6 @@ 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 26e53ed2..5f5c0503 100644
--- a/test/com/jogamp/opencl/CLImageTest.java
+++ b/test/com/jogamp/opencl/CLImageTest.java
@@ -84,9 +84,6 @@ 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.");
@@ -109,10 +106,6 @@ 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.");
@@ -148,10 +141,6 @@ 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 7a56a939..cf74f4f2 100644
--- a/test/com/jogamp/opencl/CLProgramTest.java
+++ b/test/com/jogamp/opencl/CLProgramTest.java
@@ -79,8 +79,6 @@ 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"));
@@ -124,8 +122,6 @@ 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"))
@@ -207,8 +203,6 @@ 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"));
@@ -290,10 +284,6 @@ 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();
@@ -342,9 +332,6 @@ 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 9fa9f921..a4ce8e74 100644
--- a/test/com/jogamp/opencl/HighLevelBindingTest.java
+++ b/test/com/jogamp/opencl/HighLevelBindingTest.java
@@ -138,8 +138,6 @@ public class HighLevelBindingTest extends UITestCase {
public void contextlessTest() {
out.println(" - - - highLevelTest; contextless - - - ");
- if(MiscUtils.isOpenCLUnavailable())
- return;
// platform/device info tests
CLPlatform[] clPlatforms = CLPlatform.listCLPlatforms();
@@ -208,10 +206,6 @@ public class HighLevelBindingTest extends UITestCase {
@Test
public void platformTest() {
-
- if(MiscUtils.isOpenCLUnavailable())
- return;
-
@SuppressWarnings("unchecked")
CLPlatform platformGPU = CLPlatform.getDefault(version(CL_1_0), type(GPU));
@SuppressWarnings("unchecked")
@@ -230,8 +224,6 @@ 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();
@@ -291,8 +283,6 @@ 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 52d74882..a4cbd03e 100644
--- a/test/com/jogamp/opencl/LowLevelBindingTest.java
+++ b/test/com/jogamp/opencl/LowLevelBindingTest.java
@@ -103,8 +103,6 @@ public class LowLevelBindingTest extends UITestCase {
public void contextlessTest() {
out.println(" - - - lowLevelTest; contextless binding - - - ");
- if(MiscUtils.isOpenCLUnavailable())
- return;
CL cl = CLPlatform.getLowLevelCLInterface();
@@ -177,8 +175,6 @@ public class LowLevelBindingTest extends UITestCase {
public void createContextTest() {
out.println(" - - - createContextTest - - - ");
- if(MiscUtils.isOpenCLUnavailable())
- return;
CL cl = CLPlatform.getLowLevelCLInterface();
@@ -224,8 +220,6 @@ 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 b5d85690..2ad31aa3 100644
--- a/test/com/jogamp/opencl/gl/CLGLTest.java
+++ b/test/com/jogamp/opencl/gl/CLGLTest.java
@@ -108,8 +108,6 @@ public class CLGLTest extends UITestCase {
public void createContextTest() {
out.println(" - - - glcl; createContextTest - - - ");
- if(MiscUtils.isOpenCLUnavailable())
- return;
initGL();
@@ -154,8 +152,6 @@ 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 a7d54543..c91d8f21 100644
--- a/test/com/jogamp/opencl/test/util/MiscUtils.java
+++ b/test/com/jogamp/opencl/test/util/MiscUtils.java
@@ -29,8 +29,11 @@
package com.jogamp.opencl.test.util;
import java.nio.ByteBuffer;
+import java.util.HashSet;
import java.util.Random;
+import java.util.Set;
+import com.jogamp.common.os.Platform;
import com.jogamp.opencl.llb.impl.CLAbstractImpl;
import static java.lang.System.*;
@@ -80,16 +83,18 @@ public class MiscUtils {
b.rewind();
}
+ private static final Set<Platform.OSType> knownOSWithoutCLImpl;
+ static {
+ knownOSWithoutCLImpl = new HashSet<Platform.OSType>();
+ knownOSWithoutCLImpl.add(Platform.OSType.SUNOS);
+ }
+
/**
* @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;
+ return !CLAbstractImpl.isAvailable() && knownOSWithoutCLImpl.contains(Platform.getOSType());
}
}
diff --git a/test/com/jogamp/opencl/test/util/UITestCase.java b/test/com/jogamp/opencl/test/util/UITestCase.java
index 568feb9a..a5392ee9 100644
--- a/test/com/jogamp/opencl/test/util/UITestCase.java
+++ b/test/com/jogamp/opencl/test/util/UITestCase.java
@@ -34,6 +34,7 @@ import java.io.InputStreamReader;
import java.util.Iterator;
import java.util.List;
+import com.jogamp.common.os.Platform;
import com.jogamp.common.util.locks.SingletonInstance;
import org.junit.Assume;
@@ -125,9 +126,17 @@ public abstract class UITestCase {
@Before
public void setUp() {
System.err.print("++++ UITestCase.setUp: "+getFullTestName(" - "));
- if(!testSupported) {
- System.err.println(" - "+unsupportedTestMsg);
- Assume.assumeTrue(testSupported); // abort
+ final boolean isOpenCLUnavailable = MiscUtils.isOpenCLUnavailable();
+ final boolean abortTest = isOpenCLUnavailable || !testSupported;
+ if( abortTest ) {
+ if( isOpenCLUnavailable ) {
+ System.err.print(" - CL not supported on "+Platform.getOSType());
+ }
+ if( !testSupported ) {
+ System.err.print(" - "+unsupportedTestMsg);
+ }
+ System.err.println("");
+ Assume.assumeTrue(false); // abort
}
System.err.println();
}
diff --git a/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java b/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
index b9b0b62d..e1a59860 100644
--- a/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
+++ b/test/com/jogamp/opencl/util/concurrent/CLMultiContextTest.java
@@ -49,9 +49,6 @@ public class CLMultiContextTest extends UITestCase {
@Test
public void createMultiContextTest() {
- if(MiscUtils.isOpenCLUnavailable())
- return;
-
CLMultiContext mc = CLMultiContext.create(CLPlatform.listCLPlatforms());
try{
@@ -121,9 +118,6 @@ public class CLMultiContextTest extends UITestCase {
@Test
public void commandQueuePoolTest() throws InterruptedException, ExecutionException {
- if(MiscUtils.isOpenCLUnavailable())
- return;
-
CLMultiContext mc = CLMultiContext.create(CLPlatform.listCLPlatforms());
try {