From 9ca000faa6aea6771ff5cf209846ef7fb9ff227a Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Fri, 22 Jan 2010 18:02:35 +0100 Subject: dynamic dispatch via CLProcAddressTable for OpenCL extensions. made CLProgram failsafe, updated tests. --- test/com/mbien/opencl/CLProgramTest.java | 48 ++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) (limited to 'test/com') diff --git a/test/com/mbien/opencl/CLProgramTest.java b/test/com/mbien/opencl/CLProgramTest.java index 0ca0fa9..bc095a9 100644 --- a/test/com/mbien/opencl/CLProgramTest.java +++ b/test/com/mbien/opencl/CLProgramTest.java @@ -6,7 +6,6 @@ import org.junit.Test; import static org.junit.Assert.*; import static java.lang.System.*; -import static com.mbien.opencl.TestUtils.*; import static com.sun.gluegen.runtime.BufferFactory.*; /** @@ -31,10 +30,12 @@ public class CLProgramTest { assertEquals(ex.errorcode, CL.CL_INVALID_PROGRAM_EXECUTABLE); } + out.println(program.getBuildStatus()); program.build(); - assertTrue(program.isExecutable()); out.println(program.getBuildStatus()); + assertTrue(program.isExecutable()); + Map kernels = program.getCLKernels(); assertNotNull(kernels); assertTrue("kernel map is empty", kernels.size() > 0); @@ -76,11 +77,52 @@ public class CLProgramTest { // 2. re-create program with old binaries program.release(); + assertFalse(program.isExecutable()); + + assertNotNull(program.getBinaries()); + assertEquals(program.getBinaries().size(), 0); + + assertNotNull(program.getBuildLog()); + assertEquals(program.getBuildLog().length(), 0); + + assertNotNull(program.getSource()); + assertEquals(program.getSource().length(), 0); + + assertNotNull(program.getCLDevices()); + assertEquals(program.getCLDevices().length, 0); + + assertNotNull(program.getCLKernels()); + assertEquals(program.getCLKernels().size(), 0); + + assertNull(program.getCLKernel("foo")); + program = context.createProgram(binaries); - out.println(program.getBuildStatus()); + assertFalse(program.isExecutable()); + assertNotNull(program.getCLDevices()); + assertTrue(program.getCLDevices().length != 0); + + assertNotNull(program.getBinaries()); + assertEquals(program.getBinaries().size(), 0); + + assertNotNull(program.getBuildLog()); + assertTrue(program.getBuildLog().length() != 0); + + assertNotNull(program.getSource()); + assertEquals(program.getSource().length(), 0); + + try{ + program.getCLKernels(); + }catch(CLException ex) { + // expected, not build yet + } + + out.println(program.getBuildStatus()); program.build(); + out.println(program.getBuildStatus()); + + assertNotNull(program.getCLKernel("Test")); assertTrue(program.isExecutable()); -- cgit v1.2.3