diff options
Diffstat (limited to 'test/com')
-rw-r--r-- | test/com/mbien/opencl/HighLevelBindingTest.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/com/mbien/opencl/HighLevelBindingTest.java b/test/com/mbien/opencl/HighLevelBindingTest.java index edeedc6b..2a8807ad 100644 --- a/test/com/mbien/opencl/HighLevelBindingTest.java +++ b/test/com/mbien/opencl/HighLevelBindingTest.java @@ -225,5 +225,45 @@ public class HighLevelBindingTest { out.println("results are valid"); } + + @Test + public void rebuildProgramTest() throws IOException { + + out.println(" - - - highLevelTest; rebuild program test - - - "); + + CLContext context = CLContext.create(); + CLProgram program = context.createProgram(getClass().getResourceAsStream("testkernels.cl")); + + try{ + program.getCLKernels(); + fail("expected exception but got none :("); + }catch(CLException ex) { + out.println("got expected exception:\n"+ex.getMessage()); + assertTrue(ex.errorcode == CL.CL_INVALID_PROGRAM_EXECUTABLE); + } + + program.build(); + assertTrue(program.isExecutable()); + out.println(program.getBuildStatus()); + + Map<String, CLKernel> kernels = program.getCLKernels(); + assertNotNull(kernels); + assertTrue("kernel map is empty", kernels.size() > 0); + + // rebuild + // 1. release kernels (internally) + // 2. build program + program.build(); + assertTrue(program.isExecutable()); + out.println(program.getBuildStatus()); + + // try again with rebuilt program + kernels = program.getCLKernels(); + assertNotNull(kernels); + assertTrue("kernel map is empty", kernels.size() > 0); + assertTrue(kernels.size() > 0); + + context.release(); + } } |