From 3a32650d4229f9b4ad1f527d9e30c24ddb69bb3f Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 25 Mar 2010 13:07:58 +0100 Subject: http://www.jogamp.org/bugzilla/show_bug.cgi?id=390 The current junit tests use a fixed 'build' sub-path, not the customizing 'rootrel.build' path. More properties needs to be passed through (ant -> junit -> ant) to comply with the current build system: * rootrel.build * os.arch * gluegen.user.compiler.file Fixed .. However .. since even more properties may influence the build, a more native solution with just plain 'ant' might be more desireable .. --- make/build.xml | 19 ++++++----- make/lib/gluegen.compiler.linux-32bit.xml | 38 ++++++++++++++++++++++ make/make.gluegen.all.linux-x86.sh | 1 + test/junit/com/sun/gluegen/BasicTest.java | 2 +- test/junit/com/sun/gluegen/BuildUtil.java | 29 ++++++++++++++--- test/junit/com/sun/gluegen/StructAccessorTest.java | 2 +- test/junit/com/sun/gluegen/build.xml | 25 +++++++------- 7 files changed, 88 insertions(+), 28 deletions(-) create mode 100644 make/lib/gluegen.compiler.linux-32bit.xml diff --git a/make/build.xml b/make/build.xml index 75c28f5..2209d57 100755 --- a/make/build.xml +++ b/make/build.xml @@ -571,26 +571,29 @@ - - + + - - + + - - - + + + + + + - + diff --git a/make/lib/gluegen.compiler.linux-32bit.xml b/make/lib/gluegen.compiler.linux-32bit.xml new file mode 100644 index 0000000..ce1554c --- /dev/null +++ b/make/lib/gluegen.compiler.linux-32bit.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/make/make.gluegen.all.linux-x86.sh b/make/make.gluegen.all.linux-x86.sh index 87352c3..b76d85f 100644 --- a/make/make.gluegen.all.linux-x86.sh +++ b/make/make.gluegen.all.linux-x86.sh @@ -10,6 +10,7 @@ # -DisX11=true \ ant \ + -Dgluegen.user.compiler.file=`pwd`/lib/gluegen.compiler.linux-32bit.xml \ -Drootrel.build=build-x86 \ -Dos.arch=x86 \ $* 2>&1 | tee make.gluegen.all.linux-x86.log diff --git a/test/junit/com/sun/gluegen/BasicTest.java b/test/junit/com/sun/gluegen/BasicTest.java index a43d3e5..144128c 100644 --- a/test/junit/com/sun/gluegen/BasicTest.java +++ b/test/junit/com/sun/gluegen/BasicTest.java @@ -44,7 +44,7 @@ public class BasicTest { @Test public void bindingTest() throws Exception { - String nativesPath = gluegenRoot + "/build/test/build/natives"; + String nativesPath = testOutput + "/build/natives"; System.load(nativesPath + "/librofl.so"); Class clazz = Class.forName("test.BindingTest"); diff --git a/test/junit/com/sun/gluegen/BuildUtil.java b/test/junit/com/sun/gluegen/BuildUtil.java index de4f8e2..4477d7b 100644 --- a/test/junit/com/sun/gluegen/BuildUtil.java +++ b/test/junit/com/sun/gluegen/BuildUtil.java @@ -17,7 +17,8 @@ public final class BuildUtil { public static final String gluegenRoot; public static final String path; - public static final String output; + public static final String testOutput; + public static final String rootrel_build; static { @@ -25,6 +26,13 @@ public final class BuildUtil { out.println("OS: " + System.getProperty("os.name")); out.println("VM: " + System.getProperty("java.vm.name")); + String rootrel_build_tmp = System.getProperty("rootrel.build"); + if(null==rootrel_build_tmp || rootrel_build_tmp.length()==0) { + rootrel_build_tmp = "build" ; + } + rootrel_build = rootrel_build_tmp; + out.println("rootrel.build: " + rootrel_build); + // setup paths try { File executionRoot = new File(BuildUtil.class.getProtectionDomain().getCodeSource().getLocation().toURI()); @@ -36,10 +44,10 @@ public final class BuildUtil { } path = gluegenRoot + "/test/junit/com/sun/gluegen"; - output = gluegenRoot + "/build/test"; + testOutput = gluegenRoot + "/" + rootrel_build + "/test"; out.println("path: "+path); - out.println("output: "+output); + out.println("testOutput: "+testOutput); out.println(" - - - - - - - - - - - - "); cleanGeneratedFiles(); @@ -47,6 +55,9 @@ public final class BuildUtil { //setup ant build file project = new Project(); project.setBaseDir(new File(gluegenRoot)); + project.setProperty("rootrel.build", rootrel_build); + passSystemProperty(project, "gluegen.user.compiler.file"); + passSystemProperty(project, "os.arch"); DefaultLogger logger = new DefaultLogger(); logger.setErrorPrintStream(out); @@ -64,9 +75,17 @@ public final class BuildUtil { ProjectHelper.configureProject(project, buildFile); } + public static Project passSystemProperty(Project p, String name) { + String tmp = System.getProperty(name); + if(null!=tmp && tmp.length()>0) { + p.setProperty(name, tmp); + } + return p; + } + public static void cleanGeneratedFiles() { out.println("cleaning generated files"); - deleteDirectory(new File(output+"/gensrc")); + deleteDirectory(new File(testOutput+"/gensrc")); out.println("done"); } @@ -95,7 +114,7 @@ public final class BuildUtil { out.println("generate binding: " + bindingName); GlueGen.main( "-I"+path, - "-O"+output+"/gensrc", + "-O"+testOutput+"/gensrc", // "-Ecom.sun.gluegen.DebugEmitter", "-C"+path+"/"+bindingName+".cfg", path+"/"+bindingName+".h" ); diff --git a/test/junit/com/sun/gluegen/StructAccessorTest.java b/test/junit/com/sun/gluegen/StructAccessorTest.java index 0cd2953..3562077 100644 --- a/test/junit/com/sun/gluegen/StructAccessorTest.java +++ b/test/junit/com/sun/gluegen/StructAccessorTest.java @@ -46,7 +46,7 @@ public class StructAccessorTest { // compile testcase String source = gluegenRoot + "/test/junit/com/sun/gluegen/StructValidator.java"; - compile(new File(source), gluegenRoot+"/build/test/build/classes"); + compile(new File(source), testOutput + "/build/classes"); // invoke test Class test = Class.forName("com.sun.gluegen.StructValidator"); diff --git a/test/junit/com/sun/gluegen/build.xml b/test/junit/com/sun/gluegen/build.xml index c52101e..ab71431 100644 --- a/test/junit/com/sun/gluegen/build.xml +++ b/test/junit/com/sun/gluegen/build.xml @@ -4,9 +4,15 @@ Tests GlueGen + + + + + + - - + + @@ -25,7 +31,7 @@ - + @@ -74,7 +80,7 @@ - + @@ -82,15 +88,8 @@ - - - - - - - - - + + -- cgit v1.2.3