aboutsummaryrefslogtreecommitdiffstats
path: root/test/com/jogamp/opencl/CLProgramTest.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-05-02 22:55:02 +0200
committerMichael Bien <[email protected]>2010-05-02 22:55:02 +0200
commit3b3dc4591d3690f61b9488ed74e7c9248def1fd5 (patch)
treec7c30c0a51d9a1dc22e9c52bb239b1ea96df3b07 /test/com/jogamp/opencl/CLProgramTest.java
parent59148a192446ddfefb13516d7ada72e6fa1661c7 (diff)
CLBuildListener functionality for high level bindings.
- uses low level BuildProgramCallback internally - updated tests, testing async builds
Diffstat (limited to 'test/com/jogamp/opencl/CLProgramTest.java')
-rw-r--r--test/com/jogamp/opencl/CLProgramTest.java23
1 files changed, 20 insertions, 3 deletions
diff --git a/test/com/jogamp/opencl/CLProgramTest.java b/test/com/jogamp/opencl/CLProgramTest.java
index 35dbde4b..ec238fb5 100644
--- a/test/com/jogamp/opencl/CLProgramTest.java
+++ b/test/com/jogamp/opencl/CLProgramTest.java
@@ -3,6 +3,7 @@ package com.jogamp.opencl;
import com.jogamp.opencl.util.CLBuildConfiguration;
import com.jogamp.opencl.util.CLProgramConfiguration;
import com.jogamp.opencl.CLProgram.Status;
+import com.jogamp.opencl.util.CLBuildListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -10,6 +11,7 @@ import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Map;
+import java.util.concurrent.CountDownLatch;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
@@ -158,7 +160,7 @@ public class CLProgramTest {
}
@Test
- public void builderTest() throws IOException, ClassNotFoundException {
+ public void builderTest() throws IOException, ClassNotFoundException, InterruptedException {
out.println(" - - - CLProgramTest; program builder test - - - ");
CLContext context = CLContext.create();
@@ -187,8 +189,23 @@ public class CLProgramTest {
.withDefine("ENABLE_FOOBAR");
out.println(builder);
-
- builder.setProgram(program).build();
+
+ // async build test
+ {
+ final CountDownLatch countdown = new CountDownLatch(1);
+ final CLProgram outerProgram = program;
+
+ CLBuildListener buildCallback = new CLBuildListener() {
+ public void buildFinished(CLProgram program) {
+ assertEquals(outerProgram, program);
+ countdown.countDown();
+ }
+ };
+
+ builder.setProgram(program).build(buildCallback);
+ countdown.await();
+ }
+
assertTrue(program.isExecutable());
// serialization test